Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::DrawingContext Class Reference

Minimal wrapper over Cairo. More...

#include <drawing-context.h>

Inheritance diagram for Inkscape::DrawingContext:

Classes

class  Save
 RAII idiom for saving the state of DrawingContext. More...
 

Public Member Functions

 DrawingContext (cairo_t *ct, Geom::Point const &origin)
 
 DrawingContext (cairo_surface_t *surface, Geom::Point const &origin)
 
 DrawingContext (DrawingSurface &s)
 
 ~DrawingContext ()
 
void save ()
 
void restore ()
 
void pushGroup ()
 
void pushAlphaGroup ()
 
void popGroupToSource ()
 
void transform (Geom::Affine const &trans)
 
void translate (Geom::Point const &t)
 
void translate (double dx, double dy)
 
void scale (Geom::Scale const &s)
 
void scale (double sx, double sy)
 
void device_to_user_distance (double &dx, double &dy)
 
void user_to_device_distance (double &dx, double &dy)
 
void moveTo (Geom::Point const &p)
 
void lineTo (Geom::Point const &p)
 
void curveTo (Geom::Point const &p1, Geom::Point const &p2, Geom::Point const &p3)
 
void arc (Geom::Point const &center, double radius, Geom::AngleInterval const &angle)
 
void closePath ()
 
void rectangle (Geom::Rect const &r)
 
void rectangle (Geom::IntRect const &r)
 
void revrectangle (Geom::Rect const &r)
 
void revrectangle (Geom::IntRect const &r)
 
void newPath ()
 
void newSubpath ()
 
void path (Geom::PathVector const &pv)
 
void paint (double alpha=1.0)
 
void fill ()
 
void fillPreserve ()
 
void stroke ()
 
void strokePreserve ()
 
void clip ()
 
void setLineWidth (double w)
 
void setHairline ()
 
void setLineCap (cairo_line_cap_t cap)
 
void setLineJoin (cairo_line_join_t join)
 
void setMiterLimit (double miter)
 
void setFillRule (cairo_fill_rule_t rule)
 
void setOperator (cairo_operator_t op)
 
cairo_operator_t getOperator ()
 
void setTolerance (double tol)
 
void setSource (cairo_pattern_t *source)
 
void setSource (cairo_surface_t *surface, double x, double y)
 
void setSource (double r, double g, double b, double a=1.0)
 
void setSource (guint32 rgba)
 
void setSource (DrawingSurface *s)
 
void patternSetFilter (cairo_filter_t filter)
 
void patternSetExtend (cairo_extend_t extend)
 
Geom::Rect targetLogicalBounds () const
 
cairo_traw ()
 
cairo_surface_trawTarget ()
 
DrawingSurfacesurface ()
 

Private Member Functions

 DrawingContext (cairo_t *ct, DrawingSurface *surface, bool destroy)
 

Private Attributes

cairo_t_ct
 
DrawingSurface_surface
 
bool _delete_surface
 
bool _restore_context
 

Friends

class DrawingSurface
 

Detailed Description

Minimal wrapper over Cairo.

This is a wrapper over cairo_t, extended with operations that work with 2Geom geometrical primitives. Some of this is probably duplicated in cairo-render-context.cpp, which provides higher level operations for drawing entire SPObjects when exporting.

Definition at line 27 of file drawing-context.h.

Constructor & Destructor Documentation

◆ DrawingContext() [1/4]

Inkscape::DrawingContext::DrawingContext ( cairo_t ct,
Geom::Point const &  origin 
)

◆ DrawingContext() [2/4]

Inkscape::DrawingContext::DrawingContext ( cairo_surface_t surface,
Geom::Point const &  origin 
)

◆ DrawingContext() [3/4]

Inkscape::DrawingContext::DrawingContext ( DrawingSurface s)

Definition at line 85 of file drawing-context.cpp.

◆ ~DrawingContext()

Inkscape::DrawingContext::~DrawingContext ( )

◆ DrawingContext() [4/4]

Inkscape::DrawingContext::DrawingContext ( cairo_t ct,
DrawingSurface surface,
bool  destroy 
)
private

Member Function Documentation

◆ arc()

void Inkscape::DrawingContext::arc ( Geom::Point const &  center,
double  radius,
Geom::AngleInterval const &  angle 
)

Definition at line 104 of file drawing-context.cpp.

References _ct.

◆ clip()

void Inkscape::DrawingContext::clip ( )
inline

◆ closePath()

void Inkscape::DrawingContext::closePath ( )
inline

Definition at line 66 of file drawing-context.h.

References _ct.

Referenced by Inkscape::DrawingText::decorateStyle().

◆ curveTo()

void Inkscape::DrawingContext::curveTo ( Geom::Point const &  p1,
Geom::Point const &  p2,
Geom::Point const &  p3 
)
inline

Definition at line 62 of file drawing-context.h.

References _ct, cairo_curve_to(), Geom::X, and Geom::Y.

◆ device_to_user_distance()

void Inkscape::DrawingContext::device_to_user_distance ( double &  dx,
double &  dy 
)
inline

◆ fill()

◆ fillPreserve()

void Inkscape::DrawingContext::fillPreserve ( )
inline

◆ getOperator()

cairo_operator_t Inkscape::DrawingContext::getOperator ( )
inline

Definition at line 106 of file drawing-context.h.

References _ct.

◆ lineTo()

void Inkscape::DrawingContext::lineTo ( Geom::Point const &  p)
inline

◆ moveTo()

void Inkscape::DrawingContext::moveTo ( Geom::Point const &  p)
inline

◆ newPath()

◆ newSubpath()

void Inkscape::DrawingContext::newSubpath ( )
inline

Definition at line 89 of file drawing-context.h.

References _ct.

◆ paint()

◆ path()

◆ patternSetExtend()

void Inkscape::DrawingContext::patternSetExtend ( cairo_extend_t  extend)
inline

Definition at line 121 of file drawing-context.h.

References _ct.

Referenced by Inkscape::DrawingImage::_renderItem().

◆ patternSetFilter()

void Inkscape::DrawingContext::patternSetFilter ( cairo_filter_t  filter)
inline

Definition at line 118 of file drawing-context.h.

References _ct.

Referenced by Inkscape::DrawingImage::_renderItem().

◆ popGroupToSource()

void Inkscape::DrawingContext::popGroupToSource ( )
inline

◆ pushAlphaGroup()

void Inkscape::DrawingContext::pushAlphaGroup ( )
inline

Definition at line 49 of file drawing-context.h.

References _ct.

◆ pushGroup()

void Inkscape::DrawingContext::pushGroup ( )
inline

◆ raw()

◆ rawTarget()

cairo_surface_t * Inkscape::DrawingContext::rawTarget ( )
inline

Definition at line 126 of file drawing-context.h.

References _ct.

Referenced by Inkscape::DrawingImage::_renderItem(), and Inkscape::DrawingItem::render().

◆ rectangle() [1/2]

void Inkscape::DrawingContext::rectangle ( Geom::IntRect const &  r)
inline

◆ rectangle() [2/2]

◆ restore()

void Inkscape::DrawingContext::restore ( )
inline

◆ revrectangle() [1/2]

void Inkscape::DrawingContext::revrectangle ( Geom::IntRect const &  r)
inline

◆ revrectangle() [2/2]

void Inkscape::DrawingContext::revrectangle ( Geom::Rect const &  r)
inline

◆ save()

◆ scale() [1/2]

void Inkscape::DrawingContext::scale ( double  sx,
double  sy 
)
inline

Definition at line 56 of file drawing-context.h.

References _ct.

◆ scale() [2/2]

void Inkscape::DrawingContext::scale ( Geom::Scale const &  s)
inline

◆ setFillRule()

void Inkscape::DrawingContext::setFillRule ( cairo_fill_rule_t  rule)
inline

◆ setHairline()

◆ setLineCap()

void Inkscape::DrawingContext::setLineCap ( cairo_line_cap_t  cap)
inline

◆ setLineJoin()

void Inkscape::DrawingContext::setLineJoin ( cairo_line_join_t  join)
inline

◆ setLineWidth()

void Inkscape::DrawingContext::setLineWidth ( double  w)
inline

◆ setMiterLimit()

void Inkscape::DrawingContext::setMiterLimit ( double  miter)
inline

◆ setOperator()

void Inkscape::DrawingContext::setOperator ( cairo_operator_t  op)
inline

◆ setSource() [1/5]

◆ setSource() [2/5]

void Inkscape::DrawingContext::setSource ( cairo_surface_t surface,
double  x,
double  y 
)
inline

Definition at line 109 of file drawing-context.h.

References _ct, and surface().

◆ setSource() [3/5]

void Inkscape::DrawingContext::setSource ( double  r,
double  g,
double  b,
double  a = 1.0 
)
inline

Definition at line 112 of file drawing-context.h.

References _ct, and cairo_set_source_rgba().

◆ setSource() [4/5]

void Inkscape::DrawingContext::setSource ( DrawingSurface s)

◆ setSource() [5/5]

void Inkscape::DrawingContext::setSource ( guint32  rgba)

Definition at line 133 of file drawing-context.cpp.

References _ct, and ink_cairo_set_source_rgba32().

◆ setTolerance()

void Inkscape::DrawingContext::setTolerance ( double  tol)
inline

◆ stroke()

void Inkscape::DrawingContext::stroke ( )
inline

◆ strokePreserve()

void Inkscape::DrawingContext::strokePreserve ( )
inline

◆ surface()

DrawingSurface * Inkscape::DrawingContext::surface ( )
inline

Definition at line 128 of file drawing-context.h.

References _surface.

Referenced by Inkscape::DrawingItem::render(), and setSource().

◆ targetLogicalBounds()

Geom::Rect Inkscape::DrawingContext::targetLogicalBounds ( ) const

◆ transform()

◆ translate() [1/2]

void Inkscape::DrawingContext::translate ( double  dx,
double  dy 
)
inline

Definition at line 54 of file drawing-context.h.

References _ct.

◆ translate() [2/2]

void Inkscape::DrawingContext::translate ( Geom::Point const &  t)
inline

◆ user_to_device_distance()

void Inkscape::DrawingContext::user_to_device_distance ( double &  dx,
double &  dy 
)
inline

Definition at line 58 of file drawing-context.h.

References _ct.

Friends And Related Symbol Documentation

◆ DrawingSurface

friend class DrawingSurface
friend

Definition at line 138 of file drawing-context.h.

Member Data Documentation

◆ _ct

◆ _delete_surface

bool Inkscape::DrawingContext::_delete_surface
private

Definition at line 135 of file drawing-context.h.

Referenced by ~DrawingContext().

◆ _restore_context

bool Inkscape::DrawingContext::_restore_context
private

Definition at line 136 of file drawing-context.h.

Referenced by ~DrawingContext().

◆ _surface

DrawingSurface* Inkscape::DrawingContext::_surface
private

The documentation for this class was generated from the following files: