148 BrushPainter *painter = MEM_new<BrushPainter>(__func__);
150 painter->
brush = brush;
151 painter->
scene = scene;
152 painter->
paint = paint;
177 cache->
ibuf =
nullptr;
211 texco[0] = mapping->
xmin +
x * mapping->
xmax;
212 texco[1] = mapping->
ymin +
y * mapping->
ymax;
232 for (
x = 0;
x <
size;
x++, m++) {
236 *m =
ushort(65535.0f * res);
246 const ushort *tex_mask_old,
262 bool use_texture_old = (tex_mask_old !=
nullptr);
270 for (
y = origy;
y < h;
y++) {
271 for (
x = origx;
x <
w;
x++) {
276 ushort *
b = tex_mask + (
y * diameter +
x);
277 ushort *t = tex_mask_cur + (
y * diameter +
x);
279 if (!use_texture_old) {
285 if (use_texture_old) {
286 res = *(tex_mask_old + ((
y - origy + yt) * cache->
tex_mask_old_w + (
x - origx + xt)));
309 int destx, desty, srcx, srcy,
w, h, x1, y1, x2, y2;
323 maskibuf.
x = diameter;
324 maskibuf.
y = diameter;
332 desty = int(
floorf(
tile->last_paintpos[1])) - int(
floorf(
pos[1])) + (diameter / 2 - h / 2);
335 IMB_rectclip(&maskibuf, &maskibuf_old, &destx, &desty, &srcx, &srcy, &
w, &h);
343 x1 =
min_ii(destx, diameter);
344 y1 =
min_ii(desty, diameter);
345 x2 =
min_ii(destx +
w, diameter);
346 y2 =
min_ii(desty + h, diameter);
349 if ((x1 < x2) && (y1 < y2)) {
351 painter,
tile, tex_mask_old, x1, y1, x2, y2, srcx, srcy, diameter);
359 if ((0 < x1) && (0 < diameter)) {
362 if ((x2 < diameter) && (0 < diameter)) {
364 painter,
tile,
nullptr, x2, 0, diameter, diameter, 0, 0, diameter);
366 if ((x1 < x2) && (0 < y1)) {
369 if ((x1 < x2) && (y2 < diameter)) {
409 use_color_correction,
426 float texco[3], rgba[4];
488 bool use_texture_old = (oldtexibuf !=
nullptr);
502 use_color_correction,
516 for (
y = origy;
y < h;
y++) {
517 for (
x = origx;
x <
w;
x++) {
519 float texco[3], rgba[4];
521 if (!use_texture_old) {
543 if (use_texture_old) {
545 ((
y - origy + yt) * oldtexibuf->
x + (
x - origx + xt)) * 4;
564 if (use_texture_old) {
566 ((
y - origy + yt) * oldtexibuf->
x + (
x - origx + xt)) * 4;
601 ImBuf *oldtexibuf, *ibuf;
602 int imbflag, destx, desty, srcx, srcy,
w, h, x1, y1, x2, y2;
620 desty = int(
floorf(
tile->last_paintpos[1])) - int(
floorf(
pos[1])) + (diameter / 2 - h / 2);
633 y2 =
min_ii(desty + h, ibuf->
y);
636 if ((x1 < x2) && (y1 < y2)) {
645 if ((0 < x1) && (0 < ibuf->
y)) {
648 if ((x2 < ibuf->
x) && (0 < ibuf->
y)) {
651 if ((x1 < x2) && (0 < y1)) {
654 if ((x1 < x2) && (y2 < ibuf->
y)) {
663 const float mouse[2],
667 float invw = 1.0f / float(
tile->canvas->x);
668 float invh = 1.0f / float(
tile->canvas->y);
672 start[0] =
pos[0] - diameter / 2.0f;
673 start[1] =
pos[1] - diameter / 2.0f;
677 float xmin, ymin, xmax, ymax;
680 s->
v2d, (start[0] + diameter) * invw, (start[1] + diameter) * invh, &xmax, &ymax);
683 r_mapping->
xmax = (xmax - xmin) /
float(diameter);
684 r_mapping->
ymax = (ymax - ymin) /
float(diameter);
685 r_mapping->
xmin = xmin + (
tile->uv_origin[0] *
tile->size[0] * r_mapping->
xmax);
686 r_mapping->
ymin = ymin + (
tile->uv_origin[1] *
tile->size[1] * r_mapping->
ymax);
690 r_mapping->
xmin = 2.0f * (start[0] * invw - 0.5f);
691 r_mapping->
ymin = 2.0f * (start[1] * invh - 0.5f);
692 r_mapping->
xmax = 2.0f * invw;
693 r_mapping->
ymax = 2.0f * invh;
697 r_mapping->
xmin = mouse[0] - diameter * 0.5f + 0.5f;
698 r_mapping->
ymin = mouse[1] - diameter * 0.5f + 0.5f;
699 r_mapping->
xmax = 1.0f;
700 r_mapping->
ymax = 1.0f;
703 r_mapping->
xmin = int(-diameter * 0.5) + int(
floorf(
pos[0])) -
705 r_mapping->
ymin = int(-diameter * 0.5) + int(
floorf(
pos[1])) -
707 r_mapping->
xmax = 1.0f;
708 r_mapping->
ymax = 1.0f;
716 const float mouse[2],
726 const int diameter = std::max(1,
int(
size * 2)) + 4;
728 bool do_random =
false;
729 bool do_partial_update =
false;
736 float tex_rotation = -brush->
mtex.
rot;
750 do_partial_update =
true;
758 bool renew_maxmask =
false;
759 bool do_partial_update_mask =
false;
765 renew_maxmask =
true;
768 do_partial_update_mask =
true;
769 renew_maxmask =
true;
773 do_partial_update_mask =
false;
774 renew_maxmask =
true;
785 if (do_partial_update_mask) {
804 cache->
ibuf =
nullptr;
807 if (do_partial_update) {
820 else if (do_partial_update) {
825 if ((dx != 0) || (dy != 0)) {
831 painter->
pool =
nullptr;
853 if (ibuf !=
nullptr) {
896 ImBuf *ibuf,
int x,
int y,
const bool is_torus,
const float rgb[4])
911 float map_alpha = (rgb[3] == 0.0f) ? rrgbf[3] : rrgbf[3] / rgb[3];
921 rrgb[0] = straight[0];
922 rrgb[1] = straight[1];
923 rrgb[2] = straight[2];
924 rrgb[3] = straight[3];
945 ImBuf *ibuf,
int x,
int y,
float *outrgb,
short paint_tile,
float w)
972 const short paint_tile)
976 int x,
y, xi, yi, xo, yo, xk, yk;
978 int out_off[2], in_off[2], dim[2];
988 out_off[0] = out_off[1] = 0;
991 IMB_rectclip(ibuf, ibufb, &in_off[0], &in_off[1], &out_off[0], &out_off[1], &dim[0], &dim[1]);
993 if ((dim[0] == 0) || (dim[1] == 0)) {
1001 for (
y = 0;
y < dim[1];
y++) {
1002 for (
x = 0;
x < dim[0];
x++) {
1010 if (xi < ibuf->
x && xi >= 0 && yi < ibuf->
y && yi >= 0) {
1023 for (yk = 0; yk < kernel->
side; yk++) {
1024 for (xk = 0; xk < kernel->
side; xk++) {
1044 if (
fabsf(outrgb[0]) > threshold) {
1046 float alpha = rgba[3];
1047 rgba[3] = outrgb[3] =
mask;
1062 xo = out_off[0] +
x;
1063 yo = out_off[1] +
y;
1070 ImagePaintRegion *region,
int destx,
int desty,
int srcx,
int srcy,
int width,
int height)
1072 region->
destx = destx;
1073 region->
desty = desty;
1074 region->
srcx = srcx;
1075 region->
srcy = srcy;
1076 region->
width = width;
1085 int destx = region->
destx;
1086 int desty = region->
desty;
1087 int srcx = region->
srcx;
1088 int srcy = region->
srcy;
1089 int width = region->
width;
1090 int height = region->
height;
1091 int origw, origh,
w, h, tot = 0;
1095 destx = destx % dbuf->
x;
1099 srcx = srcx % sbuf->
x;
1105 desty = desty % dbuf->
y;
1109 srcy = srcy % sbuf->
y;
1116 origw =
w = (width > dbuf->
x) ? dbuf->
x : width;
1117 origh = h = (height > dbuf->
y) ? dbuf->
y : height;
1120 IMB_rectclip(dbuf, sbuf, &destx, &desty, &srcx, &srcy, &
w, &h);
1126 ®ion[tot++], (destx +
w) % dbuf->
x, desty, (srcx +
w) % sbuf->
x, srcy, origw -
w, h);
1130 ®ion[tot++], destx, (desty + h) % dbuf->
y, srcx, (srcy + h) % sbuf->
y,
w, origh - h);
1134 (destx +
w) % dbuf->
x,
1135 (desty + h) % dbuf->
y,
1136 (srcx +
w) % sbuf->
x,
1137 (srcy + h) % sbuf->
y,
1153 for (a = 0; a < tot; a++) {
1178 int w = ibufb->
x, h = ibufb->
y, destx = 0, desty = 0, srcx =
pos[0], srcy =
pos[1];
1181 IMB_rectclip(clonebuf, ibuf, &destx, &desty, &srcx, &srcy, &
w, &h);
1222 ipos[0] = int(
floorf(
pos[0] - ibufb->
x / 2));
1223 ipos[1] = int(
floorf(
pos[1] - ibufb->
y / 2));
1242 for (
int ty = tiley; ty <= tileh; ty++) {
1243 for (
int tx = tilex; tx <= tilew; tx++) {
1249 if (
tile->canvas->float_buffer.data) {
1268 tile->cache.curve_mask_cache.curve_mask,
1269 tile->cache.tex_mask,
1315 const float lastpos[2],
1320 ImBuf *clonebuf =
nullptr, *frombuf;
1326 const float *offset = image_paint_settings.
clone_offset;
1329 int bpos[2], blastpos[2], bliftpos[2];
1340 if (lastpos[0] ==
pos[0] && lastpos[1] ==
pos[1]) {
1349 liftpos[0] =
pos[0] - offset[0] * canvas->
x;
1350 liftpos[1] =
pos[1] - offset[1] * canvas->
y;
1356 frombuf = (clonebuf) ? clonebuf : ibufb;
1368 for (a = 0; a < tot; a++) {
1380 int tilex, tiley, tilew, tileh;
1392 if (tiley == tileh) {
1394 s,
tile, ®ion[a], frombuf, mask_max,
blend, tilex, tiley, tilew, tileh);
1400 data.region = ®ion[a];
1401 data.frombuf = frombuf;
1402 data.mask_max = mask_max;
1418 tile->cache.curve_mask_cache.curve_mask,
1419 tile->cache.tex_mask,
1492 return (
pos[0] >= -brush[0]) && (
pos[0] <
size[0] + brush[0]) && (
pos[1] >= -brush[1]) &&
1493 (
pos[1] <
size[1] + brush[1]);
1498 coord[0] = (uv[0] -
tile->uv_origin[0]) *
tile->size[0];
1499 coord[1] = (uv[1] -
tile->uv_origin[1]) *
tile->size[1];
1503 const float prev_mval[2],
1504 const float mval[2],
1510 float new_uv[2], old_uv[2];
1524 float last_uv[2], start_uv[2];
1534 const float uv_brush_size[2] = {
1542 const int uv_size[2] = {1, 1};
1543 float local_new_uv[2], local_old_uv[2];
1557 float size = base_size *
tile->radius_fac;
1559 float new_coord[2], old_coord[2];
1590 tile->need_redraw =
true;
1618 if (s->
image ==
nullptr) {
1637 if (ibuf ==
nullptr) {
1692 bool had_redraw =
false;
1758 const float color[4],
1763 if (x_px >= ibuf->
x || x_px < 0 || y_px >= ibuf->
y || y_px < 0) {
1767 coordinate = size_t(y_px) * ibuf->
x + x_px;
1787 const float color[4],
1792 if (x_px >= ibuf->
x || x_px < 0 || y_px >= ibuf->
y || y_px < 0) {
1796 coordinate = size_t(y_px) * ibuf->
x + x_px;
1823 const float color[3],
1825 const float mouse_init[2],
1826 const float mouse_final[2],
1856 if (iuser ==
nullptr) {
1861 iuser = &local_iuser;
1863 iuser->
tile = tile_number;
1876 *(((
char *)&color_b) + 3) = strength * 255;
1880 color_f[3] = strength;
1883 if (!mouse_final || !br) {
1888 for (x_px = 0; x_px < ibuf->
x; x_px++) {
1889 for (y_px = 0; y_px < ibuf->
y; y_px++) {
1897 for (x_px = 0; x_px < ibuf->
x; x_px++) {
1898 for (y_px = 0; y_px < ibuf->
y; y_px++) {
1912 int width = ibuf->
x;
1913 float pixel_color[4];
1921 if (x_px >= ibuf->
x || x_px < 0 || y_px > ibuf->
y || y_px < 0) {
1932 coordinate = (size_t(y_px) * ibuf->
x + x_px);
1956 x_px = coordinate % width;
1957 y_px = coordinate / width;
1960 x_px - 1, y_px - 1, ibuf, stack, touched, pixel_color, threshold_sq);
1962 x_px - 1, y_px, ibuf, stack, touched, pixel_color, threshold_sq);
1964 x_px - 1, y_px + 1, ibuf, stack, touched, pixel_color, threshold_sq);
1966 x_px, y_px + 1, ibuf, stack, touched, pixel_color, threshold_sq);
1968 x_px, y_px - 1, ibuf, stack, touched, pixel_color, threshold_sq);
1970 x_px + 1, y_px - 1, ibuf, stack, touched, pixel_color, threshold_sq);
1972 x_px + 1, y_px, ibuf, stack, touched, pixel_color, threshold_sq);
1974 x_px + 1, y_px + 1, ibuf, stack, touched, pixel_color, threshold_sq);
1987 x_px = coordinate % width;
1988 y_px = coordinate / width;
1991 x_px - 1, y_px - 1, ibuf, stack, touched, pixel_color, threshold_sq);
1993 x_px - 1, y_px, ibuf, stack, touched, pixel_color, threshold_sq);
1995 x_px - 1, y_px + 1, ibuf, stack, touched, pixel_color, threshold_sq);
1997 x_px, y_px + 1, ibuf, stack, touched, pixel_color, threshold_sq);
1999 x_px, y_px - 1, ibuf, stack, touched, pixel_color, threshold_sq);
2001 x_px + 1, y_px - 1, ibuf, stack, touched, pixel_color, threshold_sq);
2003 x_px + 1, y_px, ibuf, stack, touched, pixel_color, threshold_sq);
2005 x_px + 1, y_px + 1, ibuf, stack, touched, pixel_color, threshold_sq);
2022 const bContext *
C,
Brush *br,
const float mouse_init[2],
const float mouse_final[2],
void *ps)
2034 float line_len_sq_inv, line_len;
2039 if (ima ==
nullptr) {
2051 if (ibuf ==
nullptr) {
2060 image_final[0] *= ibuf->
x;
2061 image_final[1] *= ibuf->
y;
2069 line_len_sq_inv = 1.0f / line_len;
2070 line_len =
sqrtf(line_len);
2078 for (x_px = 0; x_px < ibuf->
x; x_px++) {
2079 for (y_px = 0; y_px < ibuf->
y; y_px++) {
2085 f =
dot_v2v2(p, tangent) * line_len_sq_inv;
2090 f =
len_v2(p) / line_len;
2097 color_f[3] *= brush_alpha;
2106 for (x_px = 0; x_px < ibuf->
x; x_px++) {
2107 for (y_px = 0; y_px < ibuf->
y; y_px++) {
2113 f =
dot_v2v2(p, tangent) * line_len_sq_inv;
2118 f =
len_v2(p) / line_len;
2126 ((
uchar *)&color_b)[3] *= brush_alpha;
float BKE_brush_sample_tex_3d(const Scene *scene, const Brush *br, const MTex *mtex, const float point[3], float rgba[4], int thread, ImagePool *pool)
const std::optional< BrushColorJitterSettings > BKE_brush_color_jitter_get_settings(const Scene *scene, const Paint *paint, const Brush *brush)
float BKE_brush_alpha_get(const Scene *scene, const Brush *brush)
float BKE_brush_sample_masktex(const Scene *scene, Brush *br, const float point[2], int thread, ImagePool *pool)
bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
SpaceImage * CTX_wm_space_image(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
int BKE_image_get_tile_from_pos(Image *ima, const float uv[2], float r_uv[2], float r_ofs[2])
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
void BKE_image_pool_free(ImagePool *pool)
ImagePool * BKE_image_pool_new()
void BKE_imageuser_default(ImageUser *iuser)
void BKE_image_free_gputextures(Image *ima)
bool BKE_image_has_packedfile(const Image *image)
blender::float3 seed_hsv_jitter()
Paint * BKE_paint_get_active_from_context(const bContext *C)
Brush * BKE_paint_brush(Paint *paint)
void BKE_report(ReportList *reports, eReportType type, const char *message)
blender::ocio::Display ColorManagedDisplay
#define BLI_BITMAP_NEW(_num, _alloc_string)
#define BLI_BITMAP_TEST(_bitmap, _index)
#define BLI_BITMAP_SET(_bitmap, _index, _set)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int min_ii(int a, int b)
MINLINE void straight_uchar_to_premul_float(float result[4], const unsigned char color[4])
MINLINE void straight_to_premul_v4(float color[4])
void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
MINLINE void premul_float_to_straight_uchar(unsigned char *result, const float color[4])
MINLINE void blend_color_add_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_mix_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_mix_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void mul_v4_fl(float r[4], float f)
MINLINE void sub_v2_v2v2_int(int r[2], const int a[2], const int b[2])
MINLINE void add_v4_v4(float r[4], const float a[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v4(float r[4])
MINLINE float len_squared_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void zero_v2(float r[2])
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
void BLI_stack_pop(BLI_Stack *stack, void *dst) ATTR_NONNULL()
void BLI_stack_push(BLI_Stack *stack, const void *src) ATTR_NONNULL()
bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_stack_free(BLI_Stack *stack) ATTR_NONNULL()
#define BLI_stack_new(esize, descr)
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
void DEG_id_tag_update(ID *id, unsigned int flags)
@ IMAGE_PAINT_BRUSH_TYPE_DRAW
@ IMAGE_PAINT_BRUSH_TYPE_CLONE
@ IMAGE_PAINT_BRUSH_TYPE_SOFTEN
@ IMAGE_PAINT_BRUSH_TYPE_SMEAR
@ BRUSH_GRADIENT_SPACING_CLAMP
@ BRUSH_GRADIENT_SPACING_REPEAT
Object is a sort of wrapper for general info.
#define IMAGEPAINT_MODE_IMAGE
void * ED_image_paint_tile_find(PaintTileMap *paint_tile_map, Image *image, ImBuf *ibuf, ImageUser *iuser, int x_tile, int y_tile, unsigned short **r_mask, bool validate)
void ED_imapaint_dirty_region(Image *ima, ImBuf *ibuf, ImageUser *iuser, int x, int y, int w, int h, bool find_old)
#define ED_IMAGE_UNDO_TILE_SIZE
PaintTileMap * ED_image_paint_tile_map_get()
void ED_imapaint_clear_partial_redraw()
void ED_region_tag_redraw(ARegion *region)
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
const ColorManagedDisplay * IMB_colormanagement_display_get_named(const char *name)
void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3], const ColorManagedDisplay *display)
void IMB_rectblend_threaded(ImBuf *dbuf, const ImBuf *obuf, const ImBuf *sbuf, unsigned short *dmask, const unsigned short *curvemask, const unsigned short *texmask, float mask_max, int destx, int desty, int origx, int origy, int srcx, int srcy, int width, int height, IMB_BlendMode mode, bool accumulate)
void IMB_assign_float_buffer(ImBuf *ibuf, float *buffer_data, ImBufOwnership ownership)
void IMB_byte_from_float(ImBuf *ibuf)
void IMB_blend_color_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4], IMB_BlendMode mode)
void IMB_rectclip(ImBuf *dbuf, const ImBuf *sbuf, int *destx, int *desty, int *srcx, int *srcy, int *width, int *height)
void IMB_freeImBuf(ImBuf *ibuf)
ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
void IMB_rectblend(ImBuf *dbuf, const ImBuf *obuf, const ImBuf *sbuf, unsigned short *dmask, const unsigned short *curvemask, const unsigned short *texmask, float mask_max, int destx, int desty, int origx, int origy, int srcx, int srcy, int width, int height, IMB_BlendMode mode, bool accumulate)
void IMB_blend_color_float(float dst[4], const float src1[4], const float src2[4], IMB_BlendMode mode)
bool IMB_initImBuf(ImBuf *ibuf, unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
void IMB_assign_byte_buffer(ImBuf *ibuf, uint8_t *buffer_data, ImBufOwnership ownership)
void IMB_float_from_byte(ImBuf *ibuf)
@ IB_DO_NOT_TAKE_OWNERSHIP
@ IMB_COLORMANAGE_IS_DATA
Read Guarded memory(de)allocation.
void UI_view2d_view_to_region_fl(const View2D *v2d, float x, float y, float *r_region_x, float *r_region_y) ATTR_NONNULL()
void UI_view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
float distance(VecOp< float, D >, VecOp< float, D >) RET
CCL_NAMESPACE_BEGIN ccl_device float invert(const float color, const float factor)
const ccl_global KernelWorkTile * tile
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void paint_delete_blur_kernel(BlurKernel *kernel)
void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, ImageUser *iuser, short texpaint)
void paint_brush_init_tex(Brush *brush)
bool paint_use_opacity_masking(const Scene *scene, const Paint *paint, const Brush *brush)
BlurKernel * paint_new_blur_kernel(Brush *br, bool proj)
void paint_brush_color_get(Scene *scene, const Paint *paint, Brush *br, std::optional< blender::float3 > &initial_hsv_jitter, bool color_correction, bool invert, float distance, float pressure, const ColorManagedDisplay *display, float r_color[3])
void paint_brush_exit_tex(Brush *brush)
void imapaint_region_tiles(ImBuf *ibuf, int x, int y, int w, int h, int *tx, int *ty, int *tw, int *th)
static ushort * brush_painter_mask_ibuf_new(BrushPainter *painter, const int size)
static int paint_2d_torus_split_region(ImagePaintRegion region[4], ImBuf *dbuf, ImBuf *sbuf, short paint_tile)
static void brush_painter_mask_imbuf_update(BrushPainter *painter, ImagePaintTile *tile, const ushort *tex_mask_old, int origx, int origy, int w, int h, int xt, int yt, const int diameter)
static void paint_2d_fill_add_pixel_float(const int x_px, const int y_px, ImBuf *ibuf, BLI_Stack *stack, BLI_bitmap *touched, const float color[4], float threshold_sq)
static float paint_2d_ibuf_add_if(ImBuf *ibuf, int x, int y, float *outrgb, short paint_tile, float w)
static void paint_2d_convert_brushco(ImBuf *ibufb, const float pos[2], int ipos[2])
@ PAINT2D_TILE_UNINITIALIZED
static void paint_2d_canvas_free(ImagePaintState *s)
static ImBuf * paint_2d_lift_clone(ImBuf *ibuf, ImBuf *ibufb, const int *pos)
static void brush_painter_cache_2d_free(BrushPainterCache *cache)
static int paint_2d_op(void *state, ImagePaintTile *tile, const float lastpos[2], const float pos[2])
static void paint_2d_lift_soften(ImagePaintState *s, ImagePaintTile *tile, ImBuf *ibuf, ImBuf *ibufb, const int *pos, const short paint_tile)
static void paint_2d_do_making_brush(ImagePaintState *s, ImagePaintTile *tile, ImagePaintRegion *region, ImBuf *frombuf, float mask_max, short blend, int tilex, int tiley, int tilew, int tileh)
void * paint_2d_new_stroke(bContext *C, wmOperator *op, int mode)
void paint_2d_bucket_fill(const bContext *C, const float color[3], Brush *br, const float mouse_init[2], const float mouse_final[2], void *ps)
void paint_2d_gradient_fill(const bContext *C, Brush *br, const float mouse_init[2], const float mouse_final[2], void *ps)
static int paint_2d_canvas_set(ImagePaintState *s, const Paint *paint)
static void brush_painter_imbuf_partial_update(BrushPainter *painter, ImagePaintTile *tile, const float pos[2], const int diameter)
void paint_2d_stroke_done(void *ps)
static void paint_2d_op_foreach_do(void *__restrict data_v, const int iter, const TaskParallelTLS *__restrict)
static void paint_2d_ibuf_rgb_set(ImBuf *ibuf, int x, int y, const bool is_torus, const float rgb[4])
static bool paint_2d_ensure_tile_canvas(ImagePaintState *s, int i)
static void paint_2d_transform_mouse(View2D *v2d, const float in[2], float out[2])
static void paint_2d_lift_smear(ImBuf *ibuf, ImBuf *ibufb, int *pos, short paint_tile)
static ImBuf * brush_painter_imbuf_new(BrushPainter *painter, ImagePaintTile *tile, const int size, float pressure, float distance)
void paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], const bool eraser, float pressure, float distance, float base_size)
static void paint_2d_uv_to_coord(ImagePaintTile *tile, const float uv[2], float coord[2])
static void paint_2d_ibuf_rgb_get(ImBuf *ibuf, int x, int y, float r_rgb[4])
static void brush_painter_mask_imbuf_partial_update(BrushPainter *painter, ImagePaintTile *tile, const float pos[2], const int diameter)
static void brush_painter_2d_require_imbuf(Brush *brush, ImagePaintTile *tile, bool use_float, bool use_color_correction, bool invert)
static void paint_2d_set_region(ImagePaintRegion *region, int destx, int desty, int srcx, int srcy, int width, int height)
static ImageUser * paint_2d_get_tile_iuser(ImagePaintState *s, int tile_number)
static void brush_imbuf_tex_co(const rctf *mapping, int x, int y, float texco[3])
static void paint_2d_ibuf_tile_convert(ImBuf *ibuf, int *x, int *y, short paint_tile)
static BrushPainter * brush_painter_2d_new(Scene *scene, const Paint *paint, Brush *brush, bool invert)
static void brush_painter_2d_tex_mapping(ImagePaintState *s, ImagePaintTile *tile, const int diameter, const float pos[2], const float mouse[2], int mapmode, rctf *r_mapping)
void paint_2d_redraw(const bContext *C, void *ps, bool final)
static bool is_inside_tile(const int size[2], const float pos[2], const float brush[2])
static void brush_painter_2d_refresh_cache(ImagePaintState *s, BrushPainter *painter, ImagePaintTile *tile, const float pos[2], const float mouse[2], float pressure, float distance, float size)
static void brush_painter_imbuf_update(BrushPainter *painter, ImagePaintTile *tile, ImBuf *oldtexibuf, int origx, int origy, int w, int h, int xt, int yt)
static void paint_2d_fill_add_pixel_byte(const int x_px, const int y_px, ImBuf *ibuf, BLI_Stack *stack, BLI_bitmap *touched, const float color[4], float threshold_sq)
void paint_curve_mask_cache_free_data(CurveMaskCache *curve_mask_cache)
void paint_curve_mask_cache_update(CurveMaskCache *curve_mask_cache, const Brush *brush, const int diameter, const float radius, const float cursor_position[2])
static void image_init(Image *ima, short source, short type)
CurveMaskCache curve_mask_cache
bool use_color_correction
std::optional< blender::float3 > initial_hsv_jitter
struct ColorBand * gradient
char gradient_stroke_mode
Caching structure for curve mask.
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
ImagePaintTileState state
ImagePaintRegion * region
struct ToolSettings * toolsettings
ColorManagedDisplaySettings display_settings
struct ReportList * reports
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)