51 r_rgb[0] = r_rgb[1] = r_rgb[2] = 255;
55 r_rgb[1] = r_rgb[2] = 0;
60 r_rgb[1] = r_rgb[2] = 0;
73 r_rgb[0] = r_rgb[2] = 0;
77 r_rgb[0] = r_rgb[2] = 0;
94 const float handle_size,
95 const float point_pos[2],
96 const float handle_pos[2])
102 handle_type = bezt->
h1;
105 handle_type = bezt->
h2;
114 const uchar rgb_gray[4] = {0x60, 0x60, 0x60, 0xff};
128 switch (handle_type) {
153 float point_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
179 const bool is_spline_sel = (spline->
flag &
SELECT) &&
185 bool undistort =
false;
187 int tot_feather_point;
188 float (*feather_points)[2], (*fp)[2];
212 for (
int i = 0; i < spline->
tot_point; i++) {
217 for (
int j = 0; j <= point->
tot_uw; j++) {
218 float feather_point[2];
253 MEM_delete(feather_points);
261 for (
int i = 0; i < spline->
tot_point; i++) {
287 float handle_left[2], handle_right[2];
328 float x = (
min[0] +
max[0]) * 0.5f;
329 float y = (
min[1] +
max[1]) * 0.5f;
355 r_rgb[0] =
uchar((
int(rgb[0]) + 128) / 2);
356 r_rgb[1] =
uchar((
int(rgb[1]) + 128) / 2);
357 r_rgb[2] =
uchar((
int(rgb[2]) + 128) / 2);
361 *
reinterpret_cast<uint *
>(r_rgb) = *
reinterpret_cast<const uint *
>(rgb);
367 const float (*points)[2],
371 for (
uint i = 0; i < vertex_len; i++) {
379 float (*orig_points)[2],
381 const bool is_feather,
382 const bool is_active,
383 const uchar rgb_spline[4],
388 const uchar rgb_black[4] = {0x00, 0x00, 0x00, 0xff};
391 float (*points)[2] = orig_points;
399 for (
int i = 0; i < tot_point; i++) {
437 rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 0;
440 rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 255;
451 rgb_tmp[0] =
uchar((
short(rgb_tmp[0]) +
short(rgb_spline[0])) / 2);
452 rgb_tmp[1] =
uchar((
short(rgb_tmp[1]) +
short(rgb_spline[1])) / 2);
453 rgb_tmp[2] =
uchar((
short(rgb_tmp[2]) +
short(rgb_spline[2])) / 2);
473 float viewport_size[4];
495 if (points != orig_points) {
504 const bool is_active,
513 const bool is_spline_sel = (spline->
flag &
SELECT) &&
518 float (*diff_points)[2];
520 uint tot_feather_point;
521 float (*feather_points)[2];
532 spline, resol, (is_fill !=
false), &tot_feather_point);
537 C, spline, feather_points, tot_feather_point,
true, is_active, rgb_tmp, draw_type);
540 const float *fp = &diff_points[0][0];
541 float *fp_feather = &feather_points[0][0];
543 BLI_assert(tot_diff_point == tot_feather_point);
545 for (
int i = 0; i < tot_diff_point; i++, fp += 2, fp_feather += 2) {
553 C, spline, feather_points, tot_feather_point,
true, is_active, rgb_tmp, draw_type);
556 MEM_delete(feather_points);
561 C, spline, diff_points, tot_diff_point,
false, is_active, rgb_tmp, draw_type);
562 MEM_delete(diff_points);
572 const bool is_active)
602 for (
const auto [i, mask_layer] :
mask->masklayers.enumerate()) {
603 const bool is_active = (i ==
mask->masklay_act);
610 active = &mask_layer;
617 if (active !=
nullptr) {
643 Depsgraph *depsgraph,
646 const bool show_overlays,
650 const float blend_factor,
656 const bool do_scale_applied,
657 const bool do_draw_cb,
667 const float width = width_i, height =
float(height_i) * (aspy / aspx);
686 if (do_scale_applied) {
695 maxdim =
max_ff(width, height);
696 if (width == height) {
699 else if (width < height) {
700 xofs = ((height - width) / -2.0f) * zoomx;
705 yofs = ((width - height) / -2.0f) * zoomy;
709 float buf_col[4] = {1.0f, 0.0f, 0.0f, 0.0f};
733 const float blend_col[4] = {0.0f, 0.0f, 0.0f, blend_factor};
739 gpu::TextureFormat::SFLOAT_16,
751 gpu::TextureFormat::SFLOAT_16,
794 Mask *
mask,
ARegion *region,
const int cfra,
const int sfra,
const int efra)
796 const float framelen = region->
winx /
float(efra - sfra + 1);
799 if (mask_layer ==
nullptr) {
804 if (num_lines == 0) {
810 const int region_bottom = rect_visible->
ymin;
820 int frame = mask_layer_shape.
frame;
823 int height = (frame == cfra) ? 22 : 10;
824 int x = (frame - sfra) * framelen;
Object is a sort of wrapper for general info.
#define REGION_DRAW_POST_VIEW
#define REGION_DRAW_PRE_VIEW
Read Blender memory allocation and freeing.
#define INIT_MINMAX2(min, max)
gpu::Shader * shader_get()
void draw(float x, float y, int img_w, int img_h, gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float scale_x, float scale_y, const float color[4])
void get_color_3fv(int colorid, float col[3])
float get_value_f(int colorid)
void view2d_view_to_region(const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
@ MASK_WHICH_HANDLE_RIGHT
@ MASK_WHICH_HANDLE_STICK
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ MASK_OVERLAY_ALPHACHANNEL
MINLINE void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
void ED_region_draw_cb_draw(const bContext *C, ARegion *region, int type)
static void mask_color_active_tint(uchar r_rgb[4], const uchar rgb[4], const bool is_active)
void immUniformColor3f(float r, float g, float b)
MaskRasterHandle * BKE_maskrasterize_handle_new()
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
void BKE_mask_point_handle(const MaskSplinePoint *point, eMaskWhichHandle which_handle, float r_handle[2])
void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
static void draw_spline_points(const bContext *C, MaskLayer *mask_layer, MaskSpline *spline, const MaskDrawType draw_type)
void immUniform2f(const char *name, float x, float y)
MINLINE void copy_v2_v2(float r[2], const float a[2])
GPUVertFormat * immVertexFormat()
void ED_clip_point_undistorted_pos(const SpaceClip *sc, const float co[2], float r_co[2])
static void mask_point_undistort_pos(SpaceClip *sc, float r_co[2], const float co[2])
SpaceClip * CTX_wm_space_clip(const bContext *C)
void immBegin(GPUPrimType, uint vertex_len)
void GPU_line_smooth(bool enable)
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE int max_ii(int a, int b)
@ TH_HANDLE_VERTEX_SELECT
const rcti * ED_region_visible_rect(ARegion *region)
@ MCLIP_PROXY_RENDER_UNDISTORT
void immUniformColor3ubv(const unsigned char rgb[3])
void GPU_matrix_mul(const float m[4][4])
void GPU_line_width(float width)
static void mask_spline_color_get(MaskLayer *mask_layer, MaskSpline *spline, const bool is_sel, uchar r_rgb[4])
void GPU_matrix_scale_2f(float x, float y)
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void BKE_mask_coord_to_movieclip(MovieClip *clip, MovieClipUser *user, float r_co[2], const float co[2])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void immUniform1f(const char *name, float x)
void immVertex2f(uint attr_id, float x, float y)
bool BKE_mask_point_selected(const MaskSplinePoint *p)
void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height)
void GPU_viewport_size_get_f(float coords[4])
float(* BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline *spline, unsigned int resol, bool do_feather_isect, unsigned int *r_tot_feather_point))[2]
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoint *point, const eMaskWhichHandle which_handle, const int draw_type, const float handle_size, const float point_pos[2], const float handle_pos[2])
@ GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA
@ GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR
@ GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
void immUniform4fv(const char *name, const float data[4])
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
void GPU_shader_uniform_float_ex(gpu::Shader *shader, int location, int length, int array_size, const float *value)
void immUniformThemeColor3(int color_id)
void BKE_mask_coord_from_movieclip(MovieClip *clip, MovieClipUser *user, float r_co[2], const float co[2])
float(* BKE_mask_spline_feather_points(MaskSpline *spline, int *tot_feather_point))[2]
void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, Mask *mask, int width, int height, bool do_aspect_correct, bool do_mask_aa, bool do_feather)
MaskLayer * BKE_mask_layer_active(Mask *mask)
static float * mask_rasterize(Mask *mask, const int width, const int height)
void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
static void mask_spline_feather_color_get(MaskLayer *, MaskSpline *, const bool is_sel, uchar r_rgb[4])
bool BKE_mask_point_is_handle_selected(const MaskSplinePoint *point, eMaskWhichHandle handle)
bool BKE_mask_point_selected_knot(const MaskSplinePoint *p)
static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float(*orig_points)[2], int tot_point, const bool is_feather, const bool is_active, const uchar rgb_spline[4], const MaskDrawType draw_type)
void GPU_program_point_size(bool enable)
void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset)
void GPU_matrix_translate_2f(float x, float y)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
static void draw_spline_curve(const bContext *C, MaskLayer *mask_layer, MaskSpline *spline, const MaskDrawType draw_type, const bool is_active, const int width, const int height)
int GPU_shader_get_uniform(gpu::Shader *shader, const char *name)
void immUniform4f(const char *name, float x, float y, float z, float w)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
void ED_mask_draw_frames(Mask *mask, ARegion *region, int cfra, int sfra, int efra)
unsigned int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height)
MINLINE float max_ff(float a, float b)
static void draw_layer_splines(const bContext *C, MaskLayer *layer, const MaskDrawType draw_type, const int width, const int height, const bool is_active)
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, unsigned int width, unsigned int height, float *buffer)
Rasterize a buffer from a single mask (threaded execution).
void GPU_blend(GPUBlend blend)
void immUniform1i(const char *name, int x)
static void mask_draw_array(uint pos, GPUPrimType prim_type, const float(*points)[2], uint vertex_len)
void immUniformColor4ubv(const unsigned char rgba[4])
void immVertex2fv(uint attr_id, const float data[2])
void immUniformColor3fvAlpha(const float rgb[3], float a)
MaskSplinePoint * BKE_mask_spline_point_array(MaskSpline *spline)
eMaskhandleMode BKE_mask_point_handles_mode_get(const MaskSplinePoint *point)
void ED_mask_draw_region(Depsgraph *depsgraph, Mask *mask, ARegion *region, bool show_overlays, MaskDrawFlag draw_flag, MaskDrawType draw_type, MaskOverlayMode overlay_mode, float blend_factor, int width_i, int height_i, float aspx, float aspy, bool do_scale_applied, bool do_draw_cb, float stabmat[4][4], const bContext *C)
static void draw_mask_layers(const bContext *C, Mask *mask, const MaskDrawType draw_type, const int width, const int height)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
float(* BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, unsigned int resol, unsigned int *r_tot_diff_point))[2]
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct MaskSplinePoint * act_point
struct MaskSpline * act_spline
ListBaseT< MaskLayerShape > splines_shapes
MaskLayerVisibility visibility_flag
MaskSplineRuntime * runtime
eMovieClipProxy_RenderFlag render_flag
struct MovieClipUser user
Array< MaskSplinePoint > points_deform