29 uchar *rect_byte,
float *rect_float,
int width,
int height,
const float color[4])
33 if (rect_float !=
nullptr) {
34 float *dst = rect_float + i_range.
first() * 4;
35 for ([[maybe_unused]]
const int64_t i : i_range) {
40 if (rect_byte !=
nullptr) {
44 for ([[maybe_unused]]
const int64_t i : i_range) {
56 uchar *rect,
float *rect_float,
int width,
int height,
int offset)
60 const int checker_size = 32;
61 const int checker_size_half = checker_size / 2;
63 uchar *rect_orig = rect;
64 float *rect_float_orig = rect_float;
66 float hsv[3] = {0.0f, 0.9f, 0.9f};
69 float dark_linear_color = 0.0f, bright_linear_color = 0.0f;
70 if (rect_float !=
nullptr) {
76 for (
int y = offset;
y < height + offset;
y++) {
79 for (
int x = 0;
x < width;
x++) {
80 if (
x % checker_size == 0) {
86 rect_float[0] = rect_float[1] = rect_float[2] = dark_linear_color;
90 rect_float[0] = rect_float[1] = rect_float[2] = bright_linear_color;
97 rect[0] = rect[1] = rect[2] = 64;
101 rect[0] = rect[1] = rect[2] = 150;
110 rect_float = rect_float_orig;
113 for (
int y = offset;
y < height + offset;
y++) {
114 float hoffs = 0.125f *
floorf(
y / checker_size);
116 for (
int x = 0;
x < width;
x++) {
117 float h = 0.125f *
floorf(
x / checker_size);
122 if (((test_x =
abs((
x % checker_size) - checker_size_half)) < 4) &&
123 ((test_y =
abs((
y % checker_size) - checker_size_half)) < 4) &&
124 ((test_x < 1) || (test_y < 1)))
130 rect[0] = char(rgb[0] * 255.0f);
131 rect[1] = char(rgb[1] * 255.0f);
132 rect[2] = char(rgb[2] * 255.0f);
138 rect_float[3] = 1.0f;
156 uchar *dst_byte = (rect !=
nullptr) ? (rect + offset) :
nullptr;
157 float *dst_float = (rect_float !=
nullptr) ? (rect_float + offset) :
nullptr;
164#define BLEND_FLOAT(real, add) (real + add <= 1.0f) ? (real + add) : 1.0f
165#define BLEND_CHAR(real, add) \
166 ((real + char(add * 255.0f)) <= 255) ? (real + char(add * 255.0f)) : 255
169 uchar *rect,
float *rect_float,
int width,
int height,
int offset,
int total_height)
172 float hsv[3], rgb[3];
177 hue_step = std::max(hue_step, 8);
179 for (
y = offset;
y < height + offset;
y++) {
181 hsv[2] = 0.1 + (
y * (0.4 / total_height));
183 for (
x = 0;
x < width;
x++) {
184 hsv[0] =
float(
double(
x / hue_step) * 1.0 / width * hue_step);
188 rect[0] = char(rgb[0] * 255.0f);
189 rect[1] = char(rgb[1] * 255.0f);
190 rect[2] = char(rgb[2] * 255.0f);
198 rect_float[3] = 1.0f;
207 uchar *rect,
float *rect_float,
int width,
int height,
int size,
float blend,
int offset)
210 float blend_half = blend * 0.5f;
212 for (
y = offset;
y < height + offset;
y++) {
213 for (
x = 0;
x < width;
x++) {
214 if (((
y / size) % 2 == 1 && (
x / size) % 2 == 1) ||
215 ((
y / size) % 2 == 0 && (
x / size) % 2 == 0))
229 rect_float[3] = 1.0f;
236 rect[0] = char(
BLEND_CHAR(rect[0], blend_half));
237 rect[1] = char(
BLEND_CHAR(rect[1], blend_half));
238 rect[2] = char(
BLEND_CHAR(rect[2], blend_half));
244 rect_float[0] =
BLEND_FLOAT(rect_float[0], blend_half);
245 rect_float[1] =
BLEND_FLOAT(rect_float[1], blend_half);
246 rect_float[2] =
BLEND_FLOAT(rect_float[2], blend_half);
247 rect_float[3] = 1.0f;
257 uchar *rect,
float *rect_float,
int width,
int height,
float blend,
int offset)
260 for (
y = offset;
y < height + offset;
y++) {
261 for (
x = 0;
x < width;
x++) {
262 if (((
y % 32) == 0) || ((
x % 32) == 0) ||
x == 0) {
275 rect_float[3] = 1.0f;
295 uchar *rect,
float *rect_float,
int width,
int height,
int step,
int outline)
299 char text[3] = {
'A',
'1',
'\0'};
306 BLF_buffer(mono, rect_float, rect, width, height, 4,
nullptr);
308 const float text_color[4] = {0.0, 0.0, 0.0, 1.0};
309 const float text_outline[4] = {1.0, 1.0, 1.0, 1.0};
311 const char char_array[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
313 const int char_num =
sizeof(char_array) - 1;
315 int first_char_index = 0;
316 for (
y = 0;
y < height;
y +=
step) {
317 text[0] = char_array[first_char_index];
319 int second_char_index = 27;
320 for (
x = 0;
x < width;
x +=
step) {
321 text[1] = char_array[second_char_index];
339 BLF_position(mono, pen_x - outline, pen_y - outline, 0.0);
341 BLF_position(mono, pen_x + outline, pen_y + outline, 0.0);
343 BLF_position(mono, pen_x - outline, pen_y + outline, 0.0);
345 BLF_position(mono, pen_x + outline, pen_y - outline, 0.0);
352 second_char_index = (second_char_index + 1) % char_num;
354 first_char_index = (first_char_index + 1) % char_num;
358 BLF_buffer(mono,
nullptr,
nullptr, 0, 0, 4,
nullptr);
362 uchar *rect,
float *rect_float,
int width,
int height,
int offset,
int total_height)
376 uchar *dst_byte = (rect !=
nullptr) ? (rect + offset) :
nullptr;
377 float *dst_float = (rect_float !=
nullptr) ? (rect_float + offset) :
nullptr;
379 dst_byte, dst_float, width, y_range.
size(), y_range.
first(), height);
384 if (rect_float !=
nullptr) {
constexpr int64_t first() const
constexpr int64_t size() const
constexpr IndexRange()=default
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
#define BLEND_FLOAT(real, add)
#define BLEND_CHAR(real, add)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, const float color[4])
void IMB_buffer_float_rgba_srgb_to_linear(float *buffer, int width, int height)
static void image_buf_fill_checker_slice(uchar *rect, float *rect_float, int width, int height, int offset)
void BLF_position(int fontid, float x, float y, float z)
float srgb_to_linearrgb(float c)
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int channel_count, const ColorSpace *colorspace)
MINLINE int power_of_2_max_i(int n)
static void checker_board_color_prepare_slice(uchar *rect, float *rect_float, int width, int height, int offset, int total_height)
static void checker_board_color_fill(uchar *rect, float *rect_float, int width, int height, int offset, int total_height)
void BLF_size(int fontid, float size)
BLI_INLINE void IMB_colormanagement_rec709_to_scene_linear(float scene_linear[3], const float rec709[3])
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
BLI_INLINE void IMB_colormanagement_srgb_to_scene_linear_v3(float scene_linear[3], const float srgb[3])
static void checker_board_color_tint(uchar *rect, float *rect_float, int width, int height, int size, float blend, int offset)
void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int width, int height)
void BLF_buffer_col(int fontid, const float srgb_color[4]) ATTR_NONNULL(2)
static void checker_board_grid_fill(uchar *rect, float *rect_float, int width, int height, float blend, int offset)
void BLF_draw_buffer(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
MINLINE void copy_v4_v4(float r[4], const float a[4])
static void checker_board_text(uchar *rect, float *rect_float, int width, int height, int step, int outline)
void BKE_image_buf_fill_checker_color(unsigned char *rect, float *rect_float, int width, int height)
MINLINE void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float