78 if( cairo_surface_status(
m_surface ) != CAIRO_STATUS_SUCCESS )
87 if( cairo_status(
m_context ) != CAIRO_STATUS_SUCCESS )
98 cairo_set_antialias(
m_context, CAIRO_ANTIALIAS_DEFAULT );
100 cairo_set_antialias(
m_context, CAIRO_ANTIALIAS_NONE );
111 cairo_set_line_cap(
m_context, CAIRO_LINE_CAP_ROUND );
112 cairo_set_line_join(
m_context, CAIRO_LINE_JOIN_ROUND );
135 cairo_status_t status = cairo_surface_write_to_png(
m_surface, aPath.ToUTF8().data() );
137 return status == CAIRO_STATUS_SUCCESS;
148 cairo_set_line_width(
m_context, deviceWidth > 0 ? deviceWidth : 1.0 );
159 cairo_set_source_rgba(
m_context, aColor.
r, aColor.
g, aColor.
b, aColor.
a );
167 cairo_set_operator(
m_context, aClear ? CAIRO_OPERATOR_CLEAR : CAIRO_OPERATOR_OVER );
177 cairo_set_dash(
m_context,
nullptr, 0, 0 );
202 double x = std::min( start.
x,
end.x );
203 double y = std::min( start.
y,
end.y );
240 FILL_T aFill,
int aWidth )
250 double startRad = aStartAngle.
AsRadians();
251 double endRad = ( aStartAngle + aAngle ).AsRadians();
305 if( !
m_context || aCornerList.size() < 2 )
311 for(
size_t i = 1; i < aCornerList.size(); i++ )
342 int width = std::min( aSize.
x, aSize.
y );
343 int len = std::max( aSize.
x, aSize.
y ) - width;
354 if( aSize.
x > aSize.
y )
379 std::vector<VECTOR2I> corners;
381 int dx = aSize.
x / 2;
382 int dy = aSize.
y / 2;
384 corners.push_back(
VECTOR2I( -dx, -dy ) );
385 corners.push_back(
VECTOR2I( -dx, dy ) );
386 corners.push_back(
VECTOR2I( dx, dy ) );
387 corners.push_back(
VECTOR2I( dx, -dy ) );
410 std::vector<VECTOR2I> corners;
413 corners.push_back( poly.
CPoint( i ) );
429 std::vector<VECTOR2I> corners;
431 for(
int j = 0; j < outline.
PointCount(); j++ )
432 corners.push_back( outline.
CPoint( j ) );
442 std::vector<VECTOR2I> corners;
444 for(
int i = 0; i < 4; i++ )
449 corners.push_back( corner );
459 std::vector<VECTOR2I> corners;
460 double radius = aDiameter / 2.0;
463 for(
int i = 0; i < aCornerCount; i++ )
468 corners.push_back( corner );
516 cairo_rectangle(
m_context, aX, aY, aWidth, aHeight );
526 cairo_rectangle(
m_context, aX, aY, aWidth, aHeight );
A color representation with 4 components: red, green, blue, alpha.
int GetPlotterArcHighDef() const
double m_plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, void *aData)
virtual void SetCurrentLineWidth(int aWidth, void *aData=nullptr) override
Set the line width for the next drawing.
void fillCircle(double aCx, double aCy, double aRadius)
virtual void FlashPadRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, void *aData) override
cairo_surface_t * m_surface
virtual void PenTo(const VECTOR2I &aPos, char aPlume) override
Moveto/lineto primitive, moves the 'pen' to the specified direction.
virtual void FlashRegularPolygon(const VECTOR2I &aShapePos, int aDiameter, int aCornerCount, const EDA_ANGLE &aOrient, void *aData) override
Flash a regular polygon.
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle) override
virtual void Circle(const VECTOR2I &aCenter, int aDiameter, FILL_T aFill, int aWidth) override
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T aFill, int aWidth, int aCornerRadius=0) override
virtual void Arc(const VECTOR2D &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aRadius, FILL_T aFill, int aWidth) override
bool SaveFile(const wxString &aPath)
Save the rendered image to a PNG file.
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, void *aData) override
virtual bool EndPlot() override
COLOR4D m_backgroundColor
virtual VECTOR2D userToDeviceCoordinates(const VECTOR2I &aCoordinate) override
Transform coordinates from user space (IU) to device space (pixels).
void fillRect(double aX, double aY, double aWidth, double aHeight)
void strokeCircle(double aCx, double aCy, double aRadius)
virtual void FlashPadCircle(const VECTOR2I &aPadPos, int aDiameter, void *aData) override
virtual void SetColor(const COLOR4D &aColor) override
virtual void FlashPadTrapez(const VECTOR2I &aPadPos, const VECTOR2I *aCorners, const EDA_ANGLE &aPadOrient, void *aData) override
Flash a trapezoidal pad.
virtual void FlashPadRoundRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient, void *aData) override
virtual VECTOR2D userToDeviceSize(const VECTOR2I &aSize) override
Transform a size from user space to device space.
virtual void FlashPadCustom(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, SHAPE_POLY_SET *aPolygons, void *aData) override
void strokeRect(double aX, double aY, double aWidth, double aHeight)
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth, void *aData=nullptr) override
Draw a polygon ( filled or not ).
void SetClearCompositing(bool aClear)
Switch the Cairo compositing operator between CLEAR and OVER.
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual bool StartPlot(const wxString &aPageNumber) override
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
Represent a set of closed polygons.
int OutlineCount() const
Return the number of outlines in the set.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aPosition, const VECTOR2I &aSize, const EDA_ANGLE &aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aInflate, int aError, ERROR_LOC aErrorLoc)
Convert a rectangle with rounded corners and/or chamfered corners to a polygon.
static constexpr EDA_ANGLE ANGLE_360
@ FILLED_SHAPE
Fill with object color.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
LINE_STYLE
Dashed line types.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D