97 ImBuf *ibuf,
int x,
int y,
int w,
int h,
int *tx,
int *ty,
int *tw,
int *th)
99 int srcx = 0, srcy = 0;
112 ImBuf *tmpibuf =
nullptr;
113 int tilex, tiley, tilew, tileh, tx, ty;
114 int srcx = 0, srcy = 0;
118 if (
w == 0 || h == 0) {
130 for (ty = tiley; ty <= tileh; ty++) {
131 for (tx = tilex; tx <= tilew; tx++) {
133 undo_tiles, ima, ibuf, &tmpibuf, iuser, tx, ty,
nullptr,
nullptr,
false, find_old);
162 if (texpaint || (sima && sima->
lock)) {
185 kernel->wdata =
static_cast<float *
>(
187 kernel->pixel_len = radius;
196 side =
kernel->side = radius * 2 + 1;
198 kernel->wdata =
static_cast<float *
>(
205 for (i = 0; i <
kernel->side_squared; i++) {
212 float standard_dev = radius / 3.0f;
215 standard_dev = -standard_dev * standard_dev * 2;
217 for (i = 0; i < side; i++) {
218 for (j = 0; j < side; j++) {
219 float idist = radius - i;
220 float jdist = radius - j;
221 float value =
exp((idist * idist + jdist * jdist) / standard_dev);
223 kernel->wdata[i + j * side] = value;
231 printf(
"unidentified kernel type, aborting\n");
275 if (sima->
image !=
nullptr &&
334 bool color_correction,
369 if (color_correction) {
495 cmv = MEM_new<GrabClone>(
"GrabClone");
497 cmv->
startx =
event->xy[0];
498 cmv->
starty =
event->xy[1];
511 float startfx, startfy, fx, fy, delta[2];
514 switch (event->
type) {
523 ®ion->
v2d, cmv->
startx - xmin, cmv->
starty - ymin, &startfx, &startfy);
526 delta[0] = fx - startfx;
527 delta[1] = fy - startfy;
570 "Delta offset of clone image in 0.0 to 1.0 coordinates",
591 TIP_(
"Sample color for %s"),
592 !
data->sample_palette ?
593 TIP_(
"Brush. Use Left Click to sample for palette instead") :
594 TIP_(
"Palette. Use Left Click to sample more colors"));
642 data->sample_palette =
false;
676 if (
data->show_cursor) {
680 if (
data->sample_palette) {
695 switch (event->
type) {
709 if (!
data->sample_palette) {
710 data->sample_palette =
true;
729 ot->
name =
"Sample Color";
730 ot->
idname =
"PAINT_OT_sample_color";
731 ot->
description =
"Use the mouse to sample a color in the image";
746 ot->
srna,
"location", 2,
nullptr, 0, INT_MAX,
"Location",
"", 0, 16384);
757 Image *ima =
nullptr;
802 if (
U.glreslimit != 0) {
827 if (
U.glreslimit != 0) {
867 const bool is_mode_set = (ob->
mode & mode_flag) != 0;
875 if (ob->
mode & mode_flag) {
892 ot->
name =
"Texture Paint Toggle";
893 ot->
idname =
"PAINT_OT_texture_paint_toggle";
950 ot->
idname =
"PAINT_OT_brush_colors_flip";
968 if (sima && sima->
image) {
973 const float mouse_init[2] = {
static_cast<float>(mouse[0]),
static_cast<float>(mouse[1])};
const float * BKE_brush_secondary_color_get(const struct Scene *scene, const struct Brush *brush)
const float * BKE_brush_color_get(const struct Scene *scene, const struct Brush *brush)
void BKE_brush_color_set(struct Scene *scene, struct Brush *brush, const float color[3])
bool BKE_colorband_evaluate(const struct ColorBand *coba, float in, float out[4])
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct wmMsgBus * CTX_wm_message_bus(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct SpaceImage * CTX_wm_space_image(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
void BKE_image_paint_set_mipmap(struct Main *bmain, bool mipmap)
void BKE_image_mark_dirty(struct Image *image, struct ImBuf *ibuf)
void BKE_image_free_all_gputextures(struct Main *bmain)
void BKE_image_update_gputexture(struct Image *ima, struct ImageUser *iuser, int x, int y, int w, int h)
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
void BKE_texpaint_slots_refresh_object(struct Scene *scene, struct Object *ob)
struct Mesh * BKE_mesh_from_object(struct Object *ob)
bool BKE_paint_select_elem_test(struct Object *ob)
ePaintMode BKE_paintmode_get_active_from_context(const struct bContext *C)
struct Brush * BKE_paint_brush(struct Paint *paint)
void BKE_paint_init(struct Main *bmain, struct Scene *sce, ePaintMode mode, const char col[3])
struct Paint * BKE_paint_get_active_from_context(const struct bContext *C)
bool BKE_paint_select_vert_test(struct Object *ob)
const char PAINT_CURSOR_TEXTURE_PAINT[3]
bool BKE_paint_select_face_test(struct Object *ob)
void BKE_paint_toolslots_brush_validate(struct Main *bmain, struct Paint *paint)
#define LISTBASE_FOREACH(type, var, list)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v2_v2(float r[2], const float a[2])
MINLINE void swap_v3_v3(float a[3], float b[3])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_rcti_init_minmax(struct rcti *rect)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
bool BLI_rcti_is_empty(const struct rcti *rect)
void BLI_rcti_do_minmax_rcti(struct rcti *rect, const struct rcti *other)
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_COPY_ON_WRITE
#define ID_IS_LINKED(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
@ BRUSH_GRADIENT_SPACING_CLAMP
@ BRUSH_GRADIENT_PRESSURE
@ BRUSH_GRADIENT_SPACING_REPEAT
Object is a sort of wrapper for general info.
#define IMAGEPAINT_MODE_IMAGE
#define IMAGEPAINT_MODE_MATERIAL
#define MTEX_MAP_MODE_STENCIL
#define MTEX_MAP_MODE_TILED
void ED_space_image_get_zoom(struct SpaceImage *sima, const struct ARegion *region, float *r_zoomx, float *r_zoomy)
void ED_space_image_set(struct Main *bmain, struct SpaceImage *sima, struct Image *ima, bool automatic)
void ED_paint_cursor_start(struct Paint *p, bool(*poll)(struct bContext *C))
bool ED_object_mode_compat_set(struct bContext *C, struct Object *ob, eObjectMode mode, struct ReportList *reports)
void ED_image_undo_push_begin(const char *name, int paint_mode)
struct PaintTileMap * ED_image_paint_tile_map_get(void)
void ED_image_undo_push_end(void)
void * ED_image_paint_tile_push(PaintTileMap *paint_tile_map, struct Image *image, struct ImBuf *ibuf, struct ImBuf **tmpibuf, struct ImageUser *iuser, int x_tile, int y_tile, unsigned short **r_mask, bool **r_valid, bool use_thread_lock, bool find_prev)
bool ED_paint_proj_mesh_data_check(struct Scene *scene, struct Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil)
#define ED_IMAGE_UNDO_TILE_BITS
void ED_region_tag_redraw(struct ARegion *region)
void ED_workspace_status_text(struct bContext *C, const char *str)
_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 type
void IMB_partial_display_buffer_update_delayed(struct ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax)
void IMB_colormanagement_display_to_scene_linear_v3(float pixel[3], struct ColorManagedDisplay *display)
BLI_INLINE void IMB_colormanagement_scene_linear_to_srgb_v3(float srgb[3], const float scene_linear[3])
void IMB_rectclip(struct ImBuf *dbuf, const struct ImBuf *sbuf, int *destx, int *desty, int *srcx, int *srcy, int *width, int *height)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
void ntreeTexEndExecTree(struct bNodeTreeExec *exec)
struct bNodeTreeExec * ntreeTexBeginExecTree(struct bNodeTree *ntree)
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SyclQueue void void size_t num_bytes SyclQueue void const char void *memory_device_pointer KernelContext int kernel
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
ccl_device_inline float3 exp(float3 v)
static void area(int d1, int d2, int e1, int e2, float weights[2])
T distance(const T &a, const T &b)
void paint_cursor_delete_textures(void)
void paint_delete_blur_kernel(BlurKernel *kernel)
static bool image_paint_2d_clone_poll(bContext *C)
bool ED_image_tools_paint_poll(bContext *C)
static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
BlurKernel * paint_new_blur_kernel(Brush *br, bool proj)
static bool image_paint_poll_ex(bContext *C, bool check_tool)
void ED_imapaint_bucket_fill(struct bContext *C, float color[3], wmOperator *op, const int mouse[2])
static bool texture_paint_poll(bContext *C)
bool vert_paint_poll(bContext *C)
static int grab_clone_exec(bContext *C, wmOperator *op)
void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, ImageUser *iuser, short texpaint)
ImagePaintPartialRedraw * get_imapaintpartial(void)
void paint_brush_init_tex(Brush *brush)
static bool texture_paint_toggle_poll(bContext *C)
void ED_imapaint_dirty_region(Image *ima, ImBuf *ibuf, ImageUser *iuser, int x, int y, int w, int h, bool find_old)
void ED_object_texture_paint_mode_exit_ex(Main *bmain, Scene *scene, Object *ob)
static int sample_color_exec(bContext *C, wmOperator *op)
static Brush * image_paint_brush(bContext *C)
static int grab_clone_modal(bContext *C, wmOperator *op, const wmEvent *event)
void ED_object_texture_paint_mode_exit(bContext *C)
bool facemask_paint_poll(bContext *C)
bool image_texture_paint_poll(bContext *C)
void ED_imapaint_clear_partial_redraw(void)
void ED_object_texture_paint_mode_enter_ex(Main *bmain, Scene *scene, Object *ob)
void PAINT_OT_sample_color(wmOperatorType *ot)
void set_imapaintpartial(struct ImagePaintPartialRedraw *ippr)
static void sample_color_update_header(SampleColorData *data, bContext *C)
static ImagePaintPartialRedraw imapaintpartial
void PAINT_OT_texture_paint_toggle(wmOperatorType *ot)
void ED_space_image_paint_update(Main *bmain, wmWindowManager *wm, Scene *scene)
bool mask_paint_poll(bContext *C)
static int brush_colors_flip_exec(bContext *C, wmOperator *UNUSED(op))
bool paint_use_opacity_masking(Brush *brush)
void paint_brush_color_get(struct Scene *scene, struct Brush *br, bool color_correction, bool invert, float distance, float pressure, float color[3], struct ColorManagedDisplay *display)
static int grab_clone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void toggle_paint_cursor(Scene *scene, bool enable)
static void grab_clone_cancel(bContext *UNUSED(C), wmOperator *op)
void ED_object_texture_paint_mode_enter(bContext *C)
static void grab_clone_apply(bContext *C, wmOperator *op)
void PAINT_OT_brush_colors_flip(wmOperatorType *ot)
bool get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
static bool brush_colors_flip_poll(bContext *C)
void PAINT_OT_grab_clone(wmOperatorType *ot)
void paint_brush_exit_tex(Brush *brush)
static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
static bool sample_color_poll(bContext *C)
void imapaint_region_tiles(ImBuf *ibuf, int x, int y, int w, int h, int *tx, int *ty, int *tw, int *th)
static bool image_paint_poll_ignore_tool(bContext *C)
static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event)
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)
bool vertex_paint_poll_ignore_tool(struct bContext *C)
void paint_sample_color(struct bContext *C, struct ARegion *region, int x, int y, bool texpaint_proj, bool palette)
void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
struct ColorBand * gradient
char gradient_stroke_mode
struct ImBuf * mipmap[IMB_MIPMAP_LEVELS]
struct TexPaintSlot * texpaintslot
struct ToolSettings * toolsettings
struct bNodeTree * nodetree
struct bNodeTreeExec * execdata
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
void(* cancel)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
struct wmOperatorType * type
void WM_cursor_modal_set(wmWindow *win, int val)
void WM_cursor_modal_restore(wmWindow *win)
void WM_redraw_windows(bContext *C)
void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *UNUSED(region))
int WM_userdef_event_type_from_keymap_type(int kmitype)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_)
bool WM_paint_cursor_end(wmPaintCursor *handle)
bScreen * WM_window_get_active_screen(const wmWindow *win)