Blender
V3.3
|
#include <stdlib.h>
#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.h"
#include "IMB_imbuf_types.h"
#include "IMB_colormanagement.h"
#include "MEM_guardedalloc.h"
Go to the source code of this file.
Classes | |
struct | RectBlendThreadData |
Typedefs | |
typedef void(* | IMB_blend_func) (unsigned char *dst, const unsigned char *src1, const unsigned char *src2) |
typedef void(* | IMB_blend_func_float) (float *dst, const float *src1, const float *src2) |
typedef struct RectBlendThreadData | RectBlendThreadData |
Functions | |
void | IMB_blend_color_byte (unsigned char dst[4], const unsigned char src1[4], const unsigned char 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, 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) |
static void | rectblend_thread_do (void *data_v, int scanline) |
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_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 (unsigned char *rect, float *rectf, int width, int height, const float col[4], struct 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, struct 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]) |
typedef void(* IMB_blend_func) (unsigned char *dst, const unsigned char *src1, const unsigned char *src2) |
typedef struct RectBlendThreadData RectBlendThreadData |
void buf_rectfill_area | ( | unsigned char * | rect, |
float * | rectf, | ||
int | width, | ||
int | height, | ||
const float | col[4], | ||
struct 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 1128 of file rectop.c.
References Freestyle::a, CLAMP, col, copy_v4_v4(), fb(), height, IMB_colormanagement_display_to_scene_linear_v3(), srgb_to_linearrgb_v4(), SWAP, unit_float_to_uchar_clamp(), width, x2, and y1.
Referenced by BKE_image_stamp_buf(), and IMB_rectfill_area().
void IMB_blend_color_byte | ( | unsigned char | dst[4], |
const unsigned char | src1[4], | ||
const unsigned char | src2[4], | ||
IMB_BlendMode | mode | ||
) |
Definition at line 24 of file rectop.c.
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 112 of file rectop.c.
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 do_paint_brush_task_cb_ex(), 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(), paint_2d_gradient_fill(), and sculpt_expand_colors_update_task_cb().
Definition at line 237 of file rectop.c.
References BLI_assert, BLI_rcti_size_x(), BLI_rcti_size_y(), ImBuf::rect, rect_crop_16bytes(), rect_crop_4bytes(), ImBuf::rect_float, ImBuf::x, rcti::xmax, rcti::xmin, ImBuf::y, rcti::ymax, rcti::ymin, ImBuf::zbuf, and ImBuf::zbuf_float.
In-place size setting (caller must fill in buffer contents).
Definition at line 285 of file rectop.c.
References BLI_assert, ImBuf::rect, ImBuf::rect_float, rect_realloc_16bytes(), rect_realloc_4bytes(), size(), ImBuf::x, ImBuf::y, ImBuf::zbuf, and ImBuf::zbuf_float.
Referenced by ubuf_ensure_compat_ibuf().
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 | ||
) |
Definition at line 495 of file rectop.c.
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::channels, divide_round_i(), float(), height, 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(), NULL, ImBuf::rect, ImBuf::rect_float, src, width, x, and ImBuf::x.
Referenced by IMB_rectblend_threaded(), IMB_rectcpy(), and rectblend_thread_do().
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 | ||
) |
Definition at line 991 of file rectop.c.
References data, height, IMB_processor_apply_threaded_scanlines(), IMB_rectblend(), rectblend_thread_do(), and width.
void IMB_rectcpy | ( | ImBuf * | dbuf, |
const ImBuf * | sbuf, | ||
int | destx, | ||
int | desty, | ||
int | srcx, | ||
int | srcy, | ||
int | width, | ||
int | height | ||
) |
Definition at line 462 of file rectop.c.
References height, IMB_BLEND_COPY, IMB_rectblend(), NULL, and width.
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 1050 of file rectop.c.
References col, ImBuf::rect, ImBuf::rect_float, ImBuf::x, and ImBuf::y.
Referenced by clear_single_image(), IMB_thumb_load_font(), and RE_bake_ibuf_clear().
Definition at line 1262 of file rectop.c.
References ImBuf::channels, ImBuf::rect, ImBuf::rect_float, ImBuf::x, and ImBuf::y.
Referenced by bake_ibuf_filter(), imb_handle_alpha(), and RE_bake_margin().
void IMB_rectfill_area | ( | struct ImBuf * | ibuf, |
const float | col[4], | ||
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
struct 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 1239 of file rectop.c.
References buf_rectfill_area(), col, ImBuf::rect, ImBuf::rect_float, ImBuf::x, x2, ImBuf::y, and y1.
void IMB_rectfill_area_replace | ( | const ImBuf * | ibuf, |
const float | col[4], | ||
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2 | ||
) |
Definition at line 1082 of file rectop.c.
References BLI_assert, ImBuf::channels, CLAMP, col, height, offset, ImBuf::rect, ImBuf::rect_float, SWAP, width, x, ImBuf::x, x2, y, ImBuf::y, and y1.
Definition at line 220 of file rectop.c.
References BLI_rcti_size_x(), BLI_rcti_size_y(), MEM_reallocN, NULL, src, rcti::xmin, y, and rcti::ymin.
Referenced by IMB_rect_crop().
Definition at line 203 of file rectop.c.
References BLI_rcti_size_x(), BLI_rcti_size_y(), MEM_reallocN, NULL, src, rcti::xmin, y, and rcti::ymin.
Referenced by IMB_rect_crop().
Definition at line 276 of file rectop.c.
References MEM_freeN, MEM_mallocN, NULL, and size().
Referenced by IMB_rect_size_set().
Re-allocate buffers at a new size.
Definition at line 267 of file rectop.c.
References MEM_freeN, MEM_mallocN, NULL, and size().
Referenced by IMB_rect_size_set().
Definition at line 968 of file rectop.c.
References data, and IMB_rectblend().
Referenced by IMB_rectblend_threaded().