283 p.transition_x[0] = 0.000000;
284 p.transition_x[1] = 0.200000;
285 p.transition_x[2] = 0.400000;
286 p.transition_x[3] = 0.600000;
287 p.transition_x[4] = 0.800000;
288 p.transition_x[5] = 1.000000;
290 p.transition_y[0] = 1.000000;
291 p.transition_y[1] = 1.000000;
292 p.transition_y[2] = 1.000000;
293 p.transition_y[3] = 1.000000;
294 p.transition_y[4] = 1.000000;
295 p.transition_y[5] = 1.000000;
299 self->version(), &
p,
sizeof(
p), 1);
301 p.transition_x[0] = 0.000000;
302 p.transition_x[1] = 0.200000;
303 p.transition_x[2] = 0.400000;
304 p.transition_x[3] = 0.600000;
305 p.transition_x[4] = 0.800000;
306 p.transition_x[5] = 1.000000;
308 p.transition_y[0] = 0.600000;
309 p.transition_y[1] = 0.800000;
310 p.transition_y[2] = 0.950000;
311 p.transition_y[3] = 0.980000;
312 p.transition_y[4] = 1.000000;
313 p.transition_y[5] = 1.000000;
317 self->version(), &
p,
sizeof(
p), 1);
319 p.transition_x[0] = 0.000000;
320 p.transition_x[1] = 0.200000;
321 p.transition_x[2] = 0.400000;
322 p.transition_x[3] = 0.600000;
323 p.transition_x[4] = 0.800000;
324 p.transition_x[5] = 1.000000;
326 p.transition_y[0] = 0.300000;
327 p.transition_y[1] = 0.500000;
328 p.transition_y[2] = 0.700000;
329 p.transition_y[3] = 0.850000;
330 p.transition_y[4] = 0.970000;
331 p.transition_y[5] = 1.000000;
335 self->version(), &
p,
sizeof(
p), 1);
337 p.transition_x[0] = 0.000000;
338 p.transition_x[1] = 0.200000;
339 p.transition_x[2] = 0.400000;
340 p.transition_x[3] = 0.600000;
341 p.transition_x[4] = 0.800000;
342 p.transition_x[5] = 1.000000;
344 p.transition_y[0] = 0.050000;
345 p.transition_y[1] = 0.200000;
346 p.transition_y[2] = 0.400000;
347 p.transition_y[3] = 0.700000;
348 p.transition_y[4] = 0.920000;
349 p.transition_y[5] = 1.000000;
353 self->version(), &
p,
sizeof(
p), 1);
355 p.transition_x[0] = 0.000000;
356 p.transition_x[1] = 0.200000;
357 p.transition_x[2] = 0.400000;
358 p.transition_x[3] = 0.600000;
359 p.transition_x[4] = 0.800000;
360 p.transition_x[5] = 1.000000;
362 p.transition_y[0] = 0.070000;
363 p.transition_y[1] = 0.100000;
364 p.transition_y[2] = 0.180000;
365 p.transition_y[3] = 0.350000;
366 p.transition_y[4] = 0.750000;
367 p.transition_y[5] = 1.000000;
371 self->version(), &
p,
sizeof(
p), 1);
373 p.transition_x[0] = 0.000000;
374 p.transition_x[1] = 0.200000;
375 p.transition_x[2] = 0.400000;
376 p.transition_x[3] = 0.600000;
377 p.transition_x[4] = 0.800000;
378 p.transition_x[5] = 1.000000;
380 p.transition_y[0] = 0.000000;
381 p.transition_y[1] = 0.450000;
382 p.transition_y[2] = 0.750000;
383 p.transition_y[3] = 0.930000;
384 p.transition_y[4] = 0.990000;
385 p.transition_y[5] = 1.000000;
389 self->version(), &
p,
sizeof(
p), 1);
391 p.transition_x[0] = 0.000000;
392 p.transition_x[1] = 0.200000;
393 p.transition_x[2] = 0.400000;
394 p.transition_x[3] = 0.600000;
395 p.transition_x[4] = 0.800000;
396 p.transition_x[5] = 1.000000;
398 p.transition_y[0] = 0.000000;
399 p.transition_y[1] = 0.150000;
400 p.transition_y[2] = 0.350000;
401 p.transition_y[3] = 0.800000;
402 p.transition_y[4] = 0.970000;
403 p.transition_y[5] = 1.000000;
407 self->version(), &
p,
sizeof(
p), 1);
409 p.transition_x[0] = 0.000000;
410 p.transition_x[1] = 0.150000;
411 p.transition_x[2] = 0.400000;
412 p.transition_x[3] = 0.600000;
413 p.transition_x[4] = 0.800000;
414 p.transition_x[5] = 1.000000;
416 p.transition_y[0] = 0.000000;
417 p.transition_y[1] = 0.020000;
418 p.transition_y[2] = 0.050000;
419 p.transition_y[3] = 0.200000;
420 p.transition_y[4] = 0.550000;
421 p.transition_y[5] = 1.000000;
425 self->version(), &
p,
sizeof(
p), 1);
427 p.transition_x[0] = 0.000000;
428 p.transition_x[1] = 0.200000;
429 p.transition_x[2] = 0.400000;
430 p.transition_x[3] = 0.600000;
431 p.transition_x[4] = 0.800000;
432 p.transition_x[5] = 1.000000;
434 p.transition_y[0] = 0.000000;
435 p.transition_y[1] = 0.000000;
436 p.transition_y[2] = 0.000000;
437 p.transition_y[3] = 0.000000;
438 p.transition_y[4] = 0.000000;
439 p.transition_y[5] = 0.000000;
444 self->version(), &
p,
sizeof(
p), 1);
474 GtkAllocation allocation;
475 gtk_widget_get_allocation(widget, &allocation);
476 int width = allocation.width,
height = allocation.height;
478 cairo_t *cr = cairo_create(cst);
480 cairo_set_source_rgb(cr, .2, .2, .2);
483 cairo_translate(cr, inset, inset);
488 cairo_set_source_rgb(cr, .1, .1, .1);
492 cairo_set_source_rgb(cr, .3, .3, .3);
498 cairo_set_source_rgb(cr, .1, .1, .1);
502 if(c->mouse_y > 0 || c->dragging)
530 cairo_set_source_rgb(cr, 0.6, 0.6, 0.6);
536 cairo_rel_line_to(cr, -arrw * .5f, 0);
537 cairo_rel_line_to(cr, arrw * .5f, -arrw);
538 cairo_rel_line_to(cr, arrw * .5f, arrw);
539 cairo_close_path(cr);
547 cairo_translate(cr, 0,
height);
552 cairo_set_source_rgba(cr, .7, .7, .7, 1.0);
568 cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
580 if(c->mouse_y > 0 || c->dragging)
583 cairo_set_source_rgba(cr, .7, .7, .7, .6);
584 cairo_move_to(cr, 0, -
height * c->draw_min_ys[0]);
589 cairo_close_path(cr);
592 cairo_set_source_rgba(cr, .9, .9, .9, .5);
595 const float f =
k - pos;
597 float ht = -
height * (
f * c->draw_ys[
k] + (1 -
f) * c->draw_ys[
k + 1]);
598 cairo_arc(cr, c->mouse_x *
width, ht, c->mouse_radius *
width, 0, 2. *
M_PI);
604 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
609 PangoFontDescription *desc = pango_font_description_copy_static(
dt_bauhaus_get_global()->pango_font_desc);
610 pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
611 pango_font_description_set_absolute_size(desc,(.06 *
height) * PANGO_SCALE);
612 layout = pango_cairo_create_layout(cr);
613 pango_layout_set_font_description(layout, desc);
614 cairo_set_source_rgb(cr, .1, .1, .1);
616 pango_layout_set_text(layout, _(
"dark"), -1);
617 pango_layout_get_pixel_extents(layout, &ink, NULL);
618 cairo_move_to(cr, .02 *
width - ink.y, .5 * (
height + ink.width));
620 cairo_rotate(cr, -
M_PI * .5f);
621 pango_cairo_show_layout(cr, layout);
624 pango_layout_set_text(layout, _(
"bright"), -1);
625 pango_layout_get_pixel_extents(layout, &ink, NULL);
626 cairo_move_to(cr, .98 *
width - ink.height, .5 * (
height + ink.width));
628 cairo_rotate(cr, -
M_PI * .5f);
629 pango_cairo_show_layout(cr, layout);
633 pango_layout_set_text(layout, _(
"day vision"), -1);
634 pango_layout_get_pixel_extents(layout, &ink, NULL);
635 cairo_move_to(cr, .5 * (
width - ink.width), .08 *
height - ink.height);
636 pango_cairo_show_layout(cr, layout);
638 pango_layout_set_text(layout, _(
"night vision"), -1);
639 pango_layout_get_pixel_extents(layout, &ink, NULL);
640 cairo_move_to(cr, .5 * (
width - ink.width), .97 *
height - ink.height);
641 pango_cairo_show_layout(cr, layout);
643 pango_font_description_free(desc);
644 g_object_unref(layout);
646 cairo_set_source_surface(crf, cst, 0, 0);
648 cairo_surface_destroy(cst);
658 GtkAllocation allocation;
659 gtk_widget_get_allocation(widget, &allocation);
660 int height = allocation.height - 2 * inset,
width = allocation.width - 2 * inset;
661 if(!c->dragging) c->mouse_x = CLAMP(event->x - inset, 0,
width) / (float)
width;
662 c->mouse_y = 1.0 - CLAMP(event->y - inset, 0,
height) / (float)
height;
668 const float mx = CLAMP(event->x - inset, 0,
width) / (float)
width;
671 const float minx =
p->transition_x[c->x_move - 1] + 0.001f;
672 const float maxx =
p->transition_x[c->x_move + 1] - 0.001f;
673 p->transition_x[c->x_move] = fminf(maxx, fmaxf(minx, mx));
680 gtk_widget_queue_draw(widget);
683 else if(event->y >
height)
686 float dist = fabs(
p->transition_x[0] - c->mouse_x);
689 float d2 = fabs(
p->transition_x[
k] - c->mouse_x);
696 gtk_widget_queue_draw(widget);
701 gtk_widget_queue_draw(widget);