71 const float *corner_point,
72 const float *arrow_coords,
73 const int arrow_style)
77 switch (arrow_style) {
123 if ((points ==
nullptr) || (totpoints <= 0)) {
142 if (totpoints == 1) {
151 float oldpressure = points[0].pressure;
166 for (
int i = 0; i < totpoints; i++, pt++) {
231 const float pt[3],
short sflag,
int offsx,
int offsy,
int winx,
int winy,
float r_co[2])
238 const float x =
float((pt[0] * winx) + offsx);
239 const float y =
float((pt[1] * winy) + offsy);
245 const float x =
float(pt[0] / 100 * winx) + offsx;
246 const float y =
float(pt[1] / 100 * winy) + offsy;
281 float co[3] = {0.0f};
303 const bGPDspoint *points,
int totpoints,
short thickness,
const float ink[4],
bool cyclic)
305 float curpressure = points[0].pressure;
331 for (
int i = 0; i < totpoints; i++, pt++) {
337 if (
fabsf(pt->
pressure - curpressure) > 0.2f /
float(thickness)) {
363 if (cyclic && i == 0) {
396 if (totpoints == 0) {
399 float thickness =
float(thickness_s);
408 float oldpressure = points[0].
pressure;
409 if (totpoints == 1) {
432 for (
int i = 0; i < totpoints; i++) {
441 pt_prev = &points[i - 1];
455 pt_prev = &points[i - 1];
471 pt_prev = &points[0];
528 const float color[4])
551 if (gps->totpoints == 1) {
553 gps->points, lthick, gps->flag, offsx, offsy, winx, winy, color);
568 if (gps->totpoints == 1) {
570 gps->points, lthick, gps->flag, offsx, offsy, winx, winy, color);
574 gps->points, gps->totpoints, lthick, gps->flag, offsx, offsy, winx, winy, color);
587 const float alpha = 1.0f;
598 if (gpl->
gstep > 0) {
603 for (gf = gpf->
prev; gf; gf = gf->
prev) {
608 color[3] = alpha * fac * 0.66f;
616 else if (gpl->
gstep == 0) {
619 color[3] = (alpha / 7);
640 for (gf = gpf->
next; gf; gf = gf->
next) {
645 color[3] = alpha * fac * 0.66f;
656 color[3] = (alpha / 4);
667 bGPdata *gpd,
int offsx,
int offsy,
int winx,
int winy,
int cfra,
int dflag)
674 short lthick = gpl->thickness;
678 ink[3] = gpl->opacity;
687 if (gpf ==
nullptr) {
725 bGPdata *gpd,
int offsx,
int offsy,
int winx,
int winy,
int cfra,
int dflag)
763 gpd_source = (scene->gpd ? scene->gpd :
nullptr);
765 else if (space_type ==
SPACE_CLIP && scene->clip) {
768 gpd_source = (scene->clip->gpd ? scene->clip->gpd :
nullptr);
778 if (gpd_source ==
nullptr || (gpd_source && gpd_source != gpd)) {
792 int offsx, offsy, sizex, sizey;
796 if (gpd ==
nullptr) {
801 switch (area->spacetype) {
810 sizex = region->winx;
811 sizey = region->winy;
814 region->v2d.cur.xmin, region->v2d.cur.xmax, region->v2d.cur.ymin, region->v2d.cur.ymax);
824 sizex = region->winx;
825 sizey = region->winy;
836 sizex = region->winx;
837 sizey = region->winy;
851 scene, gpd, offsx, offsy, sizex, sizey, scene->r.cfra, dflag,
eSpace_Type(area->spacetype));
863 if (area ==
nullptr) {
867 if (gpd ==
nullptr) {
902 int offsx, offsy, winx, winy;
908 if (gpd ==
nullptr) {
950 Scene *scene,
bGPdata *gpd,
int winx,
int winy,
const int cfra,
const char spacetype)
ScrArea * CTX_wm_area(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
struct bGPDframe * BKE_gpencil_layer_frame_get(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
#define LISTBASE_FOREACH(type, var, list)
MINLINE int round_fl_to_int(float a)
MINLINE float max_ff(float a, float b)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
#define SET_FLAG_FROM_TEST(value, test, flag)
@ GP_STROKE_ARROWSTYLE_NONE
@ GP_STROKE_ARROWSTYLE_SEGMENT
@ GP_STROKE_ARROWSTYLE_CLOSED
@ GP_STROKE_ARROWSTYLE_OPEN
@ GP_STROKE_ARROWSTYLE_SQUARE
@ GP_STROKE_USE_ARROW_END
@ GP_STROKE_USE_ARROW_START
@ GP_LAYER_ONIONSKIN_CUSTOM_COLOR
bScreen * ED_screen_animation_playing(const wmWindowManager *wm)
void ED_view3d_calc_camera_border(const Scene *scene, const Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const RegionView3D *rv3d, bool no_shift, rctf *r_viewborder)
void GPU_polygon_offset(float viewdist, float dist)
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
@ GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA
void GPU_program_point_size(bool enable)
void GPU_blend(eGPUBlend blend)
void GPU_line_smooth(bool enable)
void GPU_depth_mask(bool depth)
void GPU_point_size(float size)
void GPU_depth_test(eGPUDepthTest test)
void GPU_viewport_size_get_f(float coords[4])
bool GPU_depth_mask_get()
Read Guarded memory(de)allocation.
void UI_GetThemeColor3fv(int colorid, float col[3])
static void annotation_draw_strokes(const bGPDframe *gpf, int offsx, int offsy, int winx, int winy, int dflag, short lthick, const float color[4])
void ED_annotation_draw_ex(Scene *scene, bGPdata *gpd, int winx, int winy, const int cfra, const char spacetype)
static void annotation_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thickness, const float ink[4], bool cyclic)
static void annotation_draw_data_layers(bGPdata *gpd, int offsx, int offsy, int winx, int winy, int cfra, int dflag)
static void annotation_draw_stroke_2d(const bGPDspoint *points, int totpoints, short thickness_s, short sflag, int offsx, int offsy, int winx, int winy, const float ink[4])
void ED_annotation_draw_2dimage(const bContext *C)
static void annotation_draw_stroke_buffer(bGPdata *gps, short thickness, short dflag, const float ink[4])
void ED_annotation_draw_view3d(Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *region, bool only3d)
static void annotation_draw_stroke_arrow_buffer(uint pos, const float *corner_point, const float *arrow_coords, const int arrow_style)
static void annotation_draw_onionskins(bGPDlayer *gpl, bGPDframe *gpf, int offsx, int offsy, int winx, int winy, int dflag)
void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d)
static void annotation_calc_2d_stroke_fxy(const float pt[3], short sflag, int offsx, int offsy, int winx, int winy, float r_co[2])
static void annotation_draw_data_all(Scene *scene, bGPdata *gpd, int offsx, int offsy, int winx, int winy, int cfra, int dflag, const eSpace_Type space_type)
static void annotation_draw_stroke_point(const bGPDspoint *points, short thickness, short sflag, int offsx, int offsy, int winx, int winy, const float ink[4])
static void annotation_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy, int cfra, int dflag)
static bool annotation_can_draw_stroke(const bGPDstroke *gps, const int dflag)
const Depsgraph * depsgraph
draw_view in_light_buf[] float
int ED_gpencil_session_active()
bGPdata * ED_annotation_data_get_active(const bContext *C)
static void draw_points(const Armatures::DrawContext *ctx, const UnifiedBonePtr bone, const eBone_Flag boneflag, const float col_solid[4], const int select_id)
void wmOrtho2(float x1, float x2, float y1, float y2)