49 r_rgb[0] = r_rgb[1] = r_rgb[2] = 255;
53 r_rgb[1] = r_rgb[2] = 0;
58 r_rgb[1] = r_rgb[2] = 0;
71 r_rgb[0] = r_rgb[2] = 0;
75 r_rgb[0] = r_rgb[2] = 0;
92 const float handle_size,
93 const float point_pos[2],
94 const float handle_pos[2])
100 handle_type = bezt->
h1;
103 handle_type = bezt->
h2;
112 const uchar rgb_gray[4] = {0x60, 0x60, 0x60, 0xff};
126 switch (handle_type) {
151 float point_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
175 const char draw_type)
177 const bool is_spline_sel = (spline->
flag &
SELECT) &&
183 bool undistort =
false;
185 int tot_feather_point;
186 float (*feather_points)[2], (*fp)[2];
215 for (
int j = 0; j <= point->
tot_uw; j++) {
216 float feather_point[2];
285 float handle_left[2], handle_right[2];
326 float x = (
min[0] +
max[0]) * 0.5f;
327 float y = (
min[1] +
max[1]) * 0.5f;
353 r_rgb[0] =
uchar((
int(rgb[0]) + 128) / 2);
354 r_rgb[1] =
uchar((
int(rgb[1]) + 128) / 2);
355 r_rgb[2] =
uchar((
int(rgb[2]) + 128) / 2);
359 *(
uint *)r_rgb = *(
const uint *)rgb;
365 const float (*points)[2],
369 for (
uint i = 0;
i < vertex_len;
i++) {
377 float (*orig_points)[2],
379 const bool is_feather,
380 const bool is_active,
381 const uchar rgb_spline[4],
382 const char draw_type)
386 const uchar rgb_black[4] = {0x00, 0x00, 0x00, 0xff};
389 float (*points)[2] = orig_points;
397 for (
int i = 0;
i < tot_point;
i++) {
435 rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 0;
438 rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 255;
449 rgb_tmp[0] =
uchar((
short(rgb_tmp[0]) +
short(rgb_spline[0])) / 2);
450 rgb_tmp[1] =
uchar((
short(rgb_tmp[1]) +
short(rgb_spline[1])) / 2);
451 rgb_tmp[2] =
uchar((
short(rgb_tmp[2]) +
short(rgb_spline[2])) / 2);
471 float viewport_size[4];
493 if (points != orig_points) {
501 const char draw_type,
502 const bool is_active,
511 const bool is_spline_sel = (spline->
flag &
SELECT) &&
516 float (*diff_points)[2];
518 uint tot_feather_point;
519 float (*feather_points)[2];
530 spline, resol, (is_fill !=
false), &tot_feather_point);
535 C, spline, feather_points, tot_feather_point,
true, is_active, rgb_tmp, draw_type);
538 const float *fp = &diff_points[0][0];
539 float *fp_feather = &feather_points[0][0];
541 BLI_assert(tot_diff_point == tot_feather_point);
543 for (
int i = 0;
i < tot_diff_point;
i++, fp += 2, fp_feather += 2) {
551 C, spline, feather_points, tot_feather_point,
true, is_active, rgb_tmp, draw_type);
559 C, spline, diff_points, tot_diff_point,
false, is_active, rgb_tmp, draw_type);
567 const char draw_type,
570 const bool is_active)
594 const bContext *
C,
Mask *
mask,
const char draw_type,
const int width,
const int height)
602 const bool is_active = (
i ==
mask->masklay_act);
645 const bool show_overlays,
646 const char draw_flag,
647 const char draw_type,
649 const float blend_factor,
655 const bool do_scale_applied,
656 const bool do_draw_cb,
666 const float width = width_i, height =
float(height_i) * (aspy / aspx);
685 if (do_scale_applied) {
694 maxdim =
max_ff(width, height);
695 if (width == height) {
698 else if (width < height) {
699 xofs = ((height - width) / -2.0f) * zoomx;
704 yofs = ((width - height) / -2.0f) * zoomy;
708 float buf_col[4] = {1.0f, 0.0f, 0.0f, 0.0f};
729 const float blend_col[4] = {0.0f, 0.0f, 0.0f, blend_factor};
736 blender::gpu::TextureFormat::SFLOAT_16,
749 blender::gpu::TextureFormat::SFLOAT_16,
792 Mask *
mask,
ARegion *region,
const int cfra,
const int sfra,
const int efra)
794 const float framelen = region->
winx /
float(efra - sfra + 1);
797 if (mask_layer ==
nullptr) {
802 if (num_lines == 0) {
808 const int region_bottom = rect_visible->
ymin;
819 int frame = mask_layer_shape->frame;
822 int height = (frame == cfra) ? 22 : 10;
823 int x = (frame - sfra) * framelen;
void immDrawPixelsTexTiled(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float xzoom, float yzoom, const float color[4])
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
SpaceClip * CTX_wm_space_clip(const bContext *C)
int BKE_mask_spline_resolution(struct MaskSpline *spline, int width, int height)
#define MASKPOINT_ISSEL_ANY(p)
float(* BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, unsigned int resol, unsigned int *r_tot_diff_point))[2]
void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
unsigned int BKE_mask_spline_feather_resolution(struct MaskSpline *spline, int width, int height)
@ MASK_WHICH_HANDLE_RIGHT
@ MASK_WHICH_HANDLE_STICK
MaskRasterHandle * BKE_maskrasterize_handle_new(void)
#define MASKPOINT_ISSEL_KNOT(p)
void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask, int width, int height, bool do_aspect_correct, bool do_mask_aa, bool do_feather)
void BKE_mask_coord_to_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2])
void BKE_mask_point_handle(const struct MaskSplinePoint *point, eMaskWhichHandle which_handle, float r_handle[2])
#define MASKPOINT_ISSEL_HANDLE(point, which_handle)
float(* BKE_mask_spline_feather_points(struct MaskSpline *spline, int *tot_feather_point))[2]
eMaskhandleMode BKE_mask_point_handles_mode_get(const struct MaskSplinePoint *point)
void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2])
float(* BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline, unsigned int resol, bool do_feather_isect, unsigned int *r_tot_feather_point))[2]
struct MaskLayer * BKE_mask_layer_active(struct Mask *mask)
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, unsigned int width, unsigned int height, float *buffer)
Rasterize a buffer from a single mask (threaded execution).
struct MaskSplinePoint * BKE_mask_spline_point_array(struct MaskSpline *spline)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE int max_ii(int a, int b)
MINLINE void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
MINLINE void copy_v2_v2(float r[2], const float a[2])
void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
#define INIT_MINMAX2(min, max)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
@ MASK_OVERLAY_ALPHACHANNEL
@ MCLIP_PROXY_RENDER_UNDISTORT
Object is a sort of wrapper for general info.
void ED_clip_point_undistorted_pos(const SpaceClip *sc, const float co[2], float r_co[2])
const rcti * ED_region_visible_rect(ARegion *region)
void ED_region_draw_cb_draw(const bContext *C, ARegion *region, int type)
#define REGION_DRAW_POST_VIEW
#define REGION_DRAW_PRE_VIEW
void GPU_matrix_scale_2f(float x, float y)
#define GPU_matrix_mul(x)
void GPU_matrix_translate_2f(float x, float y)
int GPU_shader_get_uniform(blender::gpu::Shader *shader, const char *name)
void GPU_shader_uniform_float_ex(blender::gpu::Shader *shader, int location, int length, int array_size, const float *value)
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
@ GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR
@ GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA
void GPU_program_point_size(bool enable)
void GPU_line_width(float width)
void GPU_line_smooth(bool enable)
void GPU_blend(GPUBlend blend)
void GPU_viewport_size_get_f(float coords[4])
Read Guarded memory(de)allocation.
void UI_GetThemeColor3fv(int colorid, float col[3])
@ TH_HANDLE_VERTEX_SELECT
float UI_GetThemeValuef(int colorid)
void UI_view2d_view_to_region(const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
BPy_StructRNA * depsgraph
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
void ED_mask_draw_frames(Mask *mask, ARegion *region, const int cfra, const int sfra, const int efra)
void ED_mask_draw_region(Depsgraph *depsgraph, Mask *mask_, ARegion *region, const bool show_overlays, const char draw_flag, const char draw_type, const eMaskOverlayMode overlay_mode, const float blend_factor, const int width_i, const int height_i, const float aspx, const float aspy, const bool do_scale_applied, const bool do_draw_cb, float stabmat[4][4], const bContext *C)
static void mask_color_active_tint(uchar r_rgb[4], const uchar rgb[4], const bool is_active)
static void draw_mask_layers(const bContext *C, Mask *mask, const char draw_type, const int width, const int height)
static void mask_draw_array(uint pos, GPUPrimType prim_type, const float(*points)[2], uint vertex_len)
static void mask_spline_feather_color_get(MaskLayer *, MaskSpline *, const bool is_sel, uchar r_rgb[4])
static void mask_point_undistort_pos(SpaceClip *sc, float r_co[2], const float co[2])
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 char draw_type)
static void draw_spline_points(const bContext *C, MaskLayer *mask_layer, MaskSpline *spline, const char draw_type)
static void draw_layer_splines(const bContext *C, MaskLayer *layer, const char draw_type, const int width, const int height, const bool is_active)
static float * mask_rasterize(Mask *mask, const int width, const int height)
static void draw_spline_curve(const bContext *C, MaskLayer *mask_layer, MaskSpline *spline, const char draw_type, const bool is_active, const int width, const int height)
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])
static void mask_spline_color_get(MaskLayer *mask_layer, MaskSpline *spline, const bool is_sel, uchar r_rgb[4])
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
struct MaskSplinePoint * act_point
struct MaskSpline * act_spline
MaskSplinePoint * points_deform
struct MovieClipUser user