Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
stroke_raster.h File Reference
#include <cairo.h>
#include <glib.h>
+ Include dependency graph for stroke_raster.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_stroke_pass_t
 
struct  dt_stroke_style_t
 

Typedefs

typedef G_BEGIN_DECLS struct dt_stroke_pass_t dt_stroke_pass_t
 
typedef struct dt_stroke_style_t dt_stroke_style_t
 

Functions

gboolean dt_stroke_raster_can_paint (cairo_surface_t *surface)
 
gboolean dt_stroke_raster_polyline (cairo_surface_t *surface, const double *xy, int count, const dt_stroke_style_t *style)
 
gboolean dt_stroke_raster_path (cairo_t *cr, const dt_stroke_style_t *style)
 
gboolean dt_stroke_raster_touched (cairo_surface_t *surface, cairo_rectangle_int_t *touched)
 
void dt_stroke_raster_touched_reset (cairo_surface_t *surface)
 

Typedef Documentation

◆ dt_stroke_pass_t

typedef G_BEGIN_DECLS struct dt_stroke_pass_t dt_stroke_pass_t

One pass of a stroke: a width and a straight (not premultiplied) colour with alpha.

◆ dt_stroke_style_t

How a polyline is stroked. Widths and dash lengths are in whatever space the entry point says: device pixels for dt_stroke_raster_polyline(), user units for dt_stroke_raster_path().

Function Documentation

◆ dt_stroke_raster_can_paint()

gboolean dt_stroke_raster_can_paint ( cairo_surface_t *  surface)

Is surface something this rasteriser can paint into: an ARGB32 image surface.

Definition at line 101 of file stroke_raster.c.

Referenced by dt_stroke_raster_path(), and dt_stroke_raster_polyline().

◆ dt_stroke_raster_path()

gboolean dt_stroke_raster_path ( cairo_t *  cr,
const dt_stroke_style_t style 
)

Stroke the current path of cr with style, then consume the path, as a pair of cairo_stroke() calls would. The path is flattened and mapped through cr's matrix into the pixels of the surface cr is drawing on – the current group's, if one is pushed – and the style's widths and dashes, given in USER units as the cairo calls receive them, are mapped through the same matrix. Returns FALSE, leaving the path in place, when that surface is not one this can paint into; the caller then strokes it with cairo instead.

Definition at line 592 of file stroke_raster.c.

References _dash_start(), _gather_flush(), _gather_point(), _matrix_scale(), dt_stroke_style_t::bright, _gather_t::closed, dt_stroke_style_t::dark, dt_stroke_style_t::dash_off, dt_stroke_style_t::dash_on, dt_stroke_raster_can_paint(), FALSE, _gather_t::first_x, _gather_t::first_y, i, _gather_t::offset_x, _gather_t::offset_y, _gather_t::scale_x, _gather_t::scale_y, TRUE, _gather_t::vertices, and dt_stroke_pass_t::width.

Referenced by _a_device_scaled_surface_is_painted_in_its_pixels(), _a_path_in_a_pushed_group_lands_where_cairo_puts_it(), _a_surface_it_cannot_write_is_refused_and_the_path_kept(), _the_matrix_scales_widths_and_positions(), and dt_draw_shape_lines().

◆ dt_stroke_raster_polyline()

gboolean dt_stroke_raster_polyline ( cairo_surface_t *  surface,
const double xy,
int  count,
const dt_stroke_style_t style 
)

Stroke count device-space vertices (x, y pairs, in the pixel grid of surface) as one open polyline into surface. The style's widths and dashes are device pixels. Returns FALSE, having painted nothing, when the surface is not one this can paint into (see dt_stroke_raster_can_paint()) or when there is nothing to draw.

Definition at line 523 of file stroke_raster.c.

References _dash_start(), _stroke_polyline(), dt_stroke_raster_can_paint(), and FALSE.

Referenced by _a_horizontal_line_paints_a_band_of_its_width(), _dashes_leave_gaps_along_the_line(), _flat_caps_stop_at_the_ends(), _the_bright_pass_paints_over_the_dark_one(), and _the_touched_record_resets().

◆ dt_stroke_raster_touched()

gboolean dt_stroke_raster_touched ( cairo_surface_t *  surface,
cairo_rectangle_int_t *  touched 
)

The pixel rectangle everything painted into surface through this file has touched since the last reset, so a caller can composite or clear that much and no more. Returns FALSE when nothing was painted.

Definition at line 82 of file stroke_raster.c.

References _touched_of(), _touched_t::any, FALSE, TRUE, _touched_t::x0, _touched_t::x1, _touched_t::y0, and _touched_t::y1.

Referenced by _a_horizontal_line_paints_a_band_of_its_width(), _overlay_dirty(), and _the_touched_record_resets().

◆ dt_stroke_raster_touched_reset()

void dt_stroke_raster_touched_reset ( cairo_surface_t *  surface)

Forget the touched rectangle of surface.

Definition at line 94 of file stroke_raster.c.

References _touched_of(), _touched_t::any, and FALSE.

Referenced by _canvas_begin(), and _the_touched_record_resets().