Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
draw.h File Reference
#include "common/curve_tools.h"
#include "math/splines.h"
#include "system/mem_alloc.h"
#include "system/openmp.h"
#include "widgets/paint.h"
#include "widgets/stroke_raster.h"
#include "widgets/widget_settings.h"
#include <cairo.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
+ Include dependency graph for draw.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_draw_curve_t
 

Macros

#define M_PI   3.141592654
 
#define DT_DRAW_SIZE_GLOBAL_FACTOR   0.75f
 
#define DT_DRAW_SIZE_LINE   DT_PIXEL_APPLY_DPI_DPP(1.5f * DT_DRAW_SIZE_GLOBAL_FACTOR)
 
#define DT_DRAW_SIZE_LINE_SELECTED   DT_PIXEL_APPLY_DPI_DPP(3.0f * DT_DRAW_SIZE_GLOBAL_FACTOR)
 
#define DT_DRAW_SIZE_LINE_HIGHLIGHT   (DT_PIXEL_APPLY_DPI_DPP(4.0f * DT_DRAW_SIZE_GLOBAL_FACTOR) + DT_DRAW_SIZE_LINE)
 
#define DT_DRAW_SIZE_LINE_HIGHLIGHT_SELECTED   (DT_PIXEL_APPLY_DPI_DPP(5.0f * DT_DRAW_SIZE_GLOBAL_FACTOR) + DT_DRAW_SIZE_LINE_SELECTED)
 
#define DT_DRAW_SIZE_CROSS   DT_PIXEL_APPLY_DPI_DPP(7.0f * DT_DRAW_SIZE_GLOBAL_FACTOR)
 
#define DT_DRAW_SCALE_DASH   DT_PIXEL_APPLY_DPI_DPP(12.0f * DT_DRAW_SIZE_GLOBAL_FACTOR)
 
#define DT_DRAW_SCALE_ARROW   DT_PIXEL_APPLY_DPI_DPP(18.0f * DT_DRAW_SIZE_GLOBAL_FACTOR)
 
#define DT_DRAW_RADIUS_NODE   DT_PIXEL_APPLY_DPI_DPP(5.0f * DT_DRAW_SIZE_GLOBAL_FACTOR)
 
#define DT_DRAW_RADIUS_NODE_SELECTED   (1.25f * DT_DRAW_RADIUS_NODE)
 

Typedefs

typedef enum dt_draw_dash_type_t dt_draw_dash_type_t
 
typedef struct dt_draw_curve_t dt_draw_curve_t
 
typedef void(* shape_draw_function_t) (struct dt_develop_t *dev, cairo_t *cr, const float *points, const int points_count, const int nb, const gboolean border, const gboolean source, const struct dt_masks_skip_range_t *skips, const int skip_count)
 

Enumerations

enum  dt_draw_dash_type_t {
  DT_MASKS_NO_DASH = 0 ,
  DT_MASKS_DASH_STICK = 1 ,
  DT_MASKS_DASH_ROUND = 2
}
 

Functions

static void dt_draw_star (cairo_t *cr, float x, float y, float r1, float r2)
 
static void dt_draw_line (cairo_t *cr, float left, float top, float right, float bottom)
 
static void set_color (cairo_t *cr, GdkRGBA color)
 
static void dt_draw_set_color_overlay (cairo_t *cr, gboolean bright, double alpha)
 
static void dt_draw_grid (cairo_t *cr, const int num, const int left, const int top, const int right, const int bottom)
 
static float dt_curve_to_mouse (const float x, const float zoom_factor, const float offset)
 
static void dt_draw_grid_zoomed (cairo_t *cr, const int num, const float left, const float top, const float right, const float bottom, const float width, const float height, const float zoom_factor, const float zoom_offset_x, const float zoom_offset_y)
 
static float dt_log_scale_axis (const float x, const float base)
 
static void dt_draw_loglog_grid (cairo_t *cr, const int num, const int left, const int top, const int right, const int bottom, const float base)
 
static void dt_draw_semilog_x_grid (cairo_t *cr, const int num, const int left, const int top, const int right, const int bottom, const float base)
 
static void dt_draw_semilog_y_grid (cairo_t *cr, const int num, const int left, const int top, const int right, const int bottom, const float base)
 
static void dt_draw_vertical_lines (cairo_t *cr, const int num, const int left, const int top, const int right, const int bottom)
 
static void dt_draw_horizontal_lines (cairo_t *cr, const int num, const int left, const int top, const int right, const int bottom)
 
