82 float r_col_linear[4])
106 float r_col_linear[4])
108 uint col_accum_ub[4] = {0, 0, 0, 0};
112 for (coord[0] = rect->
xmin; coord[0] <= rect->
xmax; coord[0]++) {
113 for (coord[1] = rect->
ymin; coord[1] <= rect->
ymax; coord[1]++) {
114 float col_temp_fl[4];
115 uchar col_temp_ub[4];
118 col_accum_ub[0] +=
uint(col_temp_ub[0]);
119 col_accum_ub[1] +=
uint(col_temp_ub[1]);
120 col_accum_ub[2] +=
uint(col_temp_ub[2]);
121 col_accum_ub[3] +=
uint(col_temp_ub[3]);
125 mul_v4_fl(r_col_linear, 1.0 /
float(col_tot));
127 r_col[0] = std::min<uchar>(col_accum_ub[0] / col_tot, 255);
128 r_col[1] = std::min<uchar>(col_accum_ub[1] / col_tot, 255);
129 r_col[2] = std::min<uchar>(col_accum_ub[2] / col_tot, 255);
130 r_col[3] = std::min<uchar>(col_accum_ub[3] / col_tot, 255);
138 for (coord[0] = rect->
xmin; coord[0] <= rect->
xmax; coord[0]++) {
139 for (coord[1] = rect->
ymin; coord[1] <= rect->
ymax; coord[1]++) {
140 float col_temp_fl[4];
171 if (ibuf ==
nullptr) {
178 offset[0] =
image->runtime.backdrop_offset[0];
179 offset[1] =
image->runtime.backdrop_offset[1];
181 int x =
int(uv[0] * ibuf->
x),
y =
int(uv[1] * ibuf->
y);
183 if (
x >= offset[0] &&
y >= offset[1] &&
x < (ibuf->
x + offset[0]) &&
y < (ibuf->
y + offset[1])) {
192 info->
colp =
nullptr;
193 info->
colfp =
nullptr;
204 sample_rect.
xmax = sample_rect.
xmin;
205 sample_rect.
ymax = sample_rect.
ymin;
222 info->
colf[3] = 1.0f;
227 info->
colf[3] = 1.0f;
236 if (curve_mapping && ibuf->
channels == 4) {
244 else if (
point == 0) {
256 node_curvemap_sample(fp);
257 for (area =
G.curscreen->areabase.first; area; area = area->
next) {
259 areawinset(area->win);
260 scrarea_do_windraw(area);
263 node_curvemap_sample(
nullptr);
284 if (ibuf ==
nullptr) {
298 if (fx >= 0.0f && fy >= 0.0f && fx < ibuf->
x && fy < ibuf->
y) {
308 info->
colp =
nullptr;
309 info->
colfp =
nullptr;
314 info->
col[0] = cp[0];
315 info->
col[1] = cp[1];
316 info->
col[2] = cp[2];
317 info->
col[3] = cp[3];
335 info->
colf[0] = fp[0];
336 info->
colf[1] = fp[1];
337 info->
colf[2] = fp[2];
338 info->
colf[3] = fp[3];
359 if (area ==
nullptr) {
414 const float color[3] = {1, 1, 1};
490 switch (event->
type) {
514 if (area ==
nullptr) {
SpaceImage * CTX_wm_space_image(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Object * CTX_data_edit_object(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])
MINLINE int max_ii(int a, int b)
void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
MINLINE void mul_v4_fl(float r[4], float f)
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 void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4])
MINLINE void zero_v4(float r[4])
void BLI_rctf_init_pt_radius(struct rctf *rect, const float xy[2], float size)
void ED_space_image_release_buffer(SpaceImage *sima, ImBuf *ibuf, void *lock)
ImBuf * ED_space_image_acquire_buffer(SpaceImage *sima, void **r_lock, int tile)
bool ED_space_image_has_buffer(SpaceImage *sima)
bool ED_space_image_show_uvedit(const SpaceImage *sima, Object *obedit)
void ED_image_draw_info(Scene *scene, ARegion *region, bool color_manage, bool use_default_view, int channels, int x, int y, const unsigned char cp[4], const float fp[4], const float linearcol[4])
Image * ED_space_image(const SpaceImage *sima)
bool ED_space_image_show_cache_and_mval_over(const SpaceImage *sima, ARegion *region, const int mval[2])
void ED_area_tag_redraw(ScrArea *area)
void * ED_region_draw_cb_activate(ARegionType *art, void(*draw)(const bContext *, ARegion *, void *), void *customdata, int type)
bool ED_region_draw_cb_exit(ARegionType *art, void *handle)
#define REGION_DRAW_POST_PIXEL
void ED_imbuf_sample_draw(const bContext *C, ARegion *region, void *arg_info)
@ GPU_SHADER_3D_UNIFORM_COLOR
void GPU_line_width(float width)
void GPU_logic_op_xor_set(bool enable)
void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], bool predivide, ColorSpace *colorspace)
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 Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves 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 Invert a color
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
void UI_view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
void ED_imbuf_sample_exit(bContext *C, wmOperator *op)
static void image_sample_rect_color_ubyte(const ImBuf *ibuf, const rcti *rect, uchar r_col[4], float r_col_linear[4])
static void ed_imbuf_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
void ED_imbuf_sample_cancel(bContext *C, wmOperator *op)
static void sequencer_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
static void image_sample_pixel_color_ubyte(const ImBuf *ibuf, const int coord[2], uchar r_col[4], float r_col_linear[4])
static void image_sample_rect_color_float(ImBuf *ibuf, const rcti *rect, float r_col[4])
int ED_imbuf_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void ED_imbuf_sample_draw(const bContext *C, ARegion *region, void *arg_info)
bool ED_imbuf_sample_poll(bContext *C)
static void image_sample_pixel_color_float(ImBuf *ibuf, const int coord[2], float r_col[4])
static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
int ED_imbuf_sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void IMB_freeImBuf(ImBuf *)
ccl_global const KernelWorkTile * tile
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
VecBase< float, 2 > float2
void SEQ_render_pixel_from_sequencer_space_v4(Scene *scene, float pixel[4])
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
int RNA_int_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
Editing * SEQ_editing_get(const Scene *scene)
ImBuf * sequencer_ibuf_get(const bContext *C, int timeline_frame, int frame_ofs, const char *viewname)
struct ARegionType * type
struct CurveMapping * curve_mapping
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
ColorManagedViewSettings view_settings
struct wmEvent * eventstate
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)