31 uchar *rect,
float *rect_float,
int width,
int height,
const float color[4])
37 for (y = 0; y < height; y++) {
38 for (x = 0; x < width; x++) {
48 for (y = 0; y < height; y++) {
49 for (x = 0; x < width; x++) {
63 const int num_scanlines = 1;
64 size_t offset = size_t(scanline) * data->
width * 4;
65 uchar *rect = (data->rect !=
nullptr) ? (data->rect + offset) :
nullptr;
66 float *rect_float = (data->rect_float !=
nullptr) ? (data->rect_float + offset) :
nullptr;
71 uchar *rect,
float *rect_float,
int width,
int height,
const float color[4])
73 if (
size_t(width) * height < 64 * 64) {
79 data.rect_float = rect_float;
87 uchar *rect,
float *rect_float,
int width,
int height,
int offset)
92 int checkerwidth = 32;
95 uchar *rect_orig = rect;
96 float *rect_float_orig = rect_float;
98 float hsv[3] = {0.0f, 0.9f, 0.9f};
101 float dark_linear_color = 0.0f, bright_linear_color = 0.0f;
102 if (rect_float !=
nullptr) {
108 for (y = offset; y < height + offset; y++) {
109 int dark =
powf(-1.0f,
floorf(y / checkerwidth));
111 for (x = 0; x < width; x++) {
112 if (x % checkerwidth == 0) {
118 rect_float[0] = rect_float[1] = rect_float[2] = dark_linear_color;
119 rect_float[3] = 1.0f;
122 rect_float[0] = rect_float[1] = rect_float[2] = bright_linear_color;
123 rect_float[3] = 1.0f;
129 rect[0] = rect[1] = rect[2] = 64;
133 rect[0] = rect[1] = rect[2] = 150;
142 rect_float = rect_float_orig;
145 for (y = offset; y < height + offset; y++) {
146 float hoffs = 0.125f *
floorf(y / checkerwidth);
148 for (x = 0; x < width; x++) {
149 float h = 0.125f *
floorf(x / checkerwidth);
151 if ((
abs((x % checkerwidth) - (checkerwidth / 2)) < 4) &&
152 (
abs((y % checkerwidth) - (checkerwidth / 2)) < 4))
154 if ((
abs((x % checkerwidth) - (checkerwidth / 2)) < 1) ||
155 (
abs((y % checkerwidth) - (checkerwidth / 2)) < 1))
161 rect[0] = char(rgb[0] * 255.0f);
162 rect[1] = char(rgb[1] * 255.0f);
163 rect[2] = char(rgb[2] * 255.0f);
169 rect_float[3] = 1.0f;
193 size_t offset = size_t(scanline) * data->
width * 4;
194 const int num_scanlines = 1;
195 uchar *rect = (data->rect !=
nullptr) ? (data->rect + offset) :
nullptr;
196 float *rect_float = (data->rect_float !=
nullptr) ? (data->rect_float + offset) :
nullptr;
202 if (
size_t(width) * height < 64 * 64) {
208 data.rect_float = rect_float;
216#define BLEND_FLOAT(real, add) (real + add <= 1.0f) ? (real + add) : 1.0f
217#define BLEND_CHAR(real, add) \
218 ((real + char(add * 255.0f)) <= 255) ? (real + char(add * 255.0f)) : 255
221 uchar *rect,
float *rect_float,
int width,
int height,
int offset,
int total_height)
224 float hsv[3], rgb[3];
233 for (y = offset; y < height + offset; y++) {
235 hsv[2] = 0.1 + (y * (0.4 / total_height));
237 for (x = 0; x < width; x++) {
238 hsv[0] =
float(
double(x / hue_step) * 1.0 / width * hue_step);
242 rect[0] = char(rgb[0] * 255.0f);
243 rect[1] = char(rgb[1] * 255.0f);
244 rect[2] = char(rgb[2] * 255.0f);
251 rect_float[0] = rgb[0];
252 rect_float[1] = rgb[1];
253 rect_float[2] = rgb[2];
254 rect_float[3] = 1.0f;
263 uchar *rect,
float *rect_float,
int width,
int height,
int size,
float blend,
int offset)
266 float blend_half =
blend * 0.5f;
268 for (y = offset; y < height + offset; y++) {
269 for (x = 0; x < width; x++) {
270 if (((y / size) % 2 == 1 && (x / size) % 2 == 1) ||
271 ((y / size) % 2 == 0 && (x / size) % 2 == 0))
285 rect_float[3] = 1.0f;
292 rect[0] = char(
BLEND_CHAR(rect[0], blend_half));
293 rect[1] = char(
BLEND_CHAR(rect[1], blend_half));
294 rect[2] = char(
BLEND_CHAR(rect[2], blend_half));
300 rect_float[0] =
BLEND_FLOAT(rect_float[0], blend_half);
301 rect_float[1] =
BLEND_FLOAT(rect_float[1], blend_half);
302 rect_float[2] =
BLEND_FLOAT(rect_float[2], blend_half);
303 rect_float[3] = 1.0f;
313 uchar *rect,
float *rect_float,
int width,
int height,
float blend,
int offset)
316 for (y = offset; y < height + offset; y++) {
317 for (x = 0; x < width; x++) {
318 if (((y % 32) == 0) || ((x % 32) == 0) || x == 0) {
331 rect_float[3] = 1.0f;
351 uchar *rect,
float *rect_float,
int width,
int height,
int step,
int outline)
355 char text[3] = {
'A',
'1',
'\0'};
364 BLF_buffer(mono, rect_float, rect, width, height,
nullptr);
366 const float text_color[4] = {0.0, 0.0, 0.0, 1.0};
367 const float text_outline[4] = {1.0, 1.0, 1.0, 1.0};
369 const char char_array[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
371 const int char_num =
sizeof(char_array) - 1;
373 int first_char_index = 0;
374 for (y = 0; y < height; y += step) {
375 text[0] = char_array[first_char_index];
377 int second_char_index = 27;
378 for (x = 0; x < width; x += step) {
379 text[1] = char_array[second_char_index];
397 BLF_position(mono, pen_x - outline, pen_y - outline, 0.0);
399 BLF_position(mono, pen_x + outline, pen_y + outline, 0.0);
401 BLF_position(mono, pen_x - outline, pen_y + outline, 0.0);
403 BLF_position(mono, pen_x + outline, pen_y - outline, 0.0);
410 second_char_index = (second_char_index + 1) % char_num;
412 first_char_index = (first_char_index + 1) % char_num;
416 BLF_buffer(mono,
nullptr,
nullptr, 0, 0,
nullptr);
420 uchar *rect,
float *rect_float,
int width,
int height,
int offset,
int total_height)
439 const int num_scanlines = 1;
440 size_t offset = size_t(data->width) * scanline * 4;
441 uchar *rect = (data->rect !=
nullptr) ? (data->rect + offset) :
nullptr;
442 float *rect_float = (data->rect_float !=
nullptr) ? (data->rect_float + offset) :
nullptr;
444 rect, rect_float, data->width, num_scanlines, scanline, data->height);
449 if (
size_t(width) * height < 64 * 64) {
455 data.rect_float = rect_float;
457 data.height = height;
463 if (rect_float !=
nullptr) {
void BLF_size(int fontid, float size)
void BLF_draw_buffer(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
void BLF_buffer_col(int fontid, const float rgba[4]) ATTR_NONNULL(2)
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, ColorManagedDisplay *display)
void BLF_position(int fontid, float x, float y, float z)
MINLINE int power_of_2_max_i(int n)
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
float srgb_to_linearrgb(float c)
void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
MINLINE void copy_v4_v4(float r[4], const float a[4])
void IMB_processor_apply_threaded_scanlines(int total_scanlines, ScanlineThreadFunc do_thread, void *custom_data)
void IMB_buffer_float_from_float_threaded(float *rect_to, const float *rect_from, int channels_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from)
Contains defines and structs used throughout the imbuf module.
#define IB_PROFILE_LINEAR_RGB
draw_view in_light_buf[] float
void BKE_image_buf_fill_checker_color(uchar *rect, float *rect_float, int width, int height)
static void image_buf_fill_color_thread_do(void *data_v, int scanline)
static void image_buf_fill_checker_thread_do(void *data_v, int scanline)
static void checker_board_color_tint(uchar *rect, float *rect_float, int width, int height, int size, float blend, int offset)
static void checker_board_color_prepare_slice(uchar *rect, float *rect_float, int width, int height, int offset, int total_height)
#define BLEND_FLOAT(real, add)
static void checker_board_color_prepare_thread_do(void *data_v, int scanline)
#define BLEND_CHAR(real, add)
static void checker_board_text(uchar *rect, float *rect_float, int width, int height, int step, int outline)
static void checker_board_color_fill(uchar *rect, float *rect_float, int width, int height, int offset, int total_height)
static void image_buf_fill_checker_slice(uchar *rect, float *rect_float, int width, int height, int offset)
static void image_buf_fill_color_slice(uchar *rect, float *rect_float, int width, int height, const float color[4])
void BKE_image_buf_fill_checker(uchar *rect, float *rect_float, int width, int height)
void BKE_image_buf_fill_color(uchar *rect, float *rect_float, int width, int height, const float color[4])
static void checker_board_grid_fill(uchar *rect, float *rect_float, int width, int height, float blend, int offset)
ccl_device_inline int abs(int x)