static dt_draw_curve_tdt_draw_curve_new (const float min, const float max, unsigned int type)
 
static void dt_draw_curve_destroy (dt_draw_curve_t *c)
 
static void dt_draw_curve_set_point (dt_draw_curve_t *c, const int num, const float x, const float y)
 
static void dt_draw_curve_smaple_values (dt_draw_curve_t *c, const float min, const float max, const int res, float *x, float *y)
 
static void dt_draw_curve_calc_values (dt_draw_curve_t *c, const float min, const float max, const int res, float *x, float *y)
 
static void dt_draw_curve_calc_values_V2_nonperiodic (dt_draw_curve_t *c, const float min, const float max, const int res, float *x, float *y)
 
static void dt_draw_curve_calc_values_V2_periodic (dt_draw_curve_t *c, const float min, const float max, const int res, float *x, float *y)
 
static void dt_draw_curve_calc_values_V2 (dt_draw_curve_t *c, const float min, const float max, const int res, float *x, float *y, const gboolean periodic)
 
static float dt_draw_curve_calc_value (dt_draw_curve_t *c, const float x)
 
static int dt_draw_curve_add_point (dt_draw_curve_t *c, const float x, const float y)
 
static void dt_draw_histogram_8_linxliny (cairo_t *cr, const uint32_t *hist, int32_t channels, int32_t channel)
 
static void dt_draw_histogram_8_zoomed (cairo_t *cr, const uint32_t *hist, int32_t channels, int32_t channel, const float zoom_factor, const float zoom_offset_x, const float zoom_offset_y, gboolean linear)
 
static void dt_draw_histogram_8_logxliny (cairo_t *cr, const uint32_t *hist, int32_t channels, int32_t channel, float base_log)
 
static void dt_draw_histogram_8_logxlogy (cairo_t *cr, const uint32_t *hist, int32_t channels, int32_t channel, float base_log)
 
static void dt_draw_histogram_8_linxlogy (cairo_t *cr, const uint32_t *hist, int32_t channels, int32_t channel)
 
static void dt_draw_histogram_8_log_base (cairo_t *cr, const uint32_t *hist, int32_t channels, int32_t channel, const gboolean linear, float base_log)
 
static void dt_draw_histogram_8 (cairo_t *cr, const uint32_t *hist, int32_t channels, int32_t channel, const gboolean linear)
 
static void dt_draw_cairo_to_gdk_pixbuf (uint8_t *data, unsigned int width, unsigned int height)
 
static void dt_cairo_perceptual_gradient (cairo_pattern_t *grad, double alpha)
 
static GdkPixbuf * dt_draw_paint_to_pixbuf (GtkWidget *widget, const guint pixbuf_size, const int flags, void(*dtgtk_cairo_paint_fct)(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags, void *data))
 
static void dt_draw_rounded_rectangle_path (cairo_t *cr, float x, float y, float width, float height, float radius)
 
static void dt_gui_draw_rounded_rectangle (cairo_t *cr, float width, float height, float x, float y)
 
static void dt_draw_plus_sign (cairo_t *cr, float x, float y, float size, float line_width_scale)
 
static void _draw_fill_clear (cairo_t *cr, gboolean preserve)
 
static void _fill_clear (cairo_t *cr)
 
static void _fill_clear_preserve (cairo_t *cr)
 
static void dt_draw_dash_lengths (const dt_draw_dash_type_t type, const float zoom_scale, double *on, double *off)
 
static void dt_draw_set_dash_style (cairo_t *cr, dt_draw_dash_type_t type, float zoom_scale)
 
static void dt_draw_node (cairo_t *cr, const gboolean square, const gboolean point_action, const gboolean selected, const float zoom_scale, const float x, const float y)
 Draw an node point of a mask.
 
static void dt_draw_handle (cairo_t *cr, const float pt[2], const float zoom_scale, const float handle[2], const gboolean selected, const gboolean square)
 Draw a control handle attached to a point with a tail between the node and the handle.
 
static void dt_draw_shape_lines (struct dt_develop_t *dev, const dt_draw_dash_type_t dash_type, const gboolean source, cairo_t *cr, const int nb, const gboolean selected, const float zoom_scale, const float *points, const int points_count, const shape_draw_function_t *draw_shape_func, const cairo_line_cap_t line_cap, const struct dt_masks_skip_range_t *skips, const int skip_count)
 Draw the lines of a mask shape.
 
static double dt_draw_min_emit_step (cairo_t *cr)
 Stroke a line with style.
 
