Ipelib
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ipe::CairoPainter Class Reference

#include <ipecairopainter.h>

Inherits ipe::Painter.

Inherited by JsonPainter.

Classes

struct  PdfState
 

Public Member Functions

 CairoPainter (const Cascade *sheet, Fonts *fonts, cairo_t *cc, double zoom, bool pretty, bool filterBest)
 
virtual ~CairoPainter ()
 
void setDimmed (bool dim)
 
void executeStream (const PdfDict *stream, const PdfDict *resources)
 
bool type3Font () const
 
- Public Member Functions inherited from ipe::Painter
 Painter (const Cascade *style)
 
virtual ~Painter ()
 
void setAttributeMap (const AttributeMap *map)
 
Attribute lookup (Kind kind, Attribute sym) const
 
void setBitmapCache (BitmapCache *bmc)
 
void transform (const Matrix &m)
 
void untransform (TTransformations trans)
 
void translate (const Vector &v)
 
void push ()
 
void pop ()
 
void pushMatrix ()
 
void popMatrix ()
 
void newPath ()
 
void moveTo (const Vector &v)
 
void lineTo (const Vector &v)
 
void curveTo (const Vector &v1, const Vector &v2, const Vector &v3)
 
void curveTo (const Bezier &bezier)
 
void rect (const Rect &re)
 
void drawEllipse ()
 
void drawArc (const Arc &arc)
 
void closePath ()
 
void drawPath (TPathMode mode)
 
void drawBitmap (Bitmap bitmap)
 
void drawExternalBitmap (String path)
 
void drawText (const Text *text)
 
void drawSymbol (Attribute symbol)
 
void addClipPath ()
 
void setStroke (Attribute color)
 
void setFill (Attribute color)
 
void setPen (Attribute pen)
 
void setDashStyle (Attribute dash)
 
void setLineCap (TLineCap cap)
 
void setLineJoin (TLineJoin join)
 
void setFillRule (TFillRule rule)
 
void setSymStroke (Attribute color)
 
void setSymFill (Attribute color)
 
void setSymPen (Attribute wid)
 
void setOpacity (Attribute opaq)
 
void setStrokeOpacity (Attribute opaq)
 
void setTiling (Attribute til)
 
void setGradient (Attribute grad)
 
void setStrokeGradient (Attribute grad)
 
const Cascade * cascade () const
 
Color stroke () const
 
Color fill () const
 
const Matrix & matrix () const
 
Fixed pen () const
 
String dashStyle () const
 
void dashStyle (std::vector< double > &dashes, double &offset) const
 
TLineCap lineCap () const
 
TLineJoin lineJoin () const
 
TFillRule fillRule () const
 
Color symStroke () const
 
Color symFill () const
 
Fixed symPen () const
 
Fixed opacity () const
 
Fixed strokeOpacity () const
 
Attribute tiling () const
 
Attribute gradient () const
 
Attribute strokeGradient () const
 
const State & state () const
 
void setState (const State &state)
 

Protected Member Functions

virtual void doPush () override
 
virtual void doPop () override
 
virtual void doMoveTo (const Vector &v) override
 
virtual void doLineTo (const Vector &v) override
 
virtual void doCurveTo (const Vector &v1, const Vector &v2, const Vector &v3) override
 
virtual void doClosePath () override
 
virtual void doDrawArc (const Arc &arc) override
 
virtual void doAddClipPath () override
 
virtual void doDrawPath (TPathMode mode) override
 
virtual void doDrawBitmap (Bitmap bitmap) override
 
virtual void doDrawText (const Text *text) override
 
virtual void drawGlyphs (std::vector< cairo_glyph_t > &glyphs)
 
const PdfDict * findResource (String kind, String name)
 
void collectGlyphs (String s, std::vector< cairo_glyph_t > &glyphs, Vector &textPos)
 
void execute (const PdfDict *stream, const PdfDict *resources, bool applyMatrix=true)
 
void clearArgs ()
 
void opcm ()
 
void opBT ()
 
void opET ()
 
void opTf ()
 
void opTm ()
 
void opTd (bool setLeading)
 
void opTstar ()
 
void opTc (double *p)
 
void opTz ()
 
void opTJ ()
 
void opTj (bool nextLine, bool setSpacing)
 
void opk (bool stroke)
 
void opg (bool stroke)
 
void oprg (bool stroke)
 
void opscn (bool stroke)
 
void opw ()
 
void opd ()
 
void opDo ()
 
void opi ()
 
void opj ()
 
void opJ ()
 
void opM ()
 
void opW (bool eofill)
 
void opgs ()
 
void opm ()
 
void opl ()
 
void opc ()
 
void opy ()
 
void opv ()
 
void oph ()
 
void opq ()
 
void opQ ()
 
void opre ()
 
void opn ()
 
virtual void opStrokeFill (bool close, bool fill, bool stroke, bool eofill)
 
void opsh ()
 
void createPattern ()
 
void setGradientPattern (const Gradient *g, double opacity)
 
- Protected Member Functions inherited from ipe::Painter
virtual void doNewPath ()
 
virtual void doDrawSymbol (Attribute symbol)
 
void drawArcAsBezier (double alpha)
 

Static Protected Member Functions

static void cairoMatrix (cairo_matrix_t &cm, const Matrix &m)
 
static void cairoTransform (cairo_t *cr, const Matrix &m)
 
static void drawImage (cairo_t *cr, const PdfDict *d, const PdfResourceBase *r, double opacity, bool filterBest)
 

Protected Attributes

Fonts * iFonts
 
cairo_t * iCairo
 
double iZoom
 
bool iPretty
 
bool iDimmed
 
bool iAfterMoveTo
 
bool iFilterBest
 
bool iType3Font
 
std::vector< const PdfObj * > iArgs
 
std::vector< const PdfDict * > iResourceStack
 
std::vector< PdfState > iPdfState
 
Matrix iTextMatrix
 
Matrix iTextLineMatrix
 
- Protected Attributes inherited from ipe::Painter
std::list< State > iState
 
std::list< Matrix > iMatrix
 
const Cascade * iCascade
 
const AttributeMap * iAttributeMap
 
BitmapCache * iBitmapCache
 
int iInPath
 

Detailed Description

Ipe Painter using Cairo and Freetype as a backend.

This painter draws to a Cairo surface.

Constructor & Destructor Documentation

◆ CairoPainter()

CairoPainter::CairoPainter ( const Cascade *  sheet,
Fonts *  fonts,
cairo_t *  cc,
double  zoom,
bool  pretty,
bool  filterBest 
)

Construct a painter.

zoom one means 72 pixels per inch. Set pretty to true to avoid drawing text without Latex.

References iDimmed.

◆ ~CairoPainter()

virtual ipe::CairoPainter::~CairoPainter ( )
inlinevirtual

Member Function Documentation

◆ setDimmed()

void ipe::CairoPainter::setDimmed ( bool  dim)
inline

References iDimmed.

Referenced by ipe::CanvasBase::drawObjects().

◆ executeStream()

void CairoPainter::executeStream ( const PdfDict *  stream,
const PdfDict *  resources 
)

◆ type3Font()

bool ipe::CairoPainter::type3Font ( ) const
inline

References iType3Font.

Referenced by ipe::CanvasBase::drawObjects().

◆ doPush()

void CairoPainter::doPush ( )
overrideprotectedvirtual

Perform graphics state push on output medium.

Reimplemented from ipe::Painter.

References iCairo.

◆ doPop()

void CairoPainter::doPop ( )
overrideprotectedvirtual

Perform graphics state pop on output medium.

Reimplemented from ipe::Painter.

References iCairo.

◆ doMoveTo()

void CairoPainter::doMoveTo ( const Vector &  v)
overrideprotectedvirtual

Perform moveto operator.

The transformation matrix has already been applied.

Reimplemented from ipe::Painter.

References iAfterMoveTo, iCairo, ipe::Vector::x, and ipe::Vector::y.

◆ doLineTo()

void CairoPainter::doLineTo ( const Vector &  v)
overrideprotectedvirtual

Perform lineto operator.

The transformation matrix has already been applied.

Reimplemented from ipe::Painter.

References iAfterMoveTo, iCairo, ipe::Vector::x, and ipe::Vector::y.

◆ doCurveTo()

void CairoPainter::doCurveTo ( const Vector &  v1,
const Vector &  v2,
const Vector &  v3 
)
overrideprotectedvirtual

Perform curveto operator.

The transformation matrix has already been applied.

Reimplemented from ipe::Painter.

References iAfterMoveTo, iCairo, ipe::Vector::x, and ipe::Vector::y.

◆ doClosePath()

void CairoPainter::doClosePath ( )
overrideprotectedvirtual

Perform closepath operator.

Reimplemented from ipe::Painter.

References iCairo.

◆ doDrawArc()

void CairoPainter::doDrawArc ( const Arc &  arc)
overrideprotectedvirtual

Draw an elliptic arc.

The default implementations calls drawArcAsBezier(). The transformation matrix has not yet been applied to arc.

Reimplemented from ipe::Painter.

References cairoTransform(), iAfterMoveTo, ipe::Arc::iAlpha, ipe::Arc::iBeta, iCairo, ipe::Arc::iM, ipe::Arc::isEllipse(), and ipe::Painter::matrix().

◆ doAddClipPath()

void CairoPainter::doAddClipPath ( )
overrideprotectedvirtual

Add a clip path.

Reimplemented from ipe::Painter.

References iCairo.

◆ doDrawPath()

void CairoPainter::doDrawPath ( TPathMode  mode)
overrideprotectedvirtual

◆ doDrawBitmap()

void CairoPainter::doDrawBitmap ( Bitmap  bitmap)
overrideprotectedvirtual

◆ doDrawText()

void CairoPainter::doDrawText ( const Text *  text)
overrideprotectedvirtual

◆ drawGlyphs()

void CairoPainter::drawGlyphs ( std::vector< cairo_glyph_t > &  glyphs)
protectedvirtual

◆ findResource()

const PdfDict * CairoPainter::findResource ( String  kind,
String  name 
)
protected

◆ collectGlyphs()

void CairoPainter::collectGlyphs ( String  s,
std::vector< cairo_glyph_t > &  glyphs,
Vector &  textPos 
)
protected

◆ execute()

void CairoPainter::execute ( const PdfDict *  stream,
const PdfDict *  resources,
bool  applyMatrix = true 
)
protected

◆ clearArgs()

void CairoPainter::clearArgs ( )
protected

Clear PDF argument stack.

References iArgs.

Referenced by execute().

◆ opcm()

void CairoPainter::opcm ( )
protected

References ipe::Matrix::a, cairoTransform(), iArgs, and iCairo.

Referenced by execute().

◆ opBT()

void CairoPainter::opBT ( )
protected

References iTextLineMatrix, and iTextMatrix.

Referenced by execute().

◆ opET()

void CairoPainter::opET ( )
protected

Referenced by execute().

◆ opTf()

void CairoPainter::opTf ( )
protected

◆ opTm()

void CairoPainter::opTm ( )
protected

References ipe::Matrix::a, iArgs, iTextLineMatrix, and iTextMatrix.

Referenced by execute().

◆ opTd()

void CairoPainter::opTd ( bool  setLeading)
protected

References iArgs, iPdfState, iTextLineMatrix, iTextMatrix, and ipe::Vector::y.

Referenced by execute().

◆ opTstar()

void CairoPainter::opTstar ( )
protected

References iArgs, iPdfState, iTextLineMatrix, and iTextMatrix.

Referenced by execute().

◆ opTc()

void CairoPainter::opTc ( double *  p)
protected

References iArgs.

Referenced by execute().

◆ opTz()

void CairoPainter::opTz ( )
protected

References iArgs, and iPdfState.

Referenced by execute().

◆ opTJ()

void CairoPainter::opTJ ( )
protected

◆ opTj()

void CairoPainter::opTj ( bool  nextLine,
bool  setSpacing 
)
protected

◆ opk()

void CairoPainter::opk ( bool  stroke)
protected

References iArgs, iPdfState, and ipe::Painter::stroke().

Referenced by execute().

◆ opg()

void CairoPainter::opg ( bool  stroke)
protected

References iArgs, iPdfState, and ipe::Painter::stroke().

Referenced by execute().

◆ oprg()

void CairoPainter::oprg ( bool  stroke)
protected

References iArgs, iPdfState, and ipe::Painter::stroke().

Referenced by execute().

◆ opscn()

void CairoPainter::opscn ( bool  stroke)
protected

◆ opw()

void CairoPainter::opw ( )
protected

References iArgs, and iCairo.

Referenced by execute().

◆ opd()

void CairoPainter::opd ( )
protected

◆ opDo()

void CairoPainter::opDo ( )
protected

◆ opi()

void CairoPainter::opi ( )
protected

References iArgs.

Referenced by execute().

◆ opj()

void CairoPainter::opj ( )
protected

References iArgs, and iCairo.

Referenced by execute().

◆ opJ()

void CairoPainter::opJ ( )
protected

References iArgs, and iCairo.

Referenced by execute().

◆ opM()

void CairoPainter::opM ( )
protected

References iArgs, and iCairo.

Referenced by execute().

◆ opW()

void CairoPainter::opW ( bool  eofill)
protected

References iCairo.

Referenced by execute().

◆ opgs()

void CairoPainter::opgs ( )
protected

◆ opm()

void CairoPainter::opm ( )
protected

References iArgs, iCairo, ipe::Vector::x, and ipe::Vector::y.

Referenced by execute().

◆ opl()

void CairoPainter::opl ( )
protected

References iArgs, iCairo, ipe::Vector::x, and ipe::Vector::y.

Referenced by execute().

◆ opc()

void CairoPainter::opc ( )
protected

References iArgs, iCairo, ipe::Vector::x, and ipe::Vector::y.

Referenced by execute().

◆ opy()

void CairoPainter::opy ( )
protected

References iArgs, iCairo, ipe::Vector::x, and ipe::Vector::y.

Referenced by execute().

◆ opv()

void CairoPainter::opv ( )
protected

References iArgs, iCairo, ipe::Vector::x, and ipe::Vector::y.

Referenced by execute().

◆ oph()

void CairoPainter::oph ( )
protected

References iArgs, and iCairo.

Referenced by execute().

◆ opq()

void CairoPainter::opq ( )
protected

References iArgs, iCairo, and iPdfState.

Referenced by execute().

◆ opQ()

void CairoPainter::opQ ( )
protected

References iArgs, iCairo, and iPdfState.

Referenced by execute().

◆ opre()

void CairoPainter::opre ( )
protected

References iArgs, iCairo, ipe::Vector::x, and ipe::Vector::y.

Referenced by execute().

◆ opn()

void CairoPainter::opn ( )
protected

References iCairo.

Referenced by execute().

◆ opStrokeFill()

void CairoPainter::opStrokeFill ( bool  close,
bool  fill,
bool  stroke,
bool  eofill 
)
protectedvirtual

◆ opsh()

void CairoPainter::opsh ( )
protected

References findResource(), iArgs, iCairo, iFonts, and ipe::Fonts::resources().

Referenced by execute().

◆ createPattern()

void CairoPainter::createPattern ( )
protected

◆ setGradientPattern()

void CairoPainter::setGradientPattern ( const Gradient *  g,
double  opacity 
)
protected

◆ cairoMatrix()

void CairoPainter::cairoMatrix ( cairo_matrix_t &  cm,
const Matrix &  m 
)
staticprotected

◆ cairoTransform()

void CairoPainter::cairoTransform ( cairo_t *  cr,
const Matrix &  m 
)
staticprotected

◆ drawImage()

void CairoPainter::drawImage ( cairo_t *  cr,
const PdfDict *  d,
const PdfResourceBase *  r,
double  opacity,
bool  filterBest 
)
staticprotected

Member Data Documentation

◆ iFonts

Fonts* ipe::CairoPainter::iFonts
protected

◆ iCairo

cairo_t* ipe::CairoPainter::iCairo
protected

◆ iZoom

double ipe::CairoPainter::iZoom
protected

Referenced by doDrawText().

◆ iPretty

bool ipe::CairoPainter::iPretty
protected

Referenced by doDrawText().

◆ iDimmed

bool ipe::CairoPainter::iDimmed
protected

Referenced by CairoPainter(), doDrawText(), and setDimmed().

◆ iAfterMoveTo

bool ipe::CairoPainter::iAfterMoveTo
protected

◆ iFilterBest

bool ipe::CairoPainter::iFilterBest
protected

Referenced by doDrawBitmap(), doDrawPath(), and opDo().

◆ iType3Font

bool ipe::CairoPainter::iType3Font
protected

Referenced by opTf(), and type3Font().

◆ iArgs

std::vector<const PdfObj *> ipe::CairoPainter::iArgs
protected

◆ iResourceStack

std::vector<const PdfDict *> ipe::CairoPainter::iResourceStack
protected

Referenced by execute(), and findResource().

◆ iPdfState

std::vector<PdfState> ipe::CairoPainter::iPdfState
protected

◆ iTextMatrix

Matrix ipe::CairoPainter::iTextMatrix
protected

◆ iTextLineMatrix

Matrix ipe::CairoPainter::iTextLineMatrix
protected

Referenced by opBT(), opTd(), opTj(), opTm(), and opTstar().


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