85 float r_col_linear[4])
87 const uchar *cp = ibuf->
byte_data() + 4 * (coord[1] * ibuf->
x + coord[0]);
109 float r_col_linear[4])
111 uint col_accum_ub[4] = {0, 0, 0, 0};
115 for (coord[0] = rect->
xmin; coord[0] <= rect->
xmax; coord[0]++) {
116 for (coord[1] = rect->
ymin; coord[1] <= rect->
ymax; coord[1]++) {
117 float col_temp_fl[4];
118 uchar col_temp_ub[4];
121 col_accum_ub[0] +=
uint(col_temp_ub[0]);
122 col_accum_ub[1] +=
uint(col_temp_ub[1]);
123 col_accum_ub[2] +=
uint(col_temp_ub[2]);
124 col_accum_ub[3] +=
uint(col_temp_ub[3]);
128 mul_v4_fl(r_col_linear, 1.0 /
float(col_tot));
130 r_col[0] = std::min<uchar>(col_accum_ub[0] / col_tot, 255);
131 r_col[1] = std::min<uchar>(col_accum_ub[1] / col_tot, 255);
132 r_col[2] = std::min<uchar>(col_accum_ub[2] / col_tot, 255);
133 r_col[3] = std::min<uchar>(col_accum_ub[3] / col_tot, 255);
141 for (coord[0] = rect->
xmin; coord[0] <= rect->
xmax; coord[0]++) {
142 for (coord[1] = rect->
ymin; coord[1] <= rect->
ymax; coord[1]++) {
143 float col_temp_fl[4];
174 if (ibuf ==
nullptr) {
183 int x = int(uv[0] * ibuf->
x),
y = int(uv[1] * ibuf->
y);
185 if (
x >= offset[0] &&
y >= offset[1] &&
x < (ibuf->
x + offset[0]) &&
y < (ibuf->
y + offset[1])) {
194 info->
colp =
nullptr;
195 info->
colfp =
nullptr;
223 info->
colf[3] = 1.0f;
228 info->
colf[3] = 1.0f;
237 if (curve_mapping && ibuf->
channels == 4) {
245 else if (point == 0) {
257 node_curvemap_sample(fp);
258 for (area =
G.curscreen->areabase.first; area; area = area->
next) {
260 areawinset(area->win);
261 scrarea_do_windraw(area);
264 node_curvemap_sample(
nullptr);
285 if (ibuf ==
nullptr) {
299 if (fx >= 0.0f && fy >= 0.0f && fx < ibuf->
x && fy < ibuf->
y) {
302 int x = int(fx),
y = int(fy);
309 info->
colp =
nullptr;
310 info->
colfp =
nullptr;
315 info->
col[0] = cp[0];
316 info->
col[1] = cp[1];
317 info->
col[2] = cp[2];
318 info->
col[3] = cp[3];
336 info->
colf[0] = fp[0];
337 info->
colf[1] = fp[1];
338 info->
colf[2] = fp[2];
339 info->
colf[3] = fp[3];
360 if (area ==
nullptr) {
415 const float color[3] = {1, 1, 1};
431 pos, sample_rect_fl.
xmin, sample_rect_fl.
ymin, sample_rect_fl.
xmax, sample_rect_fl.
ymax);
493 switch (event->
type) {
528 if (area ==
nullptr) {
#define REGION_DRAW_POST_PIXEL
Read Blender memory allocation and freeing.
const ccl_global KernelWorkTile * tile
ImBuf * sequencer_ibuf_get(const bContext *C, int timeline_frame, const char *viewname)
Editing * editing_get(const Scene *scene)
void view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
int BKE_image_get_tile_from_pos(Image *ima, const float uv[2], float r_uv[2], float r_ofs[2])
ScrArea * CTX_wm_area(const bContext *C)
MINLINE void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
int RNA_enum_get(PointerRNA *ptr, const char *name)
Scene * CTX_data_sequencer_scene(const bContext *C)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool ED_space_image_show_cache_and_mval_over(const SpaceImage *sima, ARegion *region, const int mval[2])
bool ED_space_image_show_cache(const SpaceImage *sima)
void ED_imbuf_sample_exit(bContext *C, wmOperator *op)
void ED_imbuf_sample_draw(const bContext *C, ARegion *region, void *arg_info)
GPUVertFormat * immVertexFormat()
static void sequencer_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
ImBuf * ED_space_image_acquire_buffer(SpaceImage *sima, void **r_lock, int tile, const bool ensure_host_buffer)
static void image_sample_pixel_color_float(ImBuf *ibuf, const int coord[2], float r_col[4])
int RNA_int_get(PointerRNA *ptr, const char *name)
wmWindow * CTX_wm_window(const bContext *C)
MINLINE int max_ii(int a, int b)
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])
void ED_space_image_release_buffer(SpaceImage *sima, ImBuf *ibuf, void *lock)
void GPU_line_width(float width)
MINLINE void zero_v4(float r[4])
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
static void image_sample_pixel_color_ubyte(const ImBuf *ibuf, const int coord[2], uchar r_col[4], float r_col_linear[4])
void BLI_rctf_init_pt_radius(struct rctf *rect, const float xy[2], float size)
void * ED_region_draw_cb_activate(ARegionType *art, void(*draw)(const bContext *, ARegion *, void *), void *customdata, int type)
static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
void IMB_freeImBuf(ImBuf *ibuf)
VecBase< float, 2 > float2
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
bool ED_region_draw_cb_exit(ARegionType *art, void *handle)
MINLINE void add_v4_v4(float r[4], const float a[4])
void ED_imbuf_sample_cancel(bContext *C, wmOperator *op)
@ GPU_SHADER_3D_UNIFORM_COLOR
Object * CTX_data_edit_object(const bContext *C)
bool ED_space_image_has_buffer(SpaceImage *sima)
static void ed_imbuf_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4])
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], bool predivide, const ColorSpace *colorspace)
void BKE_curvemapping_set_black_white(CurveMapping *cumap, const float black[3], const float white[3])
wmOperatorStatus ED_imbuf_sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void image_sample_rect_color_float(ImBuf *ibuf, const rcti *rect, float r_col[4])
SpaceImage * CTX_wm_space_image(const bContext *C)
wmEventHandler_Op * WM_event_add_modal_handler(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])
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
void ED_area_hud_region_set_padding_flag(ScrArea *area, ARegion *changed_region, const bool set_padding=false)
bool ED_imbuf_sample_poll(bContext *C)
Scene * CTX_data_scene(const bContext *C)
MINLINE void copy_v4_v4(float r[4], const float a[4])
void immUniformColor3fv(const float rgb[3])
void GPU_blend(GPUBlend blend)
MINLINE void mul_v4_fl(float r[4], float f)
MINLINE int min_ii(int a, int b)
ARegion * CTX_wm_region(const bContext *C)
Image * ED_space_image(const SpaceImage *sima)
bool ED_space_image_show_uvedit(const SpaceImage *sima, Object *obedit)
wmOperatorStatus ED_imbuf_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void ED_area_tag_redraw(ScrArea *area)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
bke::ARegionRuntime * runtime
struct CurveMapping * curve_mapping
const ColorSpace * colorspace
const ColorSpace * colorspace
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
const uint8_t * byte_data() const
const float * float_data() const
ColorManagedViewSettings view_settings
ListBaseT< SpaceLink > spacedata
eSpaceSeq_RegionType mainb
struct ARegionType * type
bke::WindowRuntime * runtime