static void dt_draw_stroke_line (const dt_draw_dash_type_t dash_type, const gboolean source, cairo_t *cr, const gboolean selected, const float zoom_scale, const cairo_line_cap_t line_cap)
 
static void _draw_arrow_head (cairo_t *cr, const float arrow[2], const float arrow_x_a, const float arrow_y_a, const float arrow_x_b, const float arrow_y_b)
 
static void _draw_arrow_tail (cairo_t *cr, const float arrow_bud_x, const float arrow_bud_y, const float tail[2], const gboolean draw_tail)
 
static void dt_draw_arrow (cairo_t *cr, const float zoom_scale, const gboolean selected, const gboolean draw_tail, const dt_draw_dash_type_t dash_style, const float arrow[2], const float tail[2], const float angle)
 Draw an arrow with head and, if needed, tail. The length of the arrow head is defined by DT_DRAW_SCALE_ARROW. This is used for the clone mask source indicator.
 
static void dt_draw_cross (cairo_t *cr, const float zoom_scale, const float x, const float y)
 
static void dt_draw_source_shape (struct dt_develop_t *dev, cairo_t *cr, const float zoom_scale, const gboolean selected, const float *source_pts, const int source_pts_count, const int nodes_nb, const shape_draw_function_t *draw_shape_func)
 
static GdkPixbuf * dt_draw_get_pixbuf_from_cairo (DTGTKCairoPaintIconFunc paint, const int width, const int height)
 

Macro Definition Documentation

◆ DT_DRAW_RADIUS_NODE

#define DT_DRAW_RADIUS_NODE   DT_PIXEL_APPLY_DPI_DPP(5.0f * DT_DRAW_SIZE_GLOBAL_FACTOR)

Definition at line 94 of file draw.h.

◆ DT_DRAW_RADIUS_NODE_SELECTED

#define DT_DRAW_RADIUS_NODE_SELECTED   (1.25f * DT_DRAW_RADIUS_NODE)

Definition at line 95 of file draw.h.

◆ DT_DRAW_SCALE_ARROW

#define DT_DRAW_SCALE_ARROW   DT_PIXEL_APPLY_DPI_DPP(18.0f * DT_DRAW_SIZE_GLOBAL_FACTOR)

Definition at line 91 of file draw.h.

◆ DT_DRAW_SCALE_DASH

#define DT_DRAW_SCALE_DASH   DT_PIXEL_APPLY_DPI_DPP(12.0f * DT_DRAW_SIZE_GLOBAL_FACTOR)

stuff's scale

Definition at line 90 of file draw.h.

◆ DT_DRAW_SIZE_CROSS

#define DT_DRAW_SIZE_CROSS   DT_PIXEL_APPLY_DPI_DPP(7.0f * DT_DRAW_SIZE_GLOBAL_FACTOR)

Definition at line 87 of file draw.h.

◆ DT_DRAW_SIZE_GLOBAL_FACTOR

#define DT_DRAW_SIZE_GLOBAL_FACTOR   0.75f
Todo:
: enter directly the values applied to this factor in each following macro later once

Definition at line 80 of file draw.h.

◆ DT_DRAW_SIZE_LINE

#define DT_DRAW_SIZE_LINE   DT_PIXEL_APPLY_DPI_DPP(1.5f * DT_DRAW_SIZE_GLOBAL_FACTOR)

line sizes for drawing

Definition at line 83 of file draw.h.

◆ DT_DRAW_SIZE_LINE_HIGHLIGHT

#define DT_DRAW_SIZE_LINE_HIGHLIGHT   (DT_PIXEL_APPLY_DPI_DPP(4.0f * DT_DRAW_SIZE_GLOBAL_FACTOR) + DT_DRAW_SIZE_LINE)

Definition at line 85 of file draw.h.

◆ DT_DRAW_SIZE_LINE_HIGHLIGHT_SELECTED

#define DT_DRAW_SIZE_LINE_HIGHLIGHT_SELECTED   (DT_PIXEL_APPLY_DPI_DPP(5.0f * DT_DRAW_SIZE_GLOBAL_FACTOR) + DT_DRAW_SIZE_LINE_SELECTED)

Definition at line 86 of file draw.h.

◆ DT_DRAW_SIZE_LINE_SELECTED

#define DT_DRAW_SIZE_LINE_SELECTED   DT_PIXEL_APPLY_DPI_DPP(3.0f * DT_DRAW_SIZE_GLOBAL_FACTOR)

Definition at line 84 of file draw.h.

◆ M_PI

#define M_PI   3.141592654

Definition at line 75 of file draw.h.

Typedef Documentation

◆ dt_draw_curve_t

wrapper around nikon curve.

◆ dt_draw_dash_type_t

dash type

◆ shape_draw_function_t

typedef void(* shape_draw_function_t) (struct dt_develop_t *dev, cairo_t *cr, const float *points, const int points_count, const int nb, const gboolean border, const gboolean source, const struct dt_masks_skip_range_t *skips, const int skip_count)

Definition at line 815 of file draw.h.

Enumeration Type Documentation

◆ dt_draw_dash_type_t

dash type

Enumerator
DT_MASKS_NO_DASH 
DT_MASKS_DASH_STICK 
DT_MASKS_DASH_ROUND 

Definition at line 132 of file draw.h.

Function Documentation

◆ _draw_arrow_head()

static void _draw_arrow_head ( cairo_t *  cr,
const float  arrow[2],
const float  arrow_x_a,
const float  arrow_y_a,
const float  arrow_x_b,
const float  arrow_y_b 
)
static

Definition at line 958 of file draw.h.

Referenced by dt_draw_arrow().

◆ _draw_arrow_tail()

static void _draw_arrow_tail ( cairo_t *  cr,
const float  arrow_bud_x,
const float  arrow_bud_y,
const float  tail[2],
const gboolean  draw_tail 
)
static

Definition at line 969 of file draw.h.

References dt_draw_line().

Referenced by dt_draw_arrow().

◆ _draw_fill_clear()

static void _draw_fill_clear ( cairo_t *  cr,
gboolean  preserve 
)
static

Definition at line 581 of file draw.h.

Referenced by _fill_clear(), and _fill_clear_preserve().

◆ _fill_clear()

static void _fill_clear ( cairo_t *  cr)
static

Definition at line 591 of file draw.h.

References _draw_fill_clear(), and FALSE.

Referenced by dt_draw_handle().

◆ _fill_clear_preserve()

static void _fill_clear_preserve ( cairo_t *  cr)
static

Definition at line 596 of file draw.h.

References _draw_fill_clear(), and TRUE.

Referenced by dt_draw_arrow(), and dt_draw_node().

◆ dt_cairo_perceptual_gradient()

static void dt_cairo_perceptual_gradient ( cairo_pattern_t *  grad,
double  alpha 
)
inlinestatic

Definition at line 506 of file draw.h.

Referenced by _init_drawing(), and dt_iop_tonecurve_draw().

◆ dt_curve_to_mouse()

static float dt_curve_to_mouse ( const float  x,
const float  zoom_factor,
const float  offset 
)
inlinestatic

Definition at line 173 of file draw.h.

References x.

Referenced by dt_draw_grid_zoomed().

◆ dt_draw_arrow()

static void dt_draw_arrow ( cairo_t *  cr,
const float  zoom_scale,
const gboolean  selected,
const gboolean  draw_tail,
const dt_draw_dash_type_t  dash_style,
const float  arrow[2],
const float  tail[2],
const float  angle 
)
inlinestatic

Draw an arrow with head and, if needed, tail. The length of the arrow head is defined by DT_DRAW_SCALE_ARROW. This is used for the clone mask source indicator.

Parameters
crthe cairo context to draw into
zoom_scalethe current zoom scale of the image
selectedTRUE if the shape needs to be highlighted
draw_tailTRUE to draw the tail line
dash_stylethe dash style to use for the tail line
arrowthe position of the arrow tip
tailthe position of the tail point

Definition at line 988 of file draw.h.

References _draw_arrow_head(), _draw_arrow_tail(), _fill_clear_preserve(), DT_DRAW_SCALE_ARROW, dt_draw_set_color_overlay(), dt_draw_set_dash_style(), DT_DRAW_SIZE_LINE, DT_DRAW_SIZE_LINE_HIGHLIGHT, DT_DRAW_SIZE_LINE_HIGHLIGHT_SELECTED, DT_MASKS_NO_DASH, FALSE, selected, and TRUE.

Referenced by dt_masks_draw_source().

◆ dt_draw_cairo_to_gdk_pixbuf()

static void dt_draw_cairo_to_gdk_pixbuf ( uint8_t *  data,
unsigned int  width,
unsigned int  height 
)
inlinestatic

transform a data blob from cairo's premultiplied rgba/bgra to GdkPixbuf's un-premultiplied bgra/rgba

Definition at line 479 of file draw.h.

References g, height, r, width, and x.

Referenced by _draw_ellipse(), _draw_rectangle(), _init_image_pin(), _init_place_pin(), _view_map_images_count(), dt_draw_get_pixbuf_from_cairo(), dt_draw_paint_to_pixbuf(), and tree_insert_presets().

◆ dt_draw_cross()

static void dt_draw_cross ( cairo_t *  cr,
const float  zoom_scale,
const float  x,
const float  y 
)
inlinestatic

◆ dt_draw_curve_add_point()

static int dt_draw_curve_add_point ( dt_draw_curve_t c,
const float  x,
const float  y 
)
inlinestatic

◆ dt_draw_curve_calc_value()

◆ dt_draw_curve_calc_values()

static void dt_draw_curve_calc_values ( dt_draw_curve_t c,
const float  min,
const float  max,
const int  res,
float *  x,
float *  y 
)
inlinestatic

◆ dt_draw_curve_calc_values_V2()

static void dt_draw_curve_calc_values_V2 ( dt_draw_curve_t c,
const float  min,
const float  max,
const int  res,
float *  x,
float *  y,
const gboolean  periodic 
)
inlinestatic

◆ dt_draw_curve_calc_values_V2_nonperiodic()

static void dt_draw_curve_calc_values_V2_nonperiodic ( dt_draw_curve_t c,
const float  min,
const float  max,
const int  res,
float *  x,
float *  y 
)
inlinestatic

Definition at line 333 of file draw.h.

References CurveDataSampleV2(), dt_draw_curve_smaple_values(), max, min, res, and x.

Referenced by dt_draw_curve_calc_values_V2().

◆ dt_draw_curve_calc_values_V2_periodic()

static void dt_draw_curve_calc_values_V2_periodic ( dt_draw_curve_t c,
const float  min,
const float  max,
const int  res,
float *  x,
float *  y 
)
inlinestatic

Definition at line 342 of file draw.h.

References CurveDataSampleV2Periodic(), dt_draw_curve_smaple_values(), max, min, res, and x.

Referenced by dt_draw_curve_calc_values_V2().

◆ dt_draw_curve_destroy()

◆ dt_draw_curve_new()

static dt_draw_curve_t * dt_draw_curve_new ( const float  min,
const float  max,
unsigned int  type 
)
inlinestatic

◆ dt_draw_curve_set_point()

static void dt_draw_curve_set_point ( dt_draw_curve_t c,
const int  num,
const float  x,
const float  y 
)
inlinestatic

◆ dt_draw_curve_smaple_values()

static void dt_draw_curve_smaple_values ( dt_draw_curve_t c,
const float  min,
const float  max,
const int  res,
float *  x,
float *  y 
)
inlinestatic

◆ dt_draw_dash_lengths()

static void dt_draw_dash_lengths ( const dt_draw_dash_type_t  type,
const float  zoom_scale,
double on,
double off 
)
inlinestatic

The dash pattern of type in user units at zoom_scale: 0 and 0 for a solid line.

Definition at line 602 of file draw.h.

References DT_DRAW_SCALE_DASH, DT_MASKS_DASH_ROUND, DT_MASKS_DASH_STICK, and type.

Referenced by dt_draw_shape_lines().

◆ dt_draw_get_pixbuf_from_cairo()

static GdkPixbuf * dt_draw_get_pixbuf_from_cairo ( DTGTKCairoPaintIconFunc  paint,
const int  width,
const int  height 
)
inlinestatic

◆ dt_draw_grid()

static void dt_draw_grid ( cairo_t *  cr,
const int  num,
const int  left,
const int  top,
const int  right,
const int  bottom 
)
inlinestatic

◆ dt_draw_grid_zoomed()

static void dt_draw_grid_zoomed ( cairo_t *  cr,
const int  num,
const float  left,
const float  top,
const float  right,
const float  bottom,
const float  width,
const float  height,
const float  zoom_factor,
const float  zoom_offset_x,
const float  zoom_offset_y 
)
inlinestatic

Definition at line 179 of file draw.h.

References dt_curve_to_mouse(), dt_draw_line(), height, k, top, and width.

Referenced by _area_draw_callback().

◆ dt_draw_handle()

static void dt_draw_handle ( cairo_t *  cr,
const float  pt[2],
const float  zoom_scale,
const float  handle[2],
const gboolean  selected,
const gboolean  square 
)
inlinestatic

Draw a control handle attached to a point with a tail between the node and the handle.

Parameters
crthe cairo context to draw into
ptthe node point position (pt[0]=x, pt[1]=y, use NULL if no tail should be drawn)
zoom_scalethe current zoom scale of the image
handlethe handle point position (handle[0]=x, handle[1]=y)
selectedTRUE if the shape is selected
squareTRUE to draw a square handle, FALSE to draw a round handle

Definition at line 725 of file draw.h.

References _fill_clear(), DT_DRAW_RADIUS_NODE, DT_DRAW_RADIUS_NODE_SELECTED, dt_draw_set_color_overlay(), DT_DRAW_SIZE_LINE, DT_DRAW_SIZE_LINE_HIGHLIGHT, DT_DRAW_SIZE_LINE_HIGHLIGHT_SELECTED, DT_DRAW_SIZE_LINE_SELECTED, FALSE, M_PI, selected, and TRUE.

Referenced by _brush_events_post_expose(), and _polygon_events_post_expose().

◆ dt_draw_histogram_8()

static void dt_draw_histogram_8 ( cairo_t *  cr,
const uint32_t *  hist,
int32_t  channels,
int32_t  channel,
const gboolean  linear 
)
inlinestatic

◆ dt_draw_histogram_8_linxliny()

static void dt_draw_histogram_8_linxliny ( cairo_t *  cr,
const uint32_t *  hist,
int32_t  channels,
int32_t  channel 
)
inlinestatic

Definition at line 388 of file draw.h.

References k.

Referenced by dt_draw_histogram_8().

◆ dt_draw_histogram_8_linxlogy()

static void dt_draw_histogram_8_linxlogy ( cairo_t *  cr,
const uint32_t *  hist,
int32_t  channels,
int32_t  channel 
)
inlinestatic

Definition at line 447 of file draw.h.

References k.

Referenced by dt_draw_histogram_8().

◆ dt_draw_histogram_8_log_base()

static void dt_draw_histogram_8_log_base ( cairo_t *  cr,
const uint32_t *  hist,
int32_t  channels,
int32_t  channel,
const gboolean  linear,
float  base_log 
)
inlinestatic

Definition at line 458 of file draw.h.

References dt_draw_histogram_8_logxliny(), dt_draw_histogram_8_logxlogy(), and linear.

Referenced by dt_iop_tonecurve_draw().

◆ dt_draw_histogram_8_logxliny()

static void dt_draw_histogram_8_logxliny ( cairo_t *  cr,
const uint32_t *  hist,
int32_t  channels,
int32_t  channel,
float  base_log 
)
inlinestatic

Definition at line 415 of file draw.h.

References k, and x.

Referenced by dt_draw_histogram_8_log_base().

◆ dt_draw_histogram_8_logxlogy()

static void dt_draw_histogram_8_logxlogy ( cairo_t *  cr,
const uint32_t *  hist,
int32_t  channels,
int32_t  channel,
float  base_log 
)
inlinestatic

Definition at line 431 of file draw.h.

References k, and x.

Referenced by dt_draw_histogram_8_log_base().

◆ dt_draw_histogram_8_zoomed()

static void dt_draw_histogram_8_zoomed ( cairo_t *  cr,
const uint32_t *  hist,
int32_t  channels,
int32_t  channel,
const float  zoom_factor,
const float  zoom_offset_x,
const float  zoom_offset_y,
gboolean  linear 
)
inlinestatic

Definition at line 398 of file draw.h.

References k, linear, and value.

Referenced by _area_draw_callback(), and _area_draw_callback().

◆ dt_draw_horizontal_lines()

static void dt_draw_horizontal_lines ( cairo_t *  cr,
const int  num,
const int  left,
const int  top,
const int  right,
const int  bottom 
)
inlinestatic

Definition at line 268 of file draw.h.

References height, k, and top.

Referenced by dt_guides_draw_grid().

◆ dt_draw_line()

static void dt_draw_line ( cairo_t *  cr,
float  left,
float  top,
float  right,
float  bottom 
)
inlinestatic

◆ dt_draw_loglog_grid()

static void dt_draw_loglog_grid ( cairo_t *  cr,
const int  num,
const int  left,
const int  top,
const int  right,
const int  bottom,
const float  base 
)
inlinestatic

◆ dt_draw_min_emit_step()

static double dt_draw_min_emit_step ( cairo_t *  cr)
inlinestatic

Stroke a line with style.

Parameters
dash_typethe dash type to use
sourceTRUE if we draw the source shape (clone mask)
crthe cairo context to draw into
selectedTRUE if the shape is selected
zoom_scalethe current zoom scale of the image

The shortest user-space step worth emitting into cr, in user units.

Outlines are sampled at the resolution they were BUILT at – for a mask, one point per raw image pixel along the path – and drawn into a view that is a fraction of that. Measured on ansel#1158: a mean of 89 150 points per brush shape (max 208 095) for a mean of 11.9 nodes, with roughly four of them landing inside every device pixel, costing 93 ms per shape per frame to stroke a curve indistinguishable from the decimated one.

Half a device pixel, converted through the context's own matrix rather than through a zoom factor a caller happens to know: that picks up the device scale (HiDPI) and any transform in effect, and needs nothing passed in. Returns 0 for a degenerate matrix, which decimates nothing.

Definition at line 931 of file draw.h.

Referenced by _circle_draw_shape(), _ellipse_draw_shape(), _gradient_draw_shape(), dt_masks_draw_outline_runs(), dt_masks_draw_path_seg_by_seg(), and dt_masks_events_post_expose_with().

◆ dt_draw_node()

static void dt_draw_node ( cairo_t *  cr,
const gboolean  square,
const gboolean  point_action,
const gboolean  selected,
const float  zoom_scale,
const float  x,
const float  y 
)
inlinestatic

Draw an node point of a mask.

Parameters
crthe cairo context to draw into
squareTRUE to draw a square node, FALSE to draw a round node
point_actionTRUE if the point is selected or dragged
selectedTRUE if the shape is selected
zoom_scalethe current zoom scale of the image
xthe center x position of the anchor
ythe center y position of the anchor

Definition at line 669 of file draw.h.

References _fill_clear_preserve(), DT_DRAW_RADIUS_NODE, DT_DRAW_RADIUS_NODE_SELECTED, dt_draw_set_color_overlay(), DT_DRAW_SIZE_LINE, DT_DRAW_SIZE_LINE_SELECTED, DT_GUI_MOUSE_EFFECT_RADIUS, dt_widget_debug_overlays(), FALSE, M_PI, selected, TRUE, and x.

Referenced by _brush_events_post_expose(), _draw_end_marker(), _ellipse_draw_handles(), _ellipse_events_post_expose(), _gradient_draw_arrow(), and _polygon_events_post_expose().

◆ dt_draw_paint_to_pixbuf()

static GdkPixbuf * dt_draw_paint_to_pixbuf ( GtkWidget widget,
const guint  pixbuf_size,
const int  flags,
void(*)(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags, void *data)  dtgtk_cairo_paint_fct 
)
inlinestatic

◆ dt_draw_plus_sign()

static void dt_draw_plus_sign ( cairo_t *  cr,
float  x,
float  y,
float  size,
float  line_width_scale 
)
inlinestatic

A plus sign centred on (x, y), each arm size long. The line width is scaled relative to whatever the caller had set, and restored afterwards, so it tracks the surrounding icon.

Definition at line 562 of file draw.h.

References size, and x.

Referenced by dtgtk_cairo_paint_colorpicker().

◆ dt_draw_rounded_rectangle_path()

static void dt_draw_rounded_rectangle_path ( cairo_t *  cr,
float  x,
float  y,
float  width,
float  height,
float  radius 
)
inlinestatic

Trace a rounded rectangle as a closed sub-path, leaving it current for the caller to stroke, fill or clip.

Definition at line 541 of file draw.h.

References height, M_PI, width, and x.

Referenced by _rounded_rectangle(), and dt_gui_draw_rounded_rectangle().

◆ dt_draw_semilog_x_grid()

static void dt_draw_semilog_x_grid ( cairo_t *  cr,
const int  num,
const int  left,
const int  top,
const int  right,
const int  bottom,
const float  base 
)
inlinestatic

Definition at line 222 of file draw.h.

References dt_draw_line(), dt_log_scale_axis(), height, k, top, width, and x.

Referenced by dt_iop_tonecurve_draw().

◆ dt_draw_semilog_y_grid()

static void dt_draw_semilog_y_grid ( cairo_t *  cr,
const int  num,
const int  left,
const int  top,
const int  right,
const int  bottom,
const float  base 
)
inlinestatic

Definition at line 238 of file draw.h.

References dt_draw_line(), dt_log_scale_axis(), height, k, top, width, and x.

Referenced by dt_iop_tonecurve_draw().

◆ dt_draw_set_color_overlay()

◆ dt_draw_set_dash_style()

static void dt_draw_set_dash_style ( cairo_t *  cr,
dt_draw_dash_type_t  type,
float  zoom_scale 
)
inlinestatic

◆ dt_draw_shape_lines()

static void dt_draw_shape_lines ( struct dt_develop_t dev,
const dt_draw_dash_type_t  dash_type,
const gboolean  source,
cairo_t *  cr,
const int  nb,
const gboolean  selected,
const float  zoom_scale,
const float *  points,
const int  points_count,
const shape_draw_function_t draw_shape_func,
const cairo_line_cap_t  line_cap,
const struct dt_masks_skip_range_t skips,
const int  skip_count 
)
inlinestatic

Draw the lines of a mask shape.

Parameters
dash_typethe dash type to use
sourceTRUE if we draw the source shape (clone mask)
crthe cairo context to draw into
nbthe number of coord by node
selectedTRUE if the shape is selected
zoom_scalethe current zoom scale of the image
pointsthe points of the shape to draw
points_countthe number of points in the shape
functionsthe functions table of the shape

Definition at line 831 of file draw.h.

References dt_widget_overlay_color_t::blue, dt_stroke_style_t::bright, dt_widget_overlay_color_t::contrast, dt_stroke_style_t::dark, dt_stroke_style_t::dash_off, dt_stroke_style_t::dash_on, dt_draw_dash_lengths(), dt_draw_set_color_overlay(), dt_draw_set_dash_style(), DT_DRAW_SIZE_LINE, DT_DRAW_SIZE_LINE_HIGHLIGHT, DT_DRAW_SIZE_LINE_HIGHLIGHT_SELECTED, DT_DRAW_SIZE_LINE_SELECTED, DT_MASKS_NO_DASH, dt_stroke_raster_path(), dt_widget_overlay_color(), FALSE, dt_widget_overlay_color_t::green, dt_widget_overlay_color_t::red, dt_stroke_style_t::round_caps, selected, TRUE, and dt_stroke_pass_t::width.

Referenced by _brush_events_post_expose(), _circle_events_post_expose(), _ellipse_events_post_expose(), _gradient_events_post_expose(), _polygon_events_post_expose(), dt_draw_stroke_line(), and dt_masks_draw_preview_shape().

◆ dt_draw_source_shape()

static void dt_draw_source_shape ( struct dt_develop_t dev,
cairo_t *  cr,
const float  zoom_scale,
const gboolean  selected,
const float *  source_pts,
const int  source_pts_count,
const int  nodes_nb,
const shape_draw_function_t draw_shape_func 
)
inlinestatic

◆ dt_draw_star()

static void dt_draw_star ( cairo_t *  cr,
float  x,
float  y,
float  r1,
float  r2 
)
inlinestatic

Draw a rating star: r1 outer radius, r2 inner.

Definition at line 100 of file draw.h.

References d, k, M_PI, and x.

Referenced by dtgtk_cairo_paint_overlays(), dtgtk_cairo_paint_star(), and dtgtk_cairo_paint_unratestar().

◆ dt_draw_stroke_line()

static void dt_draw_stroke_line ( const dt_draw_dash_type_t  dash_type,
const gboolean  source,
cairo_t *  cr,
const gboolean  selected,
const float  zoom_scale,
const cairo_line_cap_t  line_cap 
)
inlinestatic

◆ dt_draw_vertical_lines()

static void dt_draw_vertical_lines ( cairo_t *  cr,
const int  num,
const int  left,
const int  top,
const int  right,
const int  bottom 
)
inlinestatic

Definition at line 255 of file draw.h.

References k, top, and width.

Referenced by _area_draw_callback(), dt_guides_draw_grid(), and dt_iop_levels_area_draw().

◆ dt_gui_draw_rounded_rectangle()

static void dt_gui_draw_rounded_rectangle ( cairo_t *  cr,
float  width,
float  height,
float  x,
float  y 
)
inlinestatic

Fill a rectangle whose corners are rounded to a fifth of its height.

Definition at line 554 of file draw.h.

References dt_draw_rounded_rectangle_path(), height, width, and x.

Referenced by gui_draw_sym(), gui_post_expose(), and gui_post_expose().

◆ dt_log_scale_axis()

static float dt_log_scale_axis ( const float  x,
const float  base 
)
inlinestatic

Definition at line 201 of file draw.h.

References x.

Referenced by dt_draw_loglog_grid(), dt_draw_semilog_x_grid(), dt_draw_semilog_y_grid(), and dt_iop_tonecurve_draw().

◆ set_color()