KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
plotters_pslike.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
26#pragma once
27
28#include "plotter.h"
29
30
35class PSLIKE_PLOTTER : public PLOTTER
36{
37public:
38 PSLIKE_PLOTTER( const PROJECT* aProject = nullptr) :
39 PLOTTER( aProject ),
40 plotScaleAdjX( 1 ),
41 plotScaleAdjY( 1 ),
43 {
44 }
45
49 virtual void SetTextMode( PLOT_TEXT_MODE mode ) override
50 {
51 if( mode != PLOT_TEXT_MODE::DEFAULT )
52 m_textMode = mode;
53 }
54
58 void SetScaleAdjust( double scaleX, double scaleY )
59 {
60 plotScaleAdjX = scaleX;
61 plotScaleAdjY = scaleY;
62 }
63
64 // Pad routines are handled with lower level primitives
65 virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter,
66 OUTLINE_MODE aTraceMode, void* aData ) override;
67 virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
68 const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
69 void* aData ) override;
70 virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
71 const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
72 void* aData ) override;
73 virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
74 int aCornerRadius, const EDA_ANGLE& aOrient,
75 OUTLINE_MODE aTraceMode, void* aData ) override;
76 virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
77 const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons,
78 OUTLINE_MODE aTraceMode, void* aData ) override;
79 virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
80 const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
81 void* aData ) override;
82 virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
83 const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
84 void* aData ) override;
85
90 virtual void SetColor( const COLOR4D& color ) override;
91
92protected:
100 void computeTextParameters( const VECTOR2I& aPos,
101 const wxString& aText,
102 const EDA_ANGLE& aOrient,
103 const VECTOR2I& aSize,
104 bool aMirror,
105 enum GR_TEXT_H_ALIGN_T aH_justify,
106 enum GR_TEXT_V_ALIGN_T aV_justify,
107 int aWidth,
108 bool aItalic,
109 bool aBold,
110 double *wideningFactor,
111 double *ctm_a,
112 double *ctm_b,
113 double *ctm_c,
114 double *ctm_d,
115 double *ctm_e,
116 double *ctm_f,
117 double *heightFactor );
118
121 virtual std::string encodeStringForPlotter( const wxString& aUnicode );
122
124 virtual void emitSetRGBColor( double r, double g, double b, double a ) = 0;
125
127 static const double postscriptTextAscent; // = 0.718;
128
134 int returnPostscriptTextWidth( const wxString& aText, int aXSize, bool aItalic, bool aBold );
135
138
141};
142
143
145{
146public:
147 PS_PLOTTER( const PROJECT* aProject = nullptr ) :
148 PSLIKE_PLOTTER( aProject )
149 {
150 // The phantom plot in postscript is an hack and reportedly
151 // crashes Adobe's own postscript interpreter!
152 m_textMode = PLOT_TEXT_MODE::STROKE;
153 }
154
155 static wxString GetDefaultFileExtension()
156 {
157 return wxString( wxT( "ps" ) );
158 }
159
160 virtual PLOT_FORMAT GetPlotterType() const override
161 {
162 return PLOT_FORMAT::POST;
163 }
164
178 virtual bool StartPlot( const wxString& aPageNumber ) override;
179 virtual bool EndPlot() override;
180
184 virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) override;
185
189 virtual void SetDash( int aLineWidth, LINE_STYLE aLineStyle ) override;
190
191 virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
192 double aScale, bool aMirror ) override;
193 virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
194 int width = USE_DEFAULT_LINE_WIDTH ) override;
195 virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
196 int width = USE_DEFAULT_LINE_WIDTH ) override;
197 virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
198 const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
199 int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
200
201 virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
202 int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
203
207 virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos,
208 double aScaleFactor ) override;
209
210 virtual void PenTo( const VECTOR2I& pos, char plume ) override;
211 virtual void Text( const VECTOR2I& aPos,
212 const COLOR4D& aColor,
213 const wxString& aText,
214 const EDA_ANGLE& aOrient,
215 const VECTOR2I& aSize,
216 enum GR_TEXT_H_ALIGN_T aH_justify,
217 enum GR_TEXT_V_ALIGN_T aV_justify,
218 int aWidth,
219 bool aItalic,
220 bool aBold,
221 bool aMultilineAllowed,
222 KIFONT::FONT* aFont,
223 const KIFONT::METRICS& aFontMetrics,
224 void* aData = nullptr ) override;
225
226 virtual void PlotText( const VECTOR2I& aPos,
227 const COLOR4D& aColor,
228 const wxString& aText,
229 const TEXT_ATTRIBUTES& aAttributes,
230 KIFONT::FONT* aFont,
231 const KIFONT::METRICS& aFontMetrics,
232 void* aData = nullptr ) override;
233
234
235protected:
236 virtual void emitSetRGBColor( double r, double g, double b, double a ) override;
237};
238
239
241{
242public:
243 PDF_PLOTTER( const PROJECT* aProject = nullptr ) :
244 PSLIKE_PLOTTER( aProject ),
245 m_pageTreeHandle( 0 ),
248 m_jsNamesHandle( 0 ),
251 m_workFile( nullptr ),
253 {
254 }
255
256 virtual PLOT_FORMAT GetPlotterType() const override
257 {
258 return PLOT_FORMAT::PDF;
259 }
260
261 static wxString GetDefaultFileExtension()
262 {
263 return wxString( wxT( "pdf" ) );
264 }
265
275 virtual bool OpenFile( const wxString& aFullFilename ) override;
276
281 virtual bool StartPlot( const wxString& aPageNumber ) override;
282
283 virtual bool StartPlot( const wxString& aPageNumber,
284 const wxString& aPageName = wxEmptyString );
285
286 virtual bool EndPlot() override;
287
291 virtual void StartPage( const wxString& aPageNumber,
292 const wxString& aPageName = wxEmptyString,
293 const wxString& aParentPageNumber = wxEmptyString,
294 const wxString& aParentPageName = wxEmptyString );
295
299 virtual void ClosePage();
300
309 virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) override;
310
314 virtual void SetDash( int aLineWidth, LINE_STYLE aLineStyle ) override;
315
320 virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
321 double aScale, bool aMirror ) override;
322
326 virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
327 int width = USE_DEFAULT_LINE_WIDTH ) override;
328
332 virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
333 int width = USE_DEFAULT_LINE_WIDTH ) override;
334
338 virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
339 const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
340 int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
341
345 virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
346 int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
347
348 virtual void PenTo( const VECTOR2I& pos, char plume ) override;
349
350 virtual void Text( const VECTOR2I& aPos,
351 const COLOR4D& aColor,
352 const wxString& aText,
353 const EDA_ANGLE& aOrient,
354 const VECTOR2I& aSize,
355 enum GR_TEXT_H_ALIGN_T aH_justify,
356 enum GR_TEXT_V_ALIGN_T aV_justify,
357 int aWidth,
358 bool aItalic,
359 bool aBold,
360 bool aMultilineAllowed,
361 KIFONT::FONT* aFont,
362 const KIFONT::METRICS& aFontMetrics,
363 void* aData = nullptr ) override;
364
365 virtual void PlotText( const VECTOR2I& aPos,
366 const COLOR4D& aColor,
367 const wxString& aText,
368 const TEXT_ATTRIBUTES& aAttributes,
369 KIFONT::FONT* aFont,
370 const KIFONT::METRICS& aFontMetrics,
371 void* aData = nullptr ) override;
372
373 void HyperlinkBox( const BOX2I& aBox, const wxString& aDestinationURL ) override;
374
375 void HyperlinkMenu( const BOX2I& aBox, const std::vector<wxString>& aDestURLs ) override;
376
377 void Bookmark( const BOX2I& aBox, const wxString& aName,
378 const wxString& aGroupName = wxEmptyString ) override;
379
383 void PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double aScaleFactor ) override;
384
385
386protected:
388 {
390 wxString title;
392
393 std::vector<OUTLINE_NODE*> children;
394
396 {
397 std::for_each( children.begin(), children.end(),
398 []( OUTLINE_NODE* node )
399 {
400 delete node;
401 } );
402 }
403
404 OUTLINE_NODE* AddChild( int aActionHandle, const wxString& aTitle, int aEntryHandle )
405 {
406 OUTLINE_NODE* child = new OUTLINE_NODE
407 {
408 aActionHandle, aTitle, aEntryHandle, {}
409 };
410
411 children.push_back( child );
412
413 return child;
414 }
415 };
416
427 OUTLINE_NODE* addOutlineNode( OUTLINE_NODE* aParent, int aActionHandle,
428 const wxString& aTitle );
429
432 std::string encodeStringForPlotter( const wxString& aUnicode ) override;
433
443 virtual void emitSetRGBColor( double r, double g, double b, double a ) override;
444
451 int allocPdfObject();
452
457 int startPdfObject( int handle = -1 );
458
462 void closePdfObject();
463
471 int startPdfStream( int handle = -1 );
472
476 void closePdfStream();
477
481 int emitOutline();
482
486 void emitOutlineNode( OUTLINE_NODE* aNode, int aParentHandle, int aNextNode, int aPrevNode );
487
493 int emitGoToAction( int aPageHandle, const VECTOR2I& aBottomLeft, const VECTOR2I& aTopRight );
494 int emitGoToAction( int aPageHandle );
495
500 std::vector<int> m_pageHandles;
503
505 wxString m_pageName;
507
509 std::vector<long> m_xrefTable;
510
512 std::vector<wxString> m_pageNumbers;
513
515 std::vector<std::pair<BOX2I, wxString>> m_hyperlinksInPage;
516 std::vector<std::pair<BOX2I, std::vector<wxString>>> m_hyperlinkMenusInPage;
517
519 std::map<int, std::pair<BOX2D, wxString>> m_hyperlinkHandles;
520 std::map<int, std::pair<BOX2D, std::vector<wxString>>> m_hyperlinkMenuHandles;
521
522 std::map<wxString, std::vector<std::pair<BOX2I, wxString>>> m_bookmarksInPage;
523
524 std::map<int, wxImage> m_imageHandles;
525
526 std::unique_ptr<OUTLINE_NODE> m_outlineRoot;
528};
529
530
532{
533public:
534 SVG_PLOTTER( const PROJECT* aProject = nullptr );
535
536 static wxString GetDefaultFileExtension()
537 {
538 return wxString( wxT( "svg" ) );
539 }
540
541 virtual PLOT_FORMAT GetPlotterType() const override
542 {
543 return PLOT_FORMAT::SVG;
544 }
545
549 virtual bool StartPlot( const wxString& aPageNumber ) override;
550 virtual bool EndPlot() override;
551
555 virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) override;
556
560 virtual void SetDash( int aLineWidth, LINE_STYLE aLineStyle ) override;
561
562 virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
563 double aScale, bool aMirror ) override;
564 virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
565 int width = USE_DEFAULT_LINE_WIDTH ) override;
566 virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
567 int width = USE_DEFAULT_LINE_WIDTH ) override;
568 virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
569 const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
570 int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
571
572 virtual void BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1,
573 const VECTOR2I& aControl2, const VECTOR2I& aEnd,
574 int aTolerance,
575 int aLineThickness = USE_DEFAULT_LINE_WIDTH ) override;
576
577 virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
578 int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = nullptr ) override;
579
583 virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos,
584 double aScaleFactor ) override;
585
586 virtual void PenTo( const VECTOR2I& pos, char plume ) override;
587
598 virtual void SetSvgCoordinatesFormat( unsigned aPrecision ) override;
599
605 virtual void StartBlock( void* aData ) override;
606
612 virtual void EndBlock( void* aData ) override;
613
614 virtual void Text( const VECTOR2I& aPos,
615 const COLOR4D& aColor,
616 const wxString& aText,
617 const EDA_ANGLE& aOrient,
618 const VECTOR2I& aSize,
619 enum GR_TEXT_H_ALIGN_T aH_justify,
620 enum GR_TEXT_V_ALIGN_T aV_justify,
621 int aWidth,
622 bool aItalic,
623 bool aBold,
624 bool aMultilineAllowed,
625 KIFONT::FONT* aFont,
626 const KIFONT::METRICS& aFontMetrics,
627 void* aData = nullptr ) override;
628
629
630 virtual void PlotText( const VECTOR2I& aPos,
631 const COLOR4D& aColor,
632 const wxString& aText,
633 const TEXT_ATTRIBUTES& aAttributes,
634 KIFONT::FONT* aFont,
635 const KIFONT::METRICS& aFontMetrics,
636 void* aData = nullptr ) override;
637
638protected:
643 virtual void emitSetRGBColor( double r, double g, double b, double a ) override;
644
651 void setSVGPlotStyle( int aLineWidth, bool aIsGroup = true,
652 const std::string& aExtraStyle = {} );
653
657 void setFillMode( FILL_T fill );
658
659 FILL_T m_fillMode; // true if the current contour rect, arc, circle, polygon must
660 // be filled
661 uint32_t m_pen_rgb_color; // current rgb color value: each color has a value 0 ... 255,
662 // and the 3 colors are grouped in a 3x8 bits value (written
663 // in hex to svg files)
664 uint32_t m_brush_rgb_color; // same as m_pen_rgb_color, used to fill some contours.
666 bool m_graphics_changed; // true if a pen/brush parameter is modified color, pen size,
667 // fill mode ... the new SVG stype must be output on file
668 LINE_STYLE m_dashed; // plot line style
669 unsigned m_precision; // How fine the step size is
670 // Use 3-6 (3 means um precision, 6 nm precision) in PcbNew
671 // 3-4 in other modules (avoid values >4 to avoid overflow)
672 // see also comment for m_useInch.
673};
int color
Definition: DXF_plotter.cpp:60
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:131
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
std::vector< int > m_pageHandles
Handles to the page objects.
FILE * m_workFile
Temporary file to construct the stream before zipping.
wxString m_parentPageName
virtual void ClosePage()
Close the current page in the PDF document (and emit its compressed stream).
void emitOutlineNode(OUTLINE_NODE *aNode, int aParentHandle, int aNextNode, int aPrevNode)
Emits a outline item object and recurses into any children.
std::map< int, wxImage > m_imageHandles
int emitOutline()
Starts emitting the outline object.
virtual bool EndPlot() override
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr) override
Polygon plotting for PDF.
virtual void SetCurrentLineWidth(int width, void *aData=nullptr) override
Pen width setting for PDF.
int m_streamLengthHandle
Handle to the deferred stream length.
void PlotImage(const wxImage &aImage, const VECTOR2I &aPos, double aScaleFactor) override
PDF images are handles as inline, not XObject streams...
int m_jsNamesHandle
Handle for Names dictionary with JS.
wxString m_pageName
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle) override
PDF supports dashed lines.
void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs) override
Create a clickable hyperlink menu with a rectangular click area.
virtual bool OpenFile(const wxString &aFullFilename) override
Open or create the plot file aFullFilename.
int m_fontResDictHandle
Font resource dictionary.
virtual void emitSetRGBColor(double r, double g, double b, double a) override
PDF supports colors fully.
int startPdfStream(int handle=-1)
Start a PDF stream (for the page).
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Rectangles in PDF.
PDF_PLOTTER(const PROJECT *aProject=nullptr)
virtual void Arc(const VECTOR2D &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aRadius, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH) override
The PDF engine can't directly plot arcs so we use polygonization.
std::map< int, std::pair< BOX2D, wxString > > m_hyperlinkHandles
Handles for all the hyperlink objects that will be deferred.
int m_pageTreeHandle
Handle to the root of the page tree object.
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr) override
Draw text with the plotter.
int emitGoToAction(int aPageHandle, const VECTOR2I &aBottomLeft, const VECTOR2I &aTopRight)
Emit an action object that instructs a goto coordinates on a page.
void closePdfStream()
Finish the current PDF stream (writes the deferred length, too).
void Bookmark(const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString) override
Create a bookmark to a symbol.
std::vector< long > m_xrefTable
The PDF xref offset table.
void HyperlinkBox(const BOX2I &aBox, const wxString &aDestinationURL) override
Create a clickable hyperlink with a rectangular click area.
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Circle drawing for PDF.
virtual void PenTo(const VECTOR2I &pos, char plume) override
Moveto/lineto primitive, moves the 'pen' to the specified direction.
std::map< wxString, std::vector< std::pair< BOX2I, wxString > > > m_bookmarksInPage
virtual bool StartPlot(const wxString &aPageNumber) override
The PDF engine supports multiple pages; the first one is opened 'for free' the following are to be cl...
static wxString GetDefaultFileExtension()
int startPdfObject(int handle=-1)
Open a new PDF object and returns the handle if the parameter is -1.
virtual void StartPage(const wxString &aPageNumber, const wxString &aPageName=wxEmptyString, const wxString &aParentPageNumber=wxEmptyString, const wxString &aParentPageName=wxEmptyString)
Start a new page in the PDF document.
OUTLINE_NODE * addOutlineNode(OUTLINE_NODE *aParent, int aActionHandle, const wxString &aTitle)
Add a new outline node entry.
int m_imgResDictHandle
Image resource dictionary.
std::string encodeStringForPlotter(const wxString &aUnicode) override
convert a wxString unicode string to a char string compatible with the accepted string PDF format (co...
Definition: PDF_plotter.cpp:55
std::vector< wxString > m_pageNumbers
List of user-space page numbers for resolving internal hyperlinks.
int allocPdfObject()
Allocate a new handle in the table of the PDF object.
wxString m_workFilename
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
PDF can have multiple pages, so SetPageSettings can be called with the outputFile open (but not insid...
std::map< int, std::pair< BOX2D, std::vector< wxString > > > m_hyperlinkMenuHandles
int m_pageStreamHandle
Handle of the page content object.
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr) override
std::vector< std::pair< BOX2I, wxString > > m_hyperlinksInPage
List of loaded hyperlinks in current page.
std::unique_ptr< OUTLINE_NODE > m_outlineRoot
Root outline node.
std::vector< std::pair< BOX2I, std::vector< wxString > > > m_hyperlinkMenusInPage
void closePdfObject()
Close the current PDF object.
virtual PLOT_FORMAT GetPlotterType() const override
Return the effective plot engine in use.
int m_totalOutlineNodes
Total number of outline nodes.
Base plotter engine class.
Definition: plotter.h:105
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:109
Container for project specific data.
Definition: project.h:64
The PSLIKE_PLOTTER class is an intermediate class to handle common routines for engines working more ...
static const double postscriptTextAscent
Height of the postscript font (from the AFM)
void SetScaleAdjust(double scaleX, double scaleY)
Set the 'fine' scaling for the postscript engine.
virtual void FlashRegularPolygon(const VECTOR2I &aShapePos, int aDiameter, int aCornerCount, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
Flash a regular polygon.
Definition: PS_plotter.cpp:268
virtual void SetColor(const COLOR4D &color) override
The SetColor implementation is split with the subclasses: the PSLIKE computes the rgb values,...
Definition: PS_plotter.cpp:64
virtual void FlashPadRoundRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
Definition: PS_plotter.cpp:179
PSLIKE_PLOTTER(const PROJECT *aProject=nullptr)
virtual void FlashPadCustom(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, SHAPE_POLY_SET *aPolygons, OUTLINE_MODE aTraceMode, void *aData) override
Definition: PS_plotter.cpp:209
virtual void FlashPadCircle(const VECTOR2I &aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, void *aData) override
Definition: PS_plotter.cpp:122
virtual void emitSetRGBColor(double r, double g, double b, double a)=0
Virtual primitive for emitting the setrgbcolor operator.
PLOT_TEXT_MODE m_textMode
How to draw text.
virtual void SetTextMode(PLOT_TEXT_MODE mode) override
PS and PDF fully implement native text (for the Latin-1 subset)
virtual void FlashPadTrapez(const VECTOR2I &aPadPos, const VECTOR2I *aCorners, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
Flash a trapezoidal pad.
Definition: PS_plotter.cpp:237
virtual void FlashPadRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
Definition: PS_plotter.cpp:139
int returnPostscriptTextWidth(const wxString &aText, int aXSize, bool aItalic, bool aBold)
Sister function for the GRTextWidth in gr_text.cpp Does the same processing (i.e.
Definition: PS_plotter.cpp:313
double plotScaleAdjX
Fine user scale adjust ( = 1.0 if no correction)
void computeTextParameters(const VECTOR2I &aPos, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, bool aMirror, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, double *wideningFactor, double *ctm_a, double *ctm_b, double *ctm_c, double *ctm_d, double *ctm_e, double *ctm_f, double *heightFactor)
This is the core for postscript/PDF text alignment.
Definition: PS_plotter.cpp:349
virtual std::string encodeStringForPlotter(const wxString &aUnicode)
convert a wxString unicode string to a char string compatible with the accepted string plotter format...
Definition: PS_plotter.cpp:277
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
Definition: PS_plotter.cpp:92
virtual bool EndPlot() override
Definition: PS_plotter.cpp:877
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr) override
Draw text with the plotter.
Definition: PS_plotter.cpp:891
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr) override
Draw a polygon ( filled or not ).
Definition: PS_plotter.cpp:559
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr) override
Definition: PS_plotter.cpp:922
virtual void PlotImage(const wxImage &aImage, const VECTOR2I &aPos, double aScaleFactor) override
PostScript-likes at the moment are the only plot engines supporting bitmaps.
Definition: PS_plotter.cpp:584
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
Definition: PS_plotter.cpp:332
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:500
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:514
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle) override
PostScript supports dashed lines.
Definition: PS_plotter.cpp:467
virtual bool StartPlot(const wxString &aPageNumber) override
The code within this function (and the CloseFilePS function) creates postscript files whose contents ...
Definition: PS_plotter.cpp:727
virtual PLOT_FORMAT GetPlotterType() const override
Return the effective plot engine in use.
virtual void Arc(const VECTOR2D &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aRadius, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:528
PS_PLOTTER(const PROJECT *aProject=nullptr)
virtual void emitSetRGBColor(double r, double g, double b, double a) override
Virtual primitive for emitting the setrgbcolor operator.
Definition: PS_plotter.cpp:447
virtual void SetCurrentLineWidth(int width, void *aData=nullptr) override
Set the current line width (in IUs) for the next plot.
Definition: PS_plotter.cpp:427
static wxString GetDefaultFileExtension()
virtual void PenTo(const VECTOR2I &pos, char plume) override
Moveto/lineto primitive, moves the 'pen' to the specified direction.
Definition: PS_plotter.cpp:692
Represent a set of closed polygons.
virtual void emitSetRGBColor(double r, double g, double b, double a) override
Initialize m_pen_rgb_color from reduced values r, g ,b ( reduced values are 0.0 to 1....
virtual void PlotImage(const wxImage &aImage, const VECTOR2I &aPos, double aScaleFactor) override
PostScript-likes at the moment are the only plot engines supporting bitmaps.
unsigned m_precision
virtual bool StartPlot(const wxString &aPageNumber) override
Create SVG file header.
virtual void EndBlock(void *aData) override
Calling this function allows one to define the end of a group of drawing items the group is started b...
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr) override
Draw a polygon ( filled or not ).
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
LINE_STYLE m_dashed
virtual void BezierCurve(const VECTOR2I &aStart, const VECTOR2I &aControl1, const VECTOR2I &aControl2, const VECTOR2I &aEnd, int aTolerance, int aLineThickness=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: Cubic Bezier curve rendered as a polyline.
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr) override
Draw text with the plotter.
double m_brush_alpha
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
virtual PLOT_FORMAT GetPlotterType() const override
Return the effective plot engine in use.
uint32_t m_brush_rgb_color
virtual void SetSvgCoordinatesFormat(unsigned aPrecision) override
Select SVG coordinate precision (number of digits needed for 1 mm ) (SVG plotter uses always metric u...
virtual bool EndPlot() override
void setSVGPlotStyle(int aLineWidth, bool aIsGroup=true, const std::string &aExtraStyle={})
Output the string which define pen and brush color, shape, transparency.
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr) override
virtual void PenTo(const VECTOR2I &pos, char plume) override
Moveto/lineto primitive, moves the 'pen' to the specified direction.
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
uint32_t m_pen_rgb_color
static wxString GetDefaultFileExtension()
bool m_graphics_changed
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle) override
SVG supports dashed lines.
virtual void StartBlock(void *aData) override
Calling this function allows one to define the beginning of a group of drawing items (used in SVG for...
void setFillMode(FILL_T fill)
Prepare parameters for setSVGPlotStyle()
virtual void Arc(const VECTOR2D &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aRadius, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH) override
virtual void SetCurrentLineWidth(int width, void *aData=nullptr) override
Set the current line width (in IUs) for the next plot.
FILL_T
Definition: eda_shape.h:56
OUTLINE_MODE
Definition: outline_mode.h:25
PLOT_TEXT_MODE
Which kind of text to output with the PSLIKE plotters.
Definition: plotter.h:91
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:65
LINE_STYLE
Dashed line types.
Definition: stroke_params.h:46
wxString title
Title of outline node.
std::vector< OUTLINE_NODE * > children
Ordered list of children.
int entryHandle
Allocated handle for this outline entry.
OUTLINE_NODE * AddChild(int aActionHandle, const wxString &aTitle, int aEntryHandle)
int actionHandle
Handle to action.
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.