Blender V5.3
fill.cc File Reference
#include "BLI_bounds.hh"
#include "BLI_color_types.hh"
#include "BLI_delaunay_2d.hh"
#include "BLI_enum_flags.hh"
#include "BLI_index_mask.hh"
#include "BLI_math_base.hh"
#include "BLI_math_geom_c.hh"
#include "BLI_math_matrix.hh"
#include "BLI_math_vector.hh"
#include "BLI_multi_value_map.hh"
#include "BLI_offset_indices.hh"
#include "BLI_stack.hh"
#include "BLI_task.hh"
#include "BKE_attribute.hh"
#include "BKE_camera.h"
#include "BKE_context.hh"
#include "BKE_crazyspace.hh"
#include "BKE_curves.hh"
#include "BKE_grease_pencil.hh"
#include "BKE_image.hh"
#include "BKE_lib_id.hh"
#include "BKE_material.hh"
#include "BKE_paint.hh"
#include "DNA_brush_types.h"
#include "DNA_curves_types.h"
#include "DNA_grease_pencil_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
#include "DEG_depsgraph_query.hh"
#include "ED_grease_pencil.hh"
#include "ED_view3d.hh"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "GPU_state.hh"
#include "grease_pencil_intern.hh"
#include <list>
#include <optional>
#include <queue>

Go to the source code of this file.

Classes

class  blender::ed::greasepencil::ImageBufferAccessor
struct  blender::ed::greasepencil::FillBoundary
struct  blender::ed::greasepencil::EdgeCurves

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::ed
namespace  blender::ed::greasepencil

Typedefs

using blender::ed::greasepencil::EncodedConnection = int
using blender::ed::greasepencil::EdgeConnections = VecBase<EncodedConnection, 2>

Enumerations

enum  blender::ed::greasepencil::Side : uint8_t { blender::ed::greasepencil::Start = 0 , blender::ed::greasepencil::End = 1 }

Functions

static IndexMask blender::ed::greasepencil::get_visible_boundary_strokes (const Object &object, const DrawingInfo &info, const bool is_boundary_layer, IndexMaskMemory &memory)
static VArray< ColorGeometry4f > blender::ed::greasepencil::get_stroke_colors (const Object &object, const bke::CurvesGeometry &curves, const VArray< float > &opacities, const VArray< int > materials, const ColorGeometry4f &tint_color, const std::optional< float > opacity_threshold)
static Bounds< float2 > blender::ed::greasepencil::get_region_bounds (const ARegion &region)
static std::optional< Bounds< float2 > > blender::ed::greasepencil::get_boundary_bounds (const ARegion &region, const RegionView3D &rv3d, const Object &object, const Object &object_eval, const VArray< bool > &boundary_layers, const Span< DrawingInfo > src_drawings)
static auto blender::ed::greasepencil::fit_strokes_to_view (const ViewContext &view_context, const VArray< bool > &boundary_layers, const Span< DrawingInfo > src_drawings, const FillToolFitMethod fit_method, const float2 fill_point, const bool uniform_zoom, const float max_zoom_factor, const float2 margin, const float pixel_scale)
static Image * blender::ed::greasepencil::render_strokes (const ViewContext &view_context, const Brush &brush, const Scene &scene, const bke::greasepencil::Layer &layer, const VArray< bool > &boundary_layers, const Span< DrawingInfo > src_drawings, const int2 &image_size, const std::optional< float > opacity_threshold, const float2 &fill_point, const ExtensionData &extensions, const ed::greasepencil::DrawingPlacement &placement, const float2 &zoom, const float2 &offset)
bke::CurvesGeometry blender::ed::greasepencil::pixel_fill_strokes (const ViewContext &view_context, const Brush &brush, const Scene &scene, const bke::greasepencil::Layer &layer, const VArray< bool > &boundary_layers, const Span< DrawingInfo > src_drawings, bool invert, const std::optional< float > opacity_threshold, const float2 &fill_point, const ExtensionData &extensions, FillToolFitMethod fit_method, bool keep_images)
static EncodedConnection blender::ed::greasepencil::encode_index_and_side (const int index, const Side side)
static int blender::ed::greasepencil::decode_index (const EncodedConnection encoded)
static Side blender::ed::greasepencil::decode_side (const EncodedConnection encoded)
static EdgeCurves blender::ed::greasepencil::follow_edge_connections (const Span< int > all_edges, const Span< bool > edges_to_keep, const Span< EdgeConnections > edge_connections)
static Array< int3 > blender::ed::greasepencil::get_all_triangle_edges (const Span< int2 > edges, const Span< Vector< int > > tris)
static Array< int3 > blender::ed::greasepencil::get_all_triangle_adjacency (const int num_edges, const Span< Vector< int > > tris, const Span< int3 > tri_edges)
static Array< float > blender::ed::greasepencil::get_edge_weights (const Span< int2 > edges, const Span< double2 > verts)
static Array< float > blender::ed::greasepencil::get_tri_max_weight (const int num_tris, const Span< int3 > tri_adjacency, const Span< int3 > tri_edges, const Span< float > edge_weights, const Span< bool > is_source_edge)
static void blender::ed::greasepencil::add_weights_for_tri (const Span< int3 > tri_adjacency, const Span< int3 > tri_edges, const Span< float > edge_weights, const Span< float > tri_max_weight, const Span< bool > is_source_edge, const int hint_tri_index, const int hint_index, MutableSpan< int > r_tri_hint_index, MutableSpan< float > r_tri_weights)
static std::optional< meshintersect::CDT_input< double > > blender::ed::greasepencil::get_input_from_drawings (const Span< DrawingInfo > src_drawings, const Object &object, const VArray< bool > &boundary_layers, const ARegion &region, const std::optional< float > opacity_threshold, Array< double2 > &r_cdt_verts, Array< int2 > &r_cdt_edges)
static std::optional< EdgeCurves > blender::ed::greasepencil::create_connected_edges_from_fill (const Span< bool > tri_to_fill, const bool invert, const Span< int3 > tri_adjacency, const Span< int3 > tri_edges, const Span< int2 > edges)
std::optional< bke::CurvesGeometry > blender::ed::greasepencil::delaunay_fill_strokes (const ViewContext &view_context, const Scene &scene, const bke::greasepencil::Layer &layer, const VArray< bool > &boundary_layers, const Span< DrawingInfo > src_drawings, bool invert, std::optional< float > opacity_threshold, bool internal_gaps, float gap_factor, const GroupedSpan< float2 > &fill_points)

