30 guint
width = gtk_widget_get_allocated_width(widget);
31 guint
height = gtk_widget_get_allocated_height(widget);
32 cairo_set_line_width(cr, 5);
33 cairo_set_source_rgb(cr, 1, 0, 0);
34 cairo_move_to(cr, 0, 0);
36 cairo_move_to(cr,
width, 0);
37 cairo_line_to(cr, 0,
height);
43 cairo_move_to(cr, start.
x, start.
y);
44 cairo_line_to(cr, end.
x, end.
y);
49 cairo_move_to(cr, center.
x - 10, center.
y);
50 cairo_line_to(cr, center.
x + 10, center.
y);
51 cairo_move_to(cr, center.
x, center.
y - 10);
52 cairo_line_to(cr, center.
x, center.
y + 10);
68 for(
int i = 1;
i < 4;
i++)
71 cairo_line_to(cr, corner.
x, corner.
y);
78 cairo_set_source_rgb(cr, 0, 0, 0);
89 cairo_set_source(cr, image->
image);
100 for(GList *iter = chart->
f_list; iter; iter = g_list_next(iter))
103 for(
int i = 0;
i < 4;
i++)
113 GHashTableIter table_iter;
116 g_hash_table_iter_init(&table_iter, table);
117 while(g_hash_table_iter_next(&table_iter, &
key, &
value))
137 GHashTableIter table_iter;
142 cairo_set_line_width(cr, line_width);
143 cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
145 g_hash_table_iter_init(&table_iter, chart->
box_table);
146 while(g_hash_table_iter_next(&table_iter, &
key, &
value))
149 box_t inner_box = *box;
150 inner_box.
p.
x += x_shrink;
151 inner_box.
p.
y += y_shrink;
152 inner_box.
w -= 2.0 * x_shrink;
153 inner_box.
h -= 2.0 * y_shrink;
156 if(colored) cairo_set_source_rgb(cr, box->
rgb[0], box->
rgb[1], box->
rgb[2]);
164 cairo_set_line_width(cr, line_width * 2.5);
165 cairo_set_source_rgb(cr, 1, 1, 1);
166 cairo_stroke_preserve(cr);
168 cairo_set_line_width(cr, line_width);
169 cairo_set_source_rgb(cr, 0, 0, 0);
178 const float s_w = (float)image->
width /
width;
192 unsigned char *rgbbuf = (
unsigned char *)malloc(
sizeof(
unsigned char) *
height *
width * 4);
194 for(
int y = 0; y <
height; y++)
196 const float *iter = image + y *
width * 3;
197 for(
int x = 0;
x <
width;
x++, iter += 3)
201 dt_XYZ_to_sRGB_clipped(iter,
sRGB);
202 for(
int c = 0; c < 3; c++) pixel |= ((
int)(
sRGB[c] * 255) & 0xff) << (16 - c * 8);
203 *((
int *)(&rgbbuf[(
x + (
size_t)y *
width) * 4])) = pixel;
207 cairo_format_t format = CAIRO_FORMAT_RGB24;
208 const int stride = cairo_format_stride_for_width(format,
width);
209 cairo_surface_t *surface = cairo_image_surface_create_for_data(rgbbuf, format,
width,
height, stride);
static __DT_CLONE_TARGETS__ void homography(float *homograph, const float angle, const float shift_v, const float shift_h, const float shear, const float f_length_kb, const float orthocorr, const float aspect, const int width, const int height, dt_iop_ashift_homodir_t dir)
static const dt_aligned_pixel_simd_t const dt_adaptation_t const float p
const dt_aligned_pixel_t f
static dt_aligned_pixel_t sRGB
const dt_colormatrix_t matrix
point_t apply_homography(point_t p, const float *h)
#define __OMP_PARALLEL_FOR__(...)
static const dt_aligned_pixel_simd_t value
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
void draw_image(cairo_t *cr, image_t *image)
void draw_color_boxes_outline(cairo_t *cr, const float *homography, chart_t *chart)
void draw_box(cairo_t *cr, box_t box, const float *homography)
static cairo_user_data_key_t source_data_buffer_key
void draw_cross(cairo_t *cr, point_t center)
void draw_no_image(cairo_t *cr, GtkWidget *widget)
void center_image(cairo_t *cr, image_t *image)
void stroke_boxes(cairo_t *cr, float line_width)
void clear_background(cairo_t *cr)
void draw_color_boxes_inside(cairo_t *cr, const float *homography, chart_t *chart, float shrink, float line_width, gboolean colored)
void draw_line(cairo_t *cr, point_t start, point_t end)
cairo_surface_t * cairo_surface_create_from_xyz_data(const float *const image, const int width, const int height)
void draw_f_boxes(cairo_t *cr, const float *homography, chart_t *chart)
void draw_boundingbox(cairo_t *cr, point_t *bb)
void draw_d_boxes(cairo_t *cr, const float *homography, chart_t *chart)
static void _draw_boxes(cairo_t *cr, const float *homography, GHashTable *table)
void set_offset_and_scale(image_t *image, float width, float height)
float dt_aligned_pixel_t[4]
struct _GtkWidget GtkWidget