27 uchar *rect_byte,
float *rect_float,
int width,
int height,
const float color[4])
32 if (rect_float !=
nullptr) {
33 float *dst = rect_float + i_range.
first() * 4;
34 for ([[maybe_unused]]
const int64_t i : i_range) {
39 if (rect_byte !=
nullptr) {
43 for ([[maybe_unused]]
const int64_t i : i_range) {
55 uchar *rect,
float *rect_float,
int width,
int height,
int offset)
59 const int checker_size = 32;
60 const int checker_size_half = checker_size / 2;
62 uchar *rect_orig = rect;
63 float *rect_float_orig = rect_float;
65 float hsv[3] = {0.0f, 0.9f, 0.9f};
68 float dark_linear_color = 0.0f, bright_linear_color = 0.0f;
69 if (rect_float !=
nullptr) {
75 for (
int y = offset;
y < height + offset;
y++) {
78 for (
int x = 0;
x < width;
x++) {
79 if (
x % checker_size == 0) {
85 rect_float[0] = rect_float[1] = rect_float[2] = dark_linear_color;
89 rect_float[0] = rect_float[1] = rect_float[2] = bright_linear_color;
96 rect[0] = rect[1] = rect[2] = 64;
100 rect[0] = rect[1] = rect[2] = 150;
109 rect_float = rect_float_orig;
112 for (
int y = offset;
y < height + offset;
y++) {
113 float hoffs = 0.125f *
floorf(
y / checker_size);
115 for (
int x = 0;
x < width;
x++) {
116 float h = 0.125f *
floorf(
x / checker_size);
121 if (((test_x =
abs((
x % checker_size) - checker_size_half)) < 4) &&
122 ((test_y =
abs((
y % checker_size) - checker_size_half)) < 4) &&
123 ((test_x < 1) || (test_y < 1)))
129 rect[0] = char(rgb[0] * 255.0f);
130 rect[1] = char(rgb[1] * 255.0f);
131 rect[2] = char(rgb[2] * 255.0f);
137 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) ||
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,
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,
nullptr);
362 uchar *rect,
float *rect_float,
int width,
int height,
int offset,
int total_height)
377 uchar *dst_byte = (rect !=
nullptr) ? (rect + offset) :
nullptr;
378 float *dst_float = (rect_float !=
nullptr) ? (rect_float + offset) :
nullptr;
380 dst_byte, dst_float, width, y_range.
size(), y_range.
first(), height);
385 if (rect_float !=
nullptr) {
void BLF_size(int fontid, float size)
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, const ColorSpace *colorspace)
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 srgb_color[4]) ATTR_NONNULL(2)
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])
MINLINE void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
float srgb_to_linearrgb(float c)
MINLINE void copy_v4_v4(float r[4], const float a[4])
BLI_INLINE void IMB_colormanagement_srgb_to_scene_linear_v3(float scene_linear[3], const float srgb[3])
BLI_INLINE void IMB_colormanagement_rec709_to_scene_linear(float scene_linear[3], const float rec709[3])
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)
#define IB_PROFILE_LINEAR_RGB
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
constexpr int64_t first() const
constexpr int64_t size() const
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
void BKE_image_buf_fill_checker_color(uchar *rect, float *rect_float, int width, int height)
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_color(uchar *rect_byte, float *rect_float, int width, int height, const float color[4])
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)
#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)
void BKE_image_buf_fill_checker(uchar *rect, float *rect_float, int width, int height)
static void checker_board_grid_fill(uchar *rect, float *rect_float, int width, int height, float blend, int offset)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)