Variables

constexpr const char * blender::ed::greasepencil::attr_material_index = "material_index"
constexpr const char * blender::ed::greasepencil::attr_is_fill_guide = ".is_fill_guide"
static constexpr EncodedConnection blender::ed::greasepencil::EDGE_CONNECTION_NULL = 0
constexpr int blender::ed::greasepencil::NULL_INDEX = -1

Color Values and Flags

enum  blender::ed::greasepencil::ColorFlag {
  blender::ed::greasepencil::Border = (1 << 0) , blender::ed::greasepencil::Stroke = (1 << 1) , blender::ed::greasepencil::Fill = (1 << 2) , blender::ed::greasepencil::Seed = (1 << 3) ,
  blender::ed::greasepencil::Debug = (1 << 7)
}
const ColorGeometry4f blender::ed::greasepencil::draw_boundary_color = {1, 0, 0, 1}
const ColorGeometry4f blender::ed::greasepencil::draw_seed_color = {0, 1, 0, 1}

Boundary from Pixel Buffer

enum class  blender::ed::greasepencil::FillResult { blender::ed::greasepencil::Success , blender::ed::greasepencil::BorderContact }
enum  blender::ed::greasepencil::FillBorderMode { blender::ed::greasepencil::Cancel , blender::ed::greasepencil::Ignore }
constexpr const int blender::ed::greasepencil::num_directions = 8
static const int2 blender::ed::greasepencil::offset_by_direction [num_directions]
static bool blender::ed::greasepencil::get_flag (const ColorGeometry4b &color, const ColorFlag flag)
static void blender::ed::greasepencil::set_flag (ColorGeometry4b &color, const ColorFlag flag, bool value)
static void blender::ed::greasepencil::convert_colors_to_flags (ImageBufferAccessor &buffer)
static void blender::ed::greasepencil::convert_flags_to_colors (ImageBufferAccessor &buffer)
static void blender::ed::greasepencil::mark_borders (ImageBufferAccessor &buffer)
template<FillBorderMode border_mode>
FillResult blender::ed::greasepencil::flood_fill (ImageBufferAccessor &buffer, const int leak_filter_width=0)
static void blender::ed::greasepencil::invert_fill (ImageBufferAccessor &buffer)
static void blender::ed::greasepencil::dilate (ImageBufferAccessor &buffer, int iterations=1)
static void blender::ed::greasepencil::erode (ImageBufferAccessor &buffer, int iterations=1)
static int blender::ed::greasepencil::wrap_dir_3n (const int dir)
static FillBoundary blender::ed::greasepencil::build_fill_boundary (const ImageBufferAccessor &buffer)
static bke::CurvesGeometry blender::ed::greasepencil::boundary_to_curves (const FillBoundary &boundary, const ImageBufferAccessor &buffer, const ed::greasepencil::DrawingPlacement &placement, const float3x3 &image_to_region)
static bke::CurvesGeometry blender::ed::greasepencil::process_image (Image &ima, const Brush &brush, const ed::greasepencil::DrawingPlacement &placement, const float3x3 &image_to_region, const bool invert, const bool output_as_colors)