152 BrushPainter *painter = MEM_new<BrushPainter>(__func__);
154 painter->
brush = brush;
155 painter->
scene = scene;
156 painter->
paint = paint;
186 cache->
ibuf =
nullptr;
222 texco[0] = mapping->
xmin +
x * mapping->
xmax;
223 texco[1] = mapping->
ymin +
y * mapping->
ymax;
242 for (
x = 0;
x <
size;
x++, m++) {
246 *m =
ushort(65535.0f * res);
256 const ushort *tex_mask_old,
271 bool use_texture_old = (tex_mask_old !=
nullptr);
279 for (
y = origy;
y < h;
y++) {
280 for (
x = origx;
x <
w;
x++) {
285 ushort *
b = tex_mask + (
y * diameter +
x);
286 ushort *t = tex_mask_cur + (
y * diameter +
x);
288 if (!use_texture_old) {
295 if (use_texture_old) {
296 res = *(tex_mask_old + ((
y - origy + yt) * cache->
tex_mask_old_w + (
x - origx + xt)));
319 int destx, desty, srcx, srcy,
w, h, x1, y1, x2, y2;
333 maskibuf.
x = diameter;
334 maskibuf.
y = diameter;
342 desty = int(
floorf(
tile->last_paintpos[1])) - int(
floorf(
pos[1])) + (diameter / 2 - h / 2);
345 IMB_rectclip(&maskibuf, &maskibuf_old, &destx, &desty, &srcx, &srcy, &
w, &h);
353 x1 =
min_ii(destx, diameter);
354 y1 =
min_ii(desty, diameter);
355 x2 =
min_ii(destx +
w, diameter);
356 y2 =
min_ii(desty + h, diameter);
359 if ((x1 < x2) && (y1 < y2)) {
361 painter,
tile, tex_mask_old, x1, y1, x2, y2, srcx, srcy, diameter);
369 if ((0 < x1) && (0 < diameter)) {
372 if ((x2 < diameter) && (0 < diameter)) {
374 painter,
tile,
nullptr, x2, 0, diameter, diameter, 0, 0, diameter);
376 if ((x1 < x2) && (0 < y1)) {
379 if ((x1 < x2) && (y2 < diameter)) {
399 const bool is_float = cache->
is_float;
430 float texco[3], rgba[4];
488 const bool is_float = cache->
is_float;
490 const bool use_texture_old = (oldtexibuf !=
nullptr);
517 for (
y = origy;
y < h;
y++) {
518 for (
x = origx;
x <
w;
x++) {
520 float texco[3], rgba[4];
522 if (!use_texture_old) {
547 if (use_texture_old) {
549 ((
y - origy + yt) * oldtexibuf->
x + (
x - origx + xt)) * 4;
568 if (use_texture_old) {
570 ((
y - origy + yt) * oldtexibuf->
x + (
x - origx + xt)) * 4;
605 ImBuf *oldtexibuf, *ibuf;
606 int imbflag, destx, desty, srcx, srcy,
w, h, x1, y1, x2, y2;
624 desty = int(
floorf(
tile->last_paintpos[1])) - int(
floorf(
pos[1])) + (diameter / 2 - h / 2);
637 y2 =
min_ii(desty + h, ibuf->
y);
640 if ((x1 < x2) && (y1 < y2)) {
649 if ((0 < x1) && (0 < ibuf->
y)) {
652 if ((x2 < ibuf->
x) && (0 < ibuf->
y)) {
655 if ((x1 < x2) && (0 < y1)) {
658 if ((x1 < x2) && (y2 < ibuf->
y)) {
667 const float mouse[2],
671 float invw = 1.0f /
float(
tile->canvas->x);
672 float invh = 1.0f /
float(
tile->canvas->y);
676 start[0] =
pos[0] - diameter / 2.0f;
677 start[1] =
pos[1] - diameter / 2.0f;
681 float xmin, ymin, xmax, ymax;
684 s->
v2d, (start[0] + diameter) * invw, (start[1] + diameter) * invh, &xmax, &ymax);
687 r_mapping->
xmax = (xmax - xmin) /
float(diameter);
688 r_mapping->
ymax = (ymax - ymin) /
float(diameter);
689 r_mapping->
xmin = xmin + (
tile->uv_origin[0] *
tile->size[0] * r_mapping->
xmax);
690 r_mapping->
ymin = ymin + (
tile->uv_origin[1] *
tile->size[1] * r_mapping->
ymax);
694 r_mapping->
xmin = 2.0f * (start[0] * invw - 0.5f);
695 r_mapping->
ymin = 2.0f * (start[1] * invh - 0.5f);
696 r_mapping->
xmax = 2.0f * invw;
697 r_mapping->
ymax = 2.0f * invh;
701 r_mapping->
xmin = mouse[0] - diameter * 0.5f + 0.5f;
702 r_mapping->
ymin = mouse[1] - diameter * 0.5f + 0.5f;
703 r_mapping->
xmax = 1.0f;
704 r_mapping->
ymax = 1.0f;
707 r_mapping->
xmin = int(-diameter * 0.5) + int(
floorf(
pos[0])) -
709 r_mapping->
ymin = int(-diameter * 0.5) + int(
floorf(
pos[1])) -
711 r_mapping->
xmax = 1.0f;
712 r_mapping->
ymax = 1.0f;
720 const float mouse[2],
729 const int diameter = std::max(1,
int(
size * 2)) + 4;
731 bool do_random =
false;
732 bool do_partial_update =
false;
739 float tex_rotation = -brush->
mtex.
rot;
753 do_partial_update =
true;
761 bool renew_maxmask =
false;
762 bool do_partial_update_mask =
false;
768 renew_maxmask =
true;
771 do_partial_update_mask =
true;
772 renew_maxmask =
true;
776 do_partial_update_mask =
false;
777 renew_maxmask =
true;
788 if (do_partial_update_mask) {
807 cache->
ibuf =
nullptr;
810 if (do_partial_update) {
823 else if (do_partial_update) {
828 if ((dx != 0) || (dy != 0)) {
834 painter->
pool =
nullptr;
856 if (ibuf !=
nullptr) {
899 ImBuf *ibuf,
int x,
int y,
const bool is_torus,
const float rgb[4])
914 float map_alpha = (rgb[3] == 0.0f) ? rrgbf[3] : rrgbf[3] / rgb[3];
924 rrgb[0] = straight[0];
925 rrgb[1] = straight[1];
926 rrgb[2] = straight[2];
927 rrgb[3] = straight[3];
948 ImBuf *ibuf,
int x,
int y,
float *outrgb,
short paint_tile,
float w)
975 const short paint_tile)
979 int x,
y, xi, yi, xo, yo, xk, yk;
981 int out_off[2], in_off[2], dim[2];
991 out_off[0] = out_off[1] = 0;
994 IMB_rectclip(ibuf, ibufb, &in_off[0], &in_off[1], &out_off[0], &out_off[1], &dim[0], &dim[1]);
996 if ((dim[0] == 0) || (dim[1] == 0)) {
1004 for (
y = 0;
y < dim[1];
y++) {
1005 for (
x = 0;
x < dim[0];
x++) {
1013 if (xi < ibuf->
x && xi >= 0 && yi < ibuf->
y && yi >= 0) {
1026 for (yk = 0; yk < kernel->
side; yk++) {
1027 for (xk = 0; xk < kernel->
side; xk++) {
1047 if (
fabsf(outrgb[0]) > threshold) {
1049 float alpha = rgba[3];
1050 rgba[3] = outrgb[3] =
mask;
1065 xo = out_off[0] +
x;
1066 yo = out_off[1] +
y;
1073 ImagePaintRegion *region,
int destx,
int desty,
int srcx,
int srcy,
int width,
int height)
1075 region->
destx = destx;
1076 region->
desty = desty;
1077 region->
srcx = srcx;
1078 region->
srcy = srcy;
1079 region->
width = width;
1088 int destx = region->
destx;
1089 int desty = region->
desty;
1090 int srcx = region->
srcx;
1091 int srcy = region->
srcy;
1092 int width = region->
width;
1093 int height = region->
height;
1094 int origw, origh,
w, h, tot = 0;
1098 destx = destx % dbuf->
x;
1102 srcx = srcx % sbuf->
x;
1108 desty = desty % dbuf->
y;
1112 srcy = srcy % sbuf->
y;
1119 origw =
w = (width > dbuf->
x) ? dbuf->
x : width;
1120 origh = h = (height > dbuf->
y) ? dbuf->
y : height;
1123 IMB_rectclip(dbuf, sbuf, &destx, &desty, &srcx, &srcy, &
w, &h);
1129 ®ion[tot++], (destx +
w) % dbuf->
x, desty, (srcx +
w) % sbuf->
x, srcy, origw -
w, h);
1133 ®ion[tot++], destx, (desty + h) % dbuf->
y, srcx, (srcy + h) % sbuf->
y,
w, origh - h);
1137 (destx +
w) % dbuf->
x,
1138 (desty + h) % dbuf->
y,
1139 (srcx +
w) % sbuf->
x,
1140 (srcy + h) % sbuf->
y,
1156 for (a = 0; a < tot; a++) {
1181 int w = ibufb->
x, h = ibufb->
y, destx = 0, desty = 0, srcx =
pos[0], srcy =
pos[1];
1184 IMB_rectclip(clonebuf, ibuf, &destx, &desty, &srcx, &srcy, &
w, &h);
1225 ipos[0] = int(
floorf(
pos[0] - ibufb->
x / 2));
1226 ipos[1] = int(
floorf(
pos[1] - ibufb->
y / 2));
1245 for (
int ty = tiley; ty <= tileh; ty++) {
1246 for (
int tx = tilex; tx <= tilew; tx++) {
1252 if (
tile->canvas->float_buffer.data) {
1271 tile->cache.curve_mask_cache.curve_mask,
1272 tile->cache.tex_mask,
1318 const float lastpos[2],
1323 ImBuf *clonebuf =
nullptr, *frombuf;
1329 const float *offset = image_paint_settings.
clone_offset;
1332 int bpos[2], blastpos[2], bliftpos[2];
1343 if (lastpos[0] ==
pos[0] && lastpos[1] ==
pos[1]) {
1352 liftpos[0] =
pos[0] - offset[0] * canvas->
x;
1353 liftpos[1] =
pos[1] - offset[1] * canvas->
y;
1359 frombuf = (clonebuf) ? clonebuf : ibufb;
1371 for (a = 0; a < tot; a++) {
1383 int tilex, tiley, tilew, tileh;
1395 if (tiley == tileh) {
1397 s,
tile, ®ion[a], frombuf, mask_max,
blend, tilex, tiley, tilew, tileh);
1403 data.region = ®ion[a];
1404 data.frombuf = frombuf;
1405 data.mask_max = mask_max;
1421 tile->cache.curve_mask_cache.curve_mask,
1422 tile->cache.tex_mask,
1495 return (
pos[0] >= -brush[0]) && (
pos[0] <
size[0] + brush[0]) && (
pos[1] >= -brush[1]) &&
1496 (
pos[1] <
size[1] + brush[1]);
1501 coord[0] = (uv[0] -
tile->uv_origin[0]) *
tile->size[0];
1502 coord[1] = (uv[1] -
tile->uv_origin[1]) *
tile->size[1];
1506 const float prev_mval[2],
1507 const float mval[2],
1513 float new_uv[2], old_uv[2];
1525 float last_uv[2], start_uv[2];
1535 const float uv_brush_size[2] = {
1543 const int uv_size[2] = {1, 1};
1544 float local_new_uv[2], local_old_uv[2];
1558 float size = base_size *
tile->radius_fac;
1560 float new_coord[2], old_coord[2];
1581 const ColorSpace *byte_colorspace = (is_float || is_data) ?
nullptr :
1583 const bool is_srgb = (is_float || is_data) ?
1601 tile->need_redraw =
true;
1630 if (s->
image ==
nullptr) {
1649 if (ibuf ==
nullptr) {
1704 bool had_redraw =
false;
1759 const float color[4],
1764 if (x_px >= ibuf->
x || x_px < 0 || y_px >= ibuf->
y || y_px < 0) {
1768 coordinate = size_t(y_px) * ibuf->
x + x_px;
1788 const float color[4],
1793 if (x_px >= ibuf->
x || x_px < 0 || y_px >= ibuf->
y || y_px < 0) {
1797 coordinate = size_t(y_px) * ibuf->
x + x_px;
1824 const float color[3],
1826 const float mouse_init[2],
1827 const float mouse_final[2],
1858 if (iuser ==
nullptr) {
1863 iuser = &local_iuser;
1865 iuser->
tile = tile_number;
1880 *(((
char *)&color_b) + 3) = strength * 255;
1884 color_f[3] = strength;
1887 if (!mouse_final || !br) {
1892 for (x_px = 0; x_px < ibuf->
x; x_px++) {
1893 for (y_px = 0; y_px < ibuf->
y; y_px++) {
1901 for (x_px = 0; x_px < ibuf->
x; x_px++) {
1902 for (y_px = 0; y_px < ibuf->
y; y_px++) {
1916 int width = ibuf->
x;
1917 float pixel_color[4];
1925 if (x_px >= ibuf->
x || x_px < 0 || y_px > ibuf->
y || y_px < 0) {
1936 coordinate = (size_t(y_px) * ibuf->
x + x_px);
1960 x_px = coordinate % width;
1961 y_px = coordinate / width;
1964 x_px - 1, y_px - 1, ibuf, stack, touched, pixel_color, threshold_sq);
1966 x_px - 1, y_px, ibuf, stack, touched, pixel_color, threshold_sq);
1968 x_px - 1, y_px + 1, ibuf, stack, touched, pixel_color, threshold_sq);
1970 x_px, y_px + 1, ibuf, stack, touched, pixel_color, threshold_sq);
1972 x_px, y_px - 1, ibuf, stack, touched, pixel_color, threshold_sq);
1974 x_px + 1, y_px - 1, ibuf, stack, touched, pixel_color, threshold_sq);
1976 x_px + 1, y_px, ibuf, stack, touched, pixel_color, threshold_sq);
1978 x_px + 1, y_px + 1, ibuf, stack, touched, pixel_color, threshold_sq);
1991 x_px = coordinate % width;
1992 y_px = coordinate / width;
1995 x_px - 1, y_px - 1, ibuf, stack, touched, pixel_color, threshold_sq);
1997 x_px - 1, y_px, ibuf, stack, touched, pixel_color, threshold_sq);
1999 x_px - 1, y_px + 1, ibuf, stack, touched, pixel_color, threshold_sq);
2001 x_px, y_px + 1, ibuf, stack, touched, pixel_color, threshold_sq);
2003 x_px, y_px - 1, ibuf, stack, touched, pixel_color, threshold_sq);
2005 x_px + 1, y_px - 1, ibuf, stack, touched, pixel_color, threshold_sq);
2007 x_px + 1, y_px, ibuf, stack, touched, pixel_color, threshold_sq);
2009 x_px + 1, y_px + 1, ibuf, stack, touched, pixel_color, threshold_sq);
2026 const bContext *
C,
Brush *br,
const float mouse_init[2],
const float mouse_final[2],
void *ps)
2038 float line_len_sq_inv, line_len;
2043 if (ima ==
nullptr) {
2055 if (ibuf ==
nullptr) {
2064 image_final[0] *= ibuf->
x;
2065 image_final[1] *= ibuf->
y;
2073 line_len_sq_inv = 1.0f / line_len;
2074 line_len =
sqrtf(line_len);
2082 for (x_px = 0; x_px < ibuf->
x; x_px++) {
2083 for (y_px = 0; y_px < ibuf->
y; y_px++) {
2089 f =
dot_v2v2(p, tangent) * line_len_sq_inv;
2094 f =
len_v2(p) / line_len;
2101 color_f[3] *= brush_alpha;
2110 for (x_px = 0; x_px < ibuf->
x; x_px++) {
2111 for (y_px = 0; y_px < ibuf->
y; y_px++) {
2117 f =
dot_v2v2(p, tangent) * line_len_sq_inv;
2122 f =
len_v2(p) / line_len;
2130 ((
uchar *)&color_b)[3] *= brush_alpha;
float BKE_brush_alpha_get(const Paint *paint, const Brush *brush)
float BKE_brush_sample_tex_3d(const Paint *paint, const Brush *br, const MTex *mtex, const float point[3], float rgba[4], int thread, ImagePool *pool)
float BKE_brush_sample_masktex(const Paint *paint, Brush *br, const float point[2], int thread, ImagePool *pool)
std::optional< BrushColorJitterSettings > BKE_brush_color_jitter_get_settings(const Paint *paint, const Brush *brush)
bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
SpaceImage * CTX_wm_space_image(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::ColorSpace ColorSpace
#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])
MINLINE void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
MINLINE void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
MINLINE void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
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
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)
void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], const ColorSpace *colorspace)
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
bool IMB_colormanagement_space_is_srgb(const ColorSpace *colorspace)
BLI_INLINE void IMB_colormanagement_scene_linear_to_srgb_v3(float srgb[3], const float scene_linear[3])
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)
VecBase< float, 3 > float3
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)
void paint_brush_color_get(const Paint *paint, Brush *br, std::optional< blender::float3 > &initial_hsv_jitter, bool invert, float distance, float pressure, float r_color[3])
BlurKernel * paint_new_blur_kernel(Brush *br, bool proj)
void paint_brush_exit_tex(Brush *brush)
bool paint_use_opacity_masking(const Paint *paint, const 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 void brush_painter_2d_require_imbuf(Brush *brush, ImagePaintTile *tile, bool is_float, bool is_data, bool is_srgb, const ColorSpace *byte_colorspace, bool invert)
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 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)
const ColorSpace * byte_colorspace
CurveMaskCache curve_mask_cache
std::optional< blender::float3 > initial_hsv_jitter
struct ColorBand * gradient
char gradient_stroke_mode
Caching structure for curve mask.
const ColorSpace * colorspace
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
ImagePaintTileState state
ImagePaintRegion * region
PaintRuntimeHandle * runtime
struct ToolSettings * toolsettings
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)