64 r_rgb[0] = r_rgb[1] = r_rgb[2] = 255;
68 r_rgb[1] = r_rgb[2] = 0;
73 r_rgb[1] = r_rgb[2] = 0;
86 r_rgb[0] = r_rgb[2] = 0;
90 r_rgb[0] = r_rgb[2] = 0;
107 const float handle_size,
108 const float point_pos[2],
109 const float handle_pos[2])
115 handle_type = bezt->
h1;
118 handle_type = bezt->
h2;
127 const uchar rgb_gray[4] = {0x60, 0x60, 0x60, 0xff};
141 switch (handle_type) {
166 float point_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
190 const char draw_flag,
191 const char draw_type)
193 const bool is_spline_sel = (spline->
flag &
SELECT) &&
200 bool undistort =
false;
202 int tot_feather_point;
203 float(*feather_points)[2], (*fp)[2];
227 for (
int i = 0; i < spline->
tot_point; i++) {
232 for (
int j = 0; j <= point->
tot_uw; j++) {
233 float feather_point[2];
278 for (
int i = 0; i < spline->
tot_point; i++) {
304 float handle_left[2], handle_right[2];
347 float x = (
min[0] +
max[0]) * 0.5f;
348 float y = (
min[1] +
max[1]) * 0.5f;
374 r_rgb[0] = (
uchar)((((
int)(rgb[0])) + 128) / 2);
375 r_rgb[1] = (
uchar)((((
int)(rgb[1])) + 128) / 2);
376 r_rgb[2] = (
uchar)((((
int)(rgb[2])) + 128) / 2);
380 *(
uint *)r_rgb = *(
const uint *)rgb;
386 const float (*points)[2],
390 for (
uint i = 0; i < vertex_len; i++) {
398 float (*orig_points)[2],
400 const bool is_feather,
401 const bool is_active,
402 const uchar rgb_spline[4],
403 const char draw_type)
407 const uchar rgb_black[4] = {0x00, 0x00, 0x00, 0xff};
410 float(*points)[2] = orig_points;
416 points =
MEM_callocN(2 * tot_point *
sizeof(
float),
"undistorthed mask curve");
418 for (
int i = 0; i < tot_point; i++) {
456 rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 0;
459 rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 255;
470 rgb_tmp[0] = (
uchar)(((
short)rgb_tmp[0] + (
short)rgb_spline[0]) / 2);
471 rgb_tmp[1] = (
uchar)(((
short)rgb_tmp[1] + (short)rgb_spline[1]) / 2);
472 rgb_tmp[2] = (
uchar)(((
short)rgb_tmp[2] + (short)rgb_spline[2]) / 2);
492 float viewport_size[4];
512 if (points != orig_points) {
520 const char draw_flag,
521 const char draw_type,
522 const bool is_active,
531 const bool is_spline_sel = (spline->
flag &
SELECT) &&
537 float(*diff_points)[2];
539 uint tot_feather_point;
540 float(*feather_points)[2];
553 spline, resol, (is_fill !=
false), &tot_feather_point);
558 C, spline, feather_points, tot_feather_point,
true, is_active, rgb_tmp, draw_type);
561 const float *fp = &diff_points[0][0];
562 float *fp_feather = &feather_points[0][0];
564 BLI_assert(tot_diff_point == tot_feather_point);
566 for (
int i = 0; i < tot_diff_point; i++, fp += 2, fp_feather += 2) {
574 C, spline, feather_points, tot_feather_point,
true, is_active, rgb_tmp, draw_type);
582 C, spline, diff_points, tot_diff_point,
false, is_active, rgb_tmp, draw_type);
592 const char draw_flag,
593 const char draw_type,
603 for (mask_layer =
mask->masklayers.first, i = 0; mask_layer !=
NULL;
604 mask_layer = mask_layer->
next, i++) {
605 const bool is_active = (i ==
mask->masklay_act);
675 const char draw_flag,
676 const char draw_type,
683 const bool do_scale_applied,
684 const bool do_draw_cb,
713 if (do_scale_applied) {
736 const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
753 immDrawPixelsTex(&
state, 0.0f, 0.0f,
width,
height,
GPU_R16F,
false,
buffer, 1.0f, 1.0f,
NULL);
789 Mask *
mask,
ARegion *region,
const int cfra,
const int sfra,
const int efra)
791 const float framelen = region->
winx / (
float)(efra - sfra + 1);
794 if (mask_layer ==
NULL) {
799 if (num_lines == 0) {
805 const int region_bottom = rect_visible->
ymin;
816 mask_layer_shape !=
NULL;
817 mask_layer_shape = mask_layer_shape->next) {
818 int frame = mask_layer_shape->frame;
821 int height = (frame == cfra) ? 22 : 10;
822 int x = (frame - sfra) * framelen;
typedef float(TangentPoint)[2]
void immDrawPixelsTex(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float xzoom, float yzoom, const float color[4])
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
struct ScrArea * CTX_wm_area(const bContext *C)
struct SpaceClip * CTX_wm_space_clip(const bContext *C)
struct Mask * CTX_data_edit_mask(const bContext *C)
#define MASKPOINT_ISSEL_ANY(p)
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
void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask, const int width, const int height, const bool do_aspect_correct, const bool do_mask_aa, const bool do_feather)
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, const unsigned int width, const unsigned int height, float *buffer)
Rasterize a buffer from a single mask (threaded execution).
struct MaskLayer * BKE_mask_layer_active(struct Mask *mask)
float(* BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, const unsigned int resol, unsigned int *r_tot_diff_point))[2]
#define MASKPOINT_ISSEL_KNOT(p)
float(* BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline, const unsigned int resol, const bool do_feather_isect, unsigned int *r_tot_feather_point))[2]
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)
struct MaskSplinePoint * BKE_mask_spline_point_array(struct MaskSpline *spline)
void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2])
MaskRasterHandle * BKE_maskrasterize_handle_new(void)
unsigned int BKE_mask_spline_resolution(struct MaskSpline *spline, int width, int height)
#define LISTBASE_FOREACH(type, var, list)
int BLI_listbase_count(const struct 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)
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)
struct Depsgraph Depsgraph
struct ID * DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id)
#define MASK_RESTRICT_SELECT
#define MASK_RESTRICT_VIEW
@ MASK_OVERLAY_ALPHACHANNEL
#define MASK_DRAWFLAG_SMOOTH
#define MASK_DRAWFLAG_OVERLAY
@ MCLIP_PROXY_RENDER_UNDISTORT
Object is a sort of wrapper for general info.
void ED_clip_point_undistorted_pos(struct SpaceClip *sc, const float co[2], float r_co[2])
void ED_mask_get_size(struct ScrArea *area, int *width, int *height)
const rcti * ED_region_visible_rect(ARegion *region)
#define REGION_DRAW_POST_VIEW
void ED_region_draw_cb_draw(const struct bContext *, struct ARegion *, int)
#define REGION_DRAW_PRE_VIEW
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
void GPU_matrix_pop(void)
void GPU_matrix_scale_2f(float x, float y)
#define GPU_matrix_mul(x)
void GPU_matrix_push(void)
void GPU_matrix_translate_2f(float x, float y)
int GPU_shader_get_uniform(GPUShader *shader, const char *name)
void GPU_shader_uniform_vector(GPUShader *shader, int location, int length, int arraysize, const float *value)
@ GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR
@ GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA
@ GPU_SHADER_2D_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_blend(eGPUBlend blend)
void GPU_line_width(float width)
void GPU_line_smooth(bool enable)
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 struct View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
const Depsgraph * depsgraph
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
void ED_mask_draw_frames(Mask *mask, ARegion *region, const int cfra, const int sfra, const int efra)
static void mask_spline_feather_color_get(MaskLayer *UNUSED(mask_layer), MaskSpline *UNUSED(spline), const bool is_sel, uchar r_rgb[4])
void ED_mask_draw(const bContext *C, const char draw_flag, const char draw_type)
static void mask_color_active_tint(uchar r_rgb[4], const uchar rgb[4], const bool is_active)
void ED_mask_draw_region(Depsgraph *depsgraph, Mask *mask_, ARegion *region, const char draw_flag, const char draw_type, const eMaskOverlayMode overlay_mode, 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_draw_array(uint pos, GPUPrimType prim_type, const float(*points)[2], uint vertex_len)
static void mask_point_undistort_pos(SpaceClip *sc, float r_co[2], const float co[2])
static float * mask_rasterize(Mask *mask, const int width, const int height)
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_mask_layers(const bContext *C, Mask *mask, const char draw_flag, const char draw_type, const int width, const int height)
static void draw_spline_curve(const bContext *C, MaskLayer *mask_layer, MaskSpline *spline, const char draw_flag, 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])
static void draw_spline_points(const bContext *C, MaskLayer *mask_layer, MaskSpline *spline, const char draw_flag, const char draw_type)
static void area(int d1, int d2, int e1, int e2, float weights[2])
struct MaskSplinePoint * act_point
struct MaskSpline * act_spline
MaskSplinePoint * points_deform
struct MovieClipUser user
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)