48 r_rgb[0] = r_rgb[1] = r_rgb[2] = 255;
52 r_rgb[1] = r_rgb[2] = 0;
57 r_rgb[1] = r_rgb[2] = 0;
70 r_rgb[0] = r_rgb[2] = 0;
74 r_rgb[0] = r_rgb[2] = 0;
91 const float handle_size,
92 const float point_pos[2],
93 const float handle_pos[2])
99 handle_type = bezt->
h1;
102 handle_type = bezt->
h2;
111 const uchar rgb_gray[4] = {0x60, 0x60, 0x60, 0xff};
125 switch (handle_type) {
150 float point_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
174 const char draw_type)
176 const bool is_spline_sel = (spline->
flag &
SELECT) &&
182 bool undistort =
false;
184 int tot_feather_point;
185 float(*feather_points)[2], (*fp)[2];
209 for (
int i = 0; i < spline->
tot_point; i++) {
214 for (
int j = 0; j <=
point->tot_uw; j++) {
215 float feather_point[2];
258 for (
int i = 0; i < spline->
tot_point; i++) {
284 float handle_left[2], handle_right[2];
325 float x = (
min[0] +
max[0]) * 0.5f;
326 float y = (
min[1] +
max[1]) * 0.5f;
352 r_rgb[0] = (
uchar)((((
int)(
rgb[0])) + 128) / 2);
353 r_rgb[1] = (
uchar)((((
int)(
rgb[1])) + 128) / 2);
354 r_rgb[2] = (
uchar)((((
int)(
rgb[2])) + 128) / 2);
364 const float (*points)[2],
368 for (
uint i = 0; i < vertex_len; i++) {
376 float (*orig_points)[2],
378 const bool is_feather,
379 const bool is_active,
380 const uchar rgb_spline[4],
381 const char draw_type)
385 const uchar rgb_black[4] = {0x00, 0x00, 0x00, 0xff};
388 float(*points)[2] = orig_points;
394 points =
MEM_callocN(2 * tot_point *
sizeof(
float),
"undistorthed mask curve");
396 for (
int i = 0; i < tot_point; i++) {
434 rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 0;
437 rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 255;
448 rgb_tmp[0] = (
uchar)(((
short)rgb_tmp[0] + (
short)rgb_spline[0]) / 2);
449 rgb_tmp[1] = (
uchar)(((
short)rgb_tmp[1] + (short)rgb_spline[1]) / 2);
450 rgb_tmp[2] = (
uchar)(((
short)rgb_tmp[2] + (short)rgb_spline[2]) / 2);
470 float viewport_size[4];
491 if (points != orig_points) {
499 const char draw_type,
500 const bool is_active,
509 const bool is_spline_sel = (spline->
flag &
SELECT) &&
514 float(*diff_points)[2];
516 uint tot_feather_point;
517 float(*feather_points)[2];
528 spline, resol, (is_fill !=
false), &tot_feather_point);
533 C, spline, feather_points, tot_feather_point,
true, is_active, rgb_tmp, draw_type);
536 const float *fp = &diff_points[0][0];
537 float *fp_feather = &feather_points[0][0];
539 BLI_assert(tot_diff_point == tot_feather_point);
541 for (
int i = 0; i < tot_diff_point; i++, fp += 2, fp_feather += 2) {
549 C, spline, feather_points, tot_feather_point,
true, is_active, rgb_tmp, draw_type);
557 C, spline, diff_points, tot_diff_point,
false, is_active, rgb_tmp, draw_type);
565 const char draw_type,
568 const bool is_active)
601 for (mask_layer =
mask->masklayers.first, i = 0; mask_layer !=
NULL;
602 mask_layer = mask_layer->
next, i++) {
603 const bool is_active = (i ==
mask->masklay_act);
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,
685 if (do_scale_applied) {
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};
732 &
state, 0.0f, 0.0f,
width,
height,
GPU_R16F,
false,
buffer, 1.0f, 1.0f, blend_col);
736 &
state, 0.0f, 0.0f,
width,
height,
GPU_R16F,
false,
buffer, 1.0f, 1.0f,
NULL);
774 Mask *
mask,
ARegion *region,
const int cfra,
const int sfra,
const int efra)
776 const float framelen = region->
winx / (
float)(efra - sfra + 1);
779 if (mask_layer ==
NULL) {
784 if (num_lines == 0) {
790 const int region_bottom = rect_visible->
ymin;
801 mask_layer_shape !=
NULL;
802 mask_layer_shape = mask_layer_shape->next) {
803 int frame = mask_layer_shape->frame;
806 int height = (frame == cfra) ? 22 : 10;
807 int x = (frame - sfra) * framelen;
typedef float(TangentPoint)[2]
void immDrawPixelsTexTiled(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 SpaceClip * CTX_wm_space_clip(const bContext *C)
#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
struct MaskLayer * BKE_mask_layer_active(struct Mask *mask)
#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)
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)
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]
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, unsigned int width, unsigned int height, float *buffer)
Rasterize a buffer from a single mask (threaded execution).
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)
@ MASK_OVERLAY_ALPHACHANNEL
#define MASK_DRAWFLAG_SPLINE
#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])
const rcti * ED_region_visible_rect(ARegion *region)
#define REGION_DRAW_POST_VIEW
void ED_region_draw_cb_draw(const struct bContext *C, struct ARegion *region, int type)
#define REGION_DRAW_PRE_VIEW
_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
_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
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.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
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
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])
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)
void ED_mask_draw_region(Depsgraph *depsgraph, Mask *mask_, ARegion *region, 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_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_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 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 float4 mask(const int4 &mask, const float4 &a)
bool active
all scheduled work for the GPU.
static const pxr::TfToken rgb("rgb", pxr::TfToken::Immortal)
struct MaskSplinePoint * act_point
struct MaskSpline * act_spline
MaskSplinePoint * points_deform
struct MovieClipUser user