|
Blender V5.0
|
#include <algorithm>#include <cstdlib>#include "BLI_math_base.h"#include "BLI_math_color_blend.h"#include "BLI_math_vector.h"#include "BLI_rect.h"#include "BLI_task.hh"#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.
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) |
| 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 (ImBuf *ibuf, const float scene_linear_color[4], int x1, int y1, int x2, int y2) |
| 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 IMB_blend_color_byte | ( | uchar | dst[4], |
| const uchar | src1[4], | ||
| const uchar | src2[4], | ||
| IMB_BlendMode | mode ) |
Definition at line 28 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 116 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 241 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(), screenshot_exec(), blender::ed::asset::screenshot_preview_exec(), and blender::ed::asset::take_screenshot_crop().
In-place size setting (caller must fill in buffer contents).
Definition at line 288 of file rectop.cc.
References BLI_assert, ImBuf::byte_buffer, ImBufByteBuffer::data, ImBufFloatBuffer::data, ImBuf::float_buffer, rect_realloc_16bytes(), rect_realloc_4bytes(), size(), ImBuf::x, and ImBuf::y.
Referenced by 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 475 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(), and paint_2d_lift_smear().
| 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 938 of file rectop.cc.
References IndexRange::first(), IMB_rectblend(), blender::threading::parallel_for(), and IndexRange::size().
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 307 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 361 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 444 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 978 of file rectop.cc.
References ImBuf::byte_buffer, col, ImBufByteBuffer::data, ImBufFloatBuffer::data, ImBuf::float_buffer, IMB_get_pixel_count(), num, and unit_float_to_uchar_clamp_v4.
Referenced by blender::io::usd::cache_image_color(), blender::ed::object::clear_single_image(), blender::seq::create_missing_media_image(), IMB_font_preview(), IMB_thumb_load_font(), and RE_bake_ibuf_clear().
Definition at line 1122 of file rectop.cc.
References ImBuf::byte_buffer, ImBuf::channels, ImBufByteBuffer::data, ImBufFloatBuffer::data, ImBuf::float_buffer, i, and IMB_get_pixel_count().
Referenced by imb_handle_colorspace_and_alpha(), and RE_bake_margin().
| void IMB_rectfill_area | ( | ImBuf * | ibuf, |
| const float | scene_linear_color[4], | ||
| int | x1, | ||
| int | y1, | ||
| int | x2, | ||
| int | y2 ) |
Blend pixels of image area with solid color.
| ibuf | an image to be filled with color. It must be 4 channel image. |
| scene_linear_color | RGBA color in scene linear colorspace. For byte buffers, this is converted to the byte buffer colorspace. |
| 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. |
| colorspace | color-space reference for display space. |
Definition at line 1007 of file rectop.cc.
References BLI_assert, ImBuf::byte_buffer, CLAMP, col, ImBufByteBuffer::colorspace, copy_v3_v3(), ImBufByteBuffer::data, ImBufFloatBuffer::data, fb(), ImBuf::float_buffer, i, IMB_colormanagement_scene_linear_to_colorspace_v3(), IMB_colormanagement_scene_linear_to_srgb_v3(), unit_float_to_uchar_clamp(), ImBuf::x, and ImBuf::y.
Referenced by BKE_image_stamp_buf(), and UI_tooltip_color_field_add().
|
static |
Definition at line 224 of file rectop.cc.
References BLI_rcti_size_x(), BLI_rcti_size_y(), MEM_reallocN, rcti::xmin, y, and rcti::ymin.
Referenced by IMB_rect_crop().
|
static |
Definition at line 207 of file rectop.cc.
References BLI_rcti_size_x(), BLI_rcti_size_y(), MEM_reallocN, rcti::xmin, y, and rcti::ymin.
Referenced by IMB_rect_crop().
|
static |
Definition at line 279 of file rectop.cc.
References MEM_freeN(), MEM_malloc_arrayN(), and size().
Referenced by IMB_rect_size_set().
|
static |
Re-allocate buffers at a new size.
Definition at line 270 of file rectop.cc.
References MEM_freeN(), MEM_malloc_arrayN(), and size().
Referenced by IMB_rect_size_set().