|
Blender V4.3
|
#include <cstdlib>#include "BLI_math_base.h"#include "BLI_math_color.h"#include "BLI_math_color_blend.h"#include "BLI_math_vector.h"#include "BLI_rect.h"#include "BLI_utildefines.h"#include "IMB_imbuf.hh"#include "IMB_imbuf_types.hh"#include "IMB_colormanagement.hh"#include "MEM_guardedalloc.h"#include <cstring>Go to the source code of this file.
Classes | |
| struct | RectBlendThreadData |
Typedefs | |
| using | IMB_blend_func = void (*)(uchar *dst, const uchar *src1, const uchar *src2) |
| using | IMB_blend_func_float = void (*)(float *dst, const float *src1, const float *src2) |
Functions | |
| void | IMB_blend_color_byte (uchar dst[4], const uchar src1[4], const uchar src2[4], IMB_BlendMode mode) |
| void | IMB_blend_color_float (float dst[4], const float src1[4], const float 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) |
| static void | imb_rectclip3 (ImBuf *dbuf, const ImBuf *obuf, const ImBuf *sbuf, int *destx, int *desty, int *origx, int *origy, int *srcx, int *srcy, int *width, int *height) |
| void | IMB_rectcpy (ImBuf *dbuf, const ImBuf *sbuf, int destx, int desty, int srcx, int srcy, int width, int height) |
| void | IMB_rectblend (ImBuf *dbuf, const ImBuf *obuf, const ImBuf *sbuf, ushort *dmask, const ushort *curvemask, const ushort *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) |
| static void | rectblend_thread_do (void *data_v, int scanline) |
| void | IMB_rectblend_threaded (ImBuf *dbuf, const ImBuf *obuf, const ImBuf *sbuf, ushort *dmask, const ushort *curvemask, const ushort *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_rectfill (ImBuf *drect, const float col[4]) |
| void | IMB_rectfill_area_replace (const ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2) |
| void | buf_rectfill_area (uchar *rect, float *rectf, int width, int height, const float col[4], ColorManagedDisplay *display, int x1, int y1, int x2, int y2) |
| void | IMB_rectfill_area (ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2, ColorManagedDisplay *display) |
| void | IMB_rectfill_alpha (ImBuf *ibuf, const float value) |
Crop | |
| static void | rect_crop_4bytes (void **buf_p, const int size_src[2], const rcti *crop) |
| static void | rect_crop_16bytes (void **buf_p, const int size_src[2], const rcti *crop) |
| void | IMB_rect_crop (ImBuf *ibuf, const rcti *crop) |
| static void | rect_realloc_4bytes (void **buf_p, const uint size[2]) |
| static void | rect_realloc_16bytes (void **buf_p, const uint size[2]) |
| void | IMB_rect_size_set (ImBuf *ibuf, const uint size[2]) |
| using IMB_blend_func = void (*)(uchar *dst, const uchar *src1, const uchar *src2) |
| using IMB_blend_func_float = void (*)(float *dst, const float *src1, const float *src2) |
| void buf_rectfill_area | ( | unsigned char * | rect, |
| float * | rectf, | ||
| int | width, | ||
| int | height, | ||
| const float | col[4], | ||
| ColorManagedDisplay * | display, | ||
| int | x1, | ||
| int | y1, | ||
| int | x2, | ||
| int | y2 ) |
This should not be here, really, we needed it for operating on render data, IMB_rectfill_area calls it.
Definition at line 1130 of file rectop.cc.
References CLAMP, col, copy_v4_v4(), fb(), IMB_colormanagement_display_to_scene_linear_v3(), srgb_to_linearrgb_v4(), and unit_float_to_uchar_clamp.
Referenced by BKE_image_stamp_buf(), and IMB_rectfill_area().
| void IMB_blend_color_byte | ( | uchar | dst[4], |
| const uchar | src1[4], | ||
| const uchar | src2[4], | ||
| IMB_BlendMode | mode ) |
Definition at line 27 of file rectop.cc.
References blend_color_add_alpha_byte(), blend_color_add_byte(), blend_color_burn_byte(), blend_color_color_byte(), blend_color_darken_byte(), blend_color_difference_byte(), blend_color_dodge_byte(), blend_color_erase_alpha_byte(), blend_color_exclusion_byte(), blend_color_hardlight_byte(), blend_color_hue_byte(), blend_color_lighten_byte(), blend_color_linearburn_byte(), blend_color_linearlight_byte(), blend_color_luminosity_byte(), blend_color_mix_byte(), blend_color_mul_byte(), blend_color_overlay_byte(), blend_color_pinlight_byte(), blend_color_saturation_byte(), blend_color_screen_byte(), blend_color_softlight_byte(), blend_color_sub_byte(), blend_color_vividlight_byte(), IMB_BLEND_ADD, IMB_BLEND_ADD_ALPHA, IMB_BLEND_COLOR, IMB_BLEND_COLORBURN, IMB_BLEND_COLORDODGE, IMB_BLEND_DARKEN, IMB_BLEND_DIFFERENCE, IMB_BLEND_ERASE_ALPHA, IMB_BLEND_EXCLUSION, IMB_BLEND_HARDLIGHT, IMB_BLEND_HUE, IMB_BLEND_LIGHTEN, IMB_BLEND_LINEARBURN, IMB_BLEND_LINEARLIGHT, IMB_BLEND_LUMINOSITY, IMB_BLEND_MIX, IMB_BLEND_MUL, IMB_BLEND_OVERLAY, IMB_BLEND_PINLIGHT, IMB_BLEND_SATURATION, IMB_BLEND_SCREEN, IMB_BLEND_SOFTLIGHT, IMB_BLEND_SUB, and IMB_BLEND_VIVIDLIGHT.
Referenced by do_projectpaint_clone(), do_projectpaint_draw(), do_projectpaint_mask(), do_projectpaint_thread(), paint_2d_bucket_fill(), and paint_2d_gradient_fill().
| void IMB_blend_color_float | ( | float | dst[4], |
| const float | src1[4], | ||
| const float | src2[4], | ||
| IMB_BlendMode | mode ) |
Definition at line 115 of file rectop.cc.
References blend_color_add_alpha_float(), blend_color_add_float(), blend_color_burn_float(), blend_color_color_float(), blend_color_darken_float(), blend_color_difference_float(), blend_color_dodge_float(), blend_color_erase_alpha_float(), blend_color_exclusion_float(), blend_color_hardlight_float(), blend_color_hue_float(), blend_color_lighten_float(), blend_color_linearburn_float(), blend_color_linearlight_float(), blend_color_luminosity_float(), blend_color_mix_float(), blend_color_mul_float(), blend_color_overlay_float(), blend_color_pinlight_float(), blend_color_saturation_float(), blend_color_screen_float(), blend_color_softlight_float(), blend_color_sub_float(), blend_color_vividlight_float(), IMB_BLEND_ADD, IMB_BLEND_ADD_ALPHA, IMB_BLEND_COLOR, IMB_BLEND_COLORBURN, IMB_BLEND_COLORDODGE, IMB_BLEND_DARKEN, IMB_BLEND_DIFFERENCE, IMB_BLEND_ERASE_ALPHA, IMB_BLEND_EXCLUSION, IMB_BLEND_HARDLIGHT, IMB_BLEND_HUE, IMB_BLEND_LIGHTEN, IMB_BLEND_LINEARBURN, IMB_BLEND_LINEARLIGHT, IMB_BLEND_LUMINOSITY, IMB_BLEND_MIX, IMB_BLEND_MUL, IMB_BLEND_OVERLAY, IMB_BLEND_PINLIGHT, IMB_BLEND_SATURATION, IMB_BLEND_SCREEN, IMB_BLEND_SOFTLIGHT, IMB_BLEND_SUB, and IMB_BLEND_VIVIDLIGHT.
Referenced by blender::ed::sculpt_paint::expand::colors_update_task(), blender::ed::sculpt_paint::color::do_paint_brush_task(), do_projectpaint_clone_f(), do_projectpaint_draw_f(), do_projectpaint_mask_f(), do_projectpaint_thread(), blender::ed::sculpt_paint::paint::image::PaintingKernel< ImageBuffer >::paint(), paint_2d_bucket_fill(), and paint_2d_gradient_fill().
In-place image crop.
Definition at line 240 of file rectop.cc.
References BLI_assert, BLI_rcti_size_x(), BLI_rcti_size_y(), ImBuf::byte_buffer, ImBufByteBuffer::data, ImBufFloatBuffer::data, ImBuf::float_buffer, rect_crop_16bytes(), rect_crop_4bytes(), ImBuf::x, rcti::xmax, rcti::xmin, ImBuf::y, rcti::ymax, and rcti::ymin.
Referenced by py_imbuf_crop(), and screenshot_exec().
In-place size setting (caller must fill in buffer contents).
Definition at line 287 of file rectop.cc.
References BLI_assert, ImBuf::byte_buffer, ImBufByteBuffer::data, ImBufFloatBuffer::data, ImBuf::float_buffer, rect_realloc_16bytes(), rect_realloc_4bytes(), ImBuf::x, and ImBuf::y.
Referenced by blender::compositor::PreviewOperation::init_execution(), blender::bke::node_preview_verify(), and ubuf_ensure_compat_ibuf().
| void IMB_rectblend | ( | ImBuf * | dbuf, |
| const ImBuf * | obuf, | ||
| const ImBuf * | sbuf, | ||
| ushort * | dmask, | ||
| const ushort * | curvemask, | ||
| const ushort * | 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 ) |
Definition at line 494 of file rectop.cc.
References blend_color_add_alpha_byte(), blend_color_add_alpha_float(), blend_color_add_byte(), blend_color_add_float(), blend_color_burn_byte(), blend_color_burn_float(), blend_color_color_byte(), blend_color_color_float(), blend_color_darken_byte(), blend_color_darken_float(), blend_color_difference_byte(), blend_color_difference_float(), blend_color_dodge_byte(), blend_color_dodge_float(), blend_color_erase_alpha_byte(), blend_color_erase_alpha_float(), blend_color_exclusion_byte(), blend_color_exclusion_float(), blend_color_hardlight_byte(), blend_color_hardlight_float(), blend_color_hue_byte(), blend_color_hue_float(), blend_color_interpolate_byte(), blend_color_interpolate_float(), blend_color_lighten_byte(), blend_color_lighten_float(), blend_color_linearburn_byte(), blend_color_linearburn_float(), blend_color_linearlight_byte(), blend_color_linearlight_float(), blend_color_luminosity_byte(), blend_color_luminosity_float(), blend_color_mix_byte(), blend_color_mix_float(), blend_color_mul_byte(), blend_color_mul_float(), blend_color_overlay_byte(), blend_color_overlay_float(), blend_color_pinlight_byte(), blend_color_pinlight_float(), blend_color_saturation_byte(), blend_color_saturation_float(), blend_color_screen_byte(), blend_color_screen_float(), blend_color_softlight_byte(), blend_color_softlight_float(), blend_color_sub_byte(), blend_color_sub_float(), blend_color_vividlight_byte(), blend_color_vividlight_float(), ImBuf::byte_buffer, ImBuf::channels, ImBufByteBuffer::data, ImBufFloatBuffer::data, divide_round_i(), float, ImBuf::float_buffer, IMB_BLEND_ADD, IMB_BLEND_ADD_ALPHA, IMB_BLEND_COLOR, IMB_BLEND_COLORBURN, IMB_BLEND_COLORDODGE, IMB_BLEND_COPY, IMB_BLEND_COPY_ALPHA, IMB_BLEND_COPY_RGB, IMB_BLEND_DARKEN, IMB_BLEND_DIFFERENCE, IMB_BLEND_ERASE_ALPHA, IMB_BLEND_EXCLUSION, IMB_BLEND_HARDLIGHT, IMB_BLEND_HUE, IMB_BLEND_INTERPOLATE, IMB_BLEND_LIGHTEN, IMB_BLEND_LINEARBURN, IMB_BLEND_LINEARLIGHT, IMB_BLEND_LUMINOSITY, IMB_BLEND_MIX, IMB_BLEND_MUL, IMB_BLEND_OVERLAY, IMB_BLEND_PINLIGHT, IMB_BLEND_SATURATION, IMB_BLEND_SCREEN, IMB_BLEND_SOFTLIGHT, IMB_BLEND_SUB, IMB_BLEND_VIVIDLIGHT, imb_rectclip3(), mask(), min_ff(), mul_v4_v4fl(), ImBuf::x, and x.
Referenced by IMB_rectblend_threaded(), IMB_rectcpy(), paint_2d_do_making_brush(), paint_2d_lift_clone(), paint_2d_lift_smear(), and rectblend_thread_do().
| void IMB_rectblend_threaded | ( | ImBuf * | dbuf, |
| const ImBuf * | obuf, | ||
| const ImBuf * | sbuf, | ||
| ushort * | dmask, | ||
| const ushort * | curvemask, | ||
| const ushort * | 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 ) |
Definition at line 992 of file rectop.cc.
References data, RectBlendThreadData::dbuf, IMB_processor_apply_threaded_scanlines(), IMB_rectblend(), and rectblend_thread_do().
Referenced by paint_2d_op().
| void IMB_rectclip | ( | ImBuf * | dbuf, |
| const ImBuf * | sbuf, | ||
| int * | destx, | ||
| int * | desty, | ||
| int * | srcx, | ||
| int * | srcy, | ||
| int * | width, | ||
| int * | height ) |
Definition at line 306 of file rectop.cc.
References ImBuf::x, and ImBuf::y.
Referenced by brush_painter_imbuf_partial_update(), brush_painter_mask_imbuf_partial_update(), ED_imapaint_dirty_region(), imapaint_region_tiles(), paint_2d_lift_clone(), paint_2d_lift_soften(), paint_2d_torus_split_region(), and blender::ed::sculpt_paint::paint::image::undo_region_tiles().
|
static |
Definition at line 368 of file rectop.cc.
References ImBuf::x, and ImBuf::y.
Referenced by IMB_rectblend().
| void IMB_rectcpy | ( | ImBuf * | dbuf, |
| const ImBuf * | sbuf, | ||
| int | destx, | ||
| int | desty, | ||
| int | srcx, | ||
| int | srcy, | ||
| int | width, | ||
| int | height ) |
Definition at line 463 of file rectop.cc.
References IMB_BLEND_COPY, and IMB_rectblend().
Referenced by accessor_get_ibuf(), BKE_tracking_get_search_imbuf(), ED_image_paint_tile_push(), ptile_restore_runtime_map(), RE_layer_load_from_file(), utile_init_from_imbuf(), and utile_restore().
Replace pixels of entire image with solid color.
| drect | An image to be filled with color. It must be 4 channel image. |
| col | RGBA color, which is assigned directly to both byte (via scaling) and float buffers. |
Definition at line 1051 of file rectop.cc.
References ImBuf::byte_buffer, col, ImBufByteBuffer::data, ImBufFloatBuffer::data, ImBuf::float_buffer, int, ImBuf::x, and ImBuf::y.
Referenced by blender::io::usd::cache_image_color(), blender::ed::object::clear_single_image(), create_missing_media_image(), IMB_font_preview(), IMB_thumb_load_font(), and RE_bake_ibuf_clear().
Definition at line 1259 of file rectop.cc.
References ImBuf::byte_buffer, ImBuf::channels, ImBufByteBuffer::data, ImBufFloatBuffer::data, ImBuf::float_buffer, ImBuf::x, and ImBuf::y.
Referenced by bake_ibuf_filter(), imb_handle_alpha(), RE_bake_margin(), and sequencer_make_scope().
| void IMB_rectfill_area | ( | ImBuf * | ibuf, |
| const float | col[4], | ||
| int | x1, | ||
| int | y1, | ||
| int | x2, | ||
| int | y2, | ||
| ColorManagedDisplay * | display ) |
Blend pixels of image area with solid color.
For images with uchar buffer use color matching image color-space. For images with float buffer use color display color-space. If display color-space can not be referenced, use color in SRGB color-space.
| ibuf | an image to be filled with color. It must be 4 channel image. |
| col | RGBA color. |
| x1,y1,x2,y2 | (x1, y1) defines starting point of the rectangular area to be filled, (x2, y2) is the end point. Note that values are allowed to be loosely ordered, which means that x2 is allowed to be lower than x1, as well as y2 is allowed to be lower than y1. No matter the order the area between x1 and x2, and y1 and y2 is filled. |
| display | color-space reference for display space. |
Definition at line 1241 of file rectop.cc.
References buf_rectfill_area(), ImBuf::byte_buffer, col, ImBufByteBuffer::data, ImBufFloatBuffer::data, ImBuf::float_buffer, ImBuf::x, and ImBuf::y.
Referenced by ui_tooltip_data_from_button_or_extra_icon().
| void IMB_rectfill_area_replace | ( | const ImBuf * | ibuf, |
| const float | col[4], | ||
| int | x1, | ||
| int | y1, | ||
| int | x2, | ||
| int | y2 ) |
Replace pixels of image area with solid color.
| ibuf | an image to be filled with color. It must be 4 channel image. |
| col | RGBA color, which is assigned directly to both byte (via scaling) and float buffers. |
| x1,y1,x2,y2 | (x1, y1) defines starting point of the rectangular area to be filled, (x2, y2) is the end point. Note that values are allowed to be loosely ordered, which means that x2 is allowed to be lower than x1, as well as y2 is allowed to be lower than y1. No matter the order the area between x1 and x2, and y1 and y2 is filled. |
Definition at line 1083 of file rectop.cc.
References BLI_assert, ImBuf::byte_buffer, ImBuf::channels, CLAMP, col, ImBufByteBuffer::data, ImBufFloatBuffer::data, ImBuf::float_buffer, ImBuf::x, x, and ImBuf::y.
Definition at line 223 of file rectop.cc.
References BLI_rcti_size_x(), BLI_rcti_size_y(), MEM_reallocN, rcti::xmin, and rcti::ymin.
Referenced by IMB_rect_crop().
Definition at line 206 of file rectop.cc.
References BLI_rcti_size_x(), BLI_rcti_size_y(), MEM_reallocN, rcti::xmin, and rcti::ymin.
Referenced by IMB_rect_crop().
|
static |
Definition at line 278 of file rectop.cc.
References MEM_freeN(), and MEM_mallocN.
Referenced by IMB_rect_size_set().
|
static |
Re-allocate buffers at a new size.
Definition at line 269 of file rectop.cc.
References MEM_freeN(), and MEM_mallocN.
Referenced by IMB_rect_size_set().
|
static |
Definition at line 969 of file rectop.cc.
References IMB_rectblend().
Referenced by IMB_rectblend_threaded().