KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 (C) 2016-2023 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:
39 plotScaleAdjX( 1 ),
40 plotScaleAdjY( 1 ),
42 {
43 }
44
48 virtual void SetTextMode( PLOT_TEXT_MODE mode ) override
49 {
50 if( mode != PLOT_TEXT_MODE::DEFAULT )
51 m_textMode = mode;
52 }
53
57 void SetScaleAdjust( double scaleX, double scaleY )
58 {
59 plotScaleAdjX = scaleX;
60 plotScaleAdjY = scaleY;
61 }
62
63 // Pad routines are handled with lower level primitives
64 virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter,
65 OUTLINE_MODE aTraceMode, void* aData ) override;
66 virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
67 const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
68 void* aData ) override;
69 virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
70 const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
71 void* aData ) override;
72 virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
73 int aCornerRadius, const EDA_ANGLE& aOrient,
74 OUTLINE_MODE aTraceMode, void* aData ) override;
75 virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
76 const EDA_ANGLE& aOrient, SHAPE_POLY_SET* aPolygons,
77 OUTLINE_MODE aTraceMode, void* aData ) override;
78 virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
79 const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
80 void* aData ) override;
81 virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
82 const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
83 void* aData ) override;
84
89 virtual void SetColor( const COLOR4D& color ) override;
90
91protected:
99 void computeTextParameters( const VECTOR2I& aPos,
100 const wxString& aText,
101 const EDA_ANGLE& aOrient,
102 const VECTOR2I& aSize,
103 bool aMirror,
104 enum GR_TEXT_H_ALIGN_T aH_justify,
105 enum GR_TEXT_V_ALIGN_T aV_justify,
106 int aWidth,
107 bool aItalic,
108 bool aBold,
109 double *wideningFactor,
110 double *ctm_a,
111 double *ctm_b,
112 double *ctm_c,
113 double *ctm_d,
114 double *ctm_e,
115 double *ctm_f,
116 double *heightFactor );
117
120 virtual std::string encodeStringForPlotter( const wxString& aUnicode );
121
123 virtual void emitSetRGBColor( double r, double g, double b, double a ) = 0;
124
126 static const double postscriptTextAscent; // = 0.718;
127
133 int returnPostscriptTextWidth( const wxString& aText, int aXSize, bool aItalic, bool aBold );
134
137
140};
141
142
144{
145public:
147 {
148 // The phantom plot in postscript is an hack and reportedly
149 // crashes Adobe's own postscript interpreter!
150 m_textMode = PLOT_TEXT_MODE::STROKE;
151 }
152
153 static wxString GetDefaultFileExtension()
154 {
155 return wxString( wxT( "ps" ) );
156 }
157
158 virtual PLOT_FORMAT GetPlotterType() const override
159 {
160 return PLOT_FORMAT::POST;
161 }
162
176 virtual bool StartPlot( const wxString& aPageNumber ) override;
177 virtual bool EndPlot() override;
178
182 virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) override;
183
187 virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) override;
188
189 virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
190 double aScale, bool aMirror ) override;
191 virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
192 int width = USE_DEFAULT_LINE_WIDTH ) override;
193 virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
194 int width = USE_DEFAULT_LINE_WIDTH ) override;
195 virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
196 const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
197 int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
198
199 virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
200 int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
201
205 virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos,
206 double aScaleFactor ) override;
207
208 virtual void PenTo( const VECTOR2I& pos, char plume ) override;
209 virtual void Text( const VECTOR2I& aPos,
210 const COLOR4D& aColor,
211 const wxString& aText,
212 const EDA_ANGLE& aOrient,
213 const VECTOR2I& aSize,
214 enum GR_TEXT_H_ALIGN_T aH_justify,
215 enum GR_TEXT_V_ALIGN_T aV_justify,
216 int aWidth,
217 bool aItalic,
218 bool aBold,
219 bool aMultilineAllowed,
220 KIFONT::FONT* aFont,
221 const KIFONT::METRICS& aFontMetrics,
222 void* aData = nullptr ) override;
223
224 virtual void PlotText( const VECTOR2I& aPos,
225 const COLOR4D& aColor,
226 const wxString& aText,
227 const TEXT_ATTRIBUTES& aAttributes,
228 KIFONT::FONT* aFont,
229 const KIFONT::METRICS& aFontMetrics,
230 void* aData = nullptr ) override;
231
232
233protected:
234 virtual void emitSetRGBColor( double r, double g, double b, double a ) override;
235};
236
237
239{
240public:
242 m_pageTreeHandle( 0 ),
246 m_workFile( nullptr ),
248 {
249 }
250
251 virtual PLOT_FORMAT GetPlotterType() const override
252 {
253 return PLOT_FORMAT::PDF;
254 }
255
256 static wxString GetDefaultFileExtension()
257 {
258 return wxString( wxT( "pdf" ) );
259 }
260
270 virtual bool OpenFile( const wxString& aFullFilename ) override;
271
276 virtual bool StartPlot( const wxString& aPageNumber ) override;
277
278 virtual bool StartPlot( const wxString& aPageNumber,
279 const wxString& aPageName = wxEmptyString );
280
281 virtual bool EndPlot() override;
282
286 virtual void StartPage( const wxString& aPageNumber, const wxString& aPageName = wxEmptyString );
287
291 virtual void ClosePage();
292
301 virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) override;
302
306 virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) override;
307
312 virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
313 double aScale, bool aMirror ) override;
314
318 virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
319 int width = USE_DEFAULT_LINE_WIDTH ) override;
320
324 virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
325 int width = USE_DEFAULT_LINE_WIDTH ) override;
326
330 virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
331 const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
332 int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
333
337 virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
338 int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
339
340 virtual void PenTo( const VECTOR2I& pos, char plume ) override;
341
342 virtual void Text( const VECTOR2I& aPos,
343 const COLOR4D& aColor,
344 const wxString& aText,
345 const EDA_ANGLE& aOrient,
346 const VECTOR2I& aSize,
347 enum GR_TEXT_H_ALIGN_T aH_justify,
348 enum GR_TEXT_V_ALIGN_T aV_justify,
349 int aWidth,
350 bool aItalic,
351 bool aBold,
352 bool aMultilineAllowed,
353 KIFONT::FONT* aFont,
354 const KIFONT::METRICS& aFontMetrics,
355 void* aData = nullptr ) override;
356
357 virtual void PlotText( const VECTOR2I& aPos,
358 const COLOR4D& aColor,
359 const wxString& aText,
360 const TEXT_ATTRIBUTES& aAttributes,
361 KIFONT::FONT* aFont,
362 const KIFONT::METRICS& aFontMetrics,
363 void* aData = nullptr ) override;
364
365 void HyperlinkBox( const BOX2I& aBox, const wxString& aDestinationURL ) override;
366
367 void HyperlinkMenu( const BOX2I& aBox, const std::vector<wxString>& aDestURLs ) override;
368
369 void Bookmark( const BOX2I& aBox, const wxString& aName, const wxString& aGroupName = wxEmptyString ) override;
370
374 void PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double aScaleFactor ) override;
375
376
377protected:
379 {
381 wxString title;
383
384 std::vector<OUTLINE_NODE*> children;
385
387 {
388 std::for_each( children.begin(), children.end(),
389 []( OUTLINE_NODE* node )
390 {
391 delete node;
392 } );
393 }
394
395 OUTLINE_NODE* AddChild( int aActionHandle, const wxString& aTitle, int aEntryHandle )
396 {
397 OUTLINE_NODE* child = new OUTLINE_NODE
398 {
399 aActionHandle, aTitle, aEntryHandle, {}
400 };
401
402 children.push_back( child );
403
404 return child;
405 }
406 };
407
417 OUTLINE_NODE* addOutlineNode( OUTLINE_NODE* aParent, int aActionHandle,
418 const wxString& aTitle );
419
422 std::string encodeStringForPlotter( const wxString& aUnicode ) override;
423
433 virtual void emitSetRGBColor( double r, double g, double b, double a ) override;
434
440 int allocPdfObject();
441
446 int startPdfObject(int handle = -1);
447
451 void closePdfObject();
452
459 int startPdfStream(int handle = -1);
460
464 void closePdfStream();
465
469 int emitOutline();
470
474 void emitOutlineNode( OUTLINE_NODE* aNode, int aParentHandle, int aNextNode, int aPrevNode );
475
481 int emitGoToAction( int aPageHandle, const VECTOR2I& aBottomLeft, const VECTOR2I& aTopRight );
482 int emitGoToAction( int aPageHandle );
483
488 std::vector<int> m_pageHandles;
492 wxString m_pageName;
494 std::vector<long> m_xrefTable;
495
497 std::vector<wxString> m_pageNumbers;
498
500 std::vector<std::pair<BOX2I, wxString>> m_hyperlinksInPage;
501 std::vector<std::pair<BOX2I, std::vector<wxString>>> m_hyperlinkMenusInPage;
502
504 std::map<int, std::pair<BOX2D, wxString>> m_hyperlinkHandles;
505 std::map<int, std::pair<BOX2D, std::vector<wxString>>> m_hyperlinkMenuHandles;
506
507 std::map<wxString, std::vector<std::pair<BOX2I, wxString>>> m_bookmarksInPage;
508
509 std::map<int, wxImage> m_imageHandles;
510
511 std::unique_ptr<OUTLINE_NODE> m_outlineRoot;
513};
514
515
517{
518public:
519 SVG_PLOTTER();
520
521 static wxString GetDefaultFileExtension()
522 {
523 return wxString( wxT( "svg" ) );
524 }
525
526 virtual PLOT_FORMAT GetPlotterType() const override
527 {
528 return PLOT_FORMAT::SVG;
529 }
530
534 virtual bool StartPlot( const wxString& aPageNumber ) override;
535 virtual bool EndPlot() override;
536
540 virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) override;
541
545 virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) override;
546
547 virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
548 double aScale, bool aMirror ) override;
549 virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
550 int width = USE_DEFAULT_LINE_WIDTH ) override;
551 virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
552 int width = USE_DEFAULT_LINE_WIDTH ) override;
553 virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
554 const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
555 int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
556
557 virtual void BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1,
558 const VECTOR2I& aControl2, const VECTOR2I& aEnd,
559 int aTolerance,
560 int aLineThickness = USE_DEFAULT_LINE_WIDTH ) override;
561
562 virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
563 int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = nullptr ) override;
564
568 virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos,
569 double aScaleFactor ) override;
570
571 virtual void PenTo( const VECTOR2I& pos, char plume ) override;
572
583 virtual void SetSvgCoordinatesFormat( unsigned aPrecision ) override;
584
590 virtual void StartBlock( void* aData ) override;
591
597 virtual void EndBlock( void* aData ) override;
598
599 virtual void Text( const VECTOR2I& aPos,
600 const COLOR4D& aColor,
601 const wxString& aText,
602 const EDA_ANGLE& aOrient,
603 const VECTOR2I& aSize,
604 enum GR_TEXT_H_ALIGN_T aH_justify,
605 enum GR_TEXT_V_ALIGN_T aV_justify,
606 int aWidth,
607 bool aItalic,
608 bool aBold,
609 bool aMultilineAllowed,
610 KIFONT::FONT* aFont,
611 const KIFONT::METRICS& aFontMetrics,
612 void* aData = nullptr ) override;
613
614
615 virtual void PlotText( const VECTOR2I& aPos,
616 const COLOR4D& aColor,
617 const wxString& aText,
618 const TEXT_ATTRIBUTES& aAttributes,
619 KIFONT::FONT* aFont,
620 const KIFONT::METRICS& aFontMetrics,
621 void* aData = nullptr ) override;
622
623protected:
628 virtual void emitSetRGBColor( double r, double g, double b, double a ) override;
629
636 void setSVGPlotStyle( int aLineWidth, bool aIsGroup = true,
637 const std::string& aExtraStyle = {} );
638
642 void setFillMode( FILL_T fill );
643
644 FILL_T m_fillMode; // true if the current contour
645 // rect, arc, circle, polygon must be filled
646 long m_pen_rgb_color; // current rgb color value: each color has
647 // a value 0 ... 255, and the 3 colors are
648 // grouped in a 3x8 bits value
649 // (written in hex to svg files)
650 long m_brush_rgb_color; // same as m_pen_rgb_color, used to fill
651 // some contours.
653 bool m_graphics_changed; // true if a pen/brush parameter is modified
654 // color, pen size, fill mode ...
655 // the new SVG stype must be output on file
656 PLOT_DASH_TYPE m_dashed; // plot line style
657 unsigned m_precision; // How fine the step size is
658 // Use 3-6 (3 means um precision, 6 nm precision) in PcbNew
659 // 3-4 in other modules (avoid values >4 to avoid overflow)
660 // see also comment for m_useInch.
661};
int color
Definition: DXF_plotter.cpp:58
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:130
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.
virtual void StartPage(const wxString &aPageNumber, const wxString &aPageName=wxEmptyString)
Start a new page in the PDF document.
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
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)
Starts 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.
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
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)
Emits 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.
OUTLINE_NODE * addOutlineNode(OUTLINE_NODE *aParent, int aActionHandle, const wxString &aTitle)
Adds 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:50
std::vector< wxString > m_pageNumbers
List of loaded hyperlinks in current page.
virtual void SetDash(int aLineWidth, PLOT_DASH_TYPE aLineStyle) override
PDF supports dashed lines.
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
std::unique_ptr< OUTLINE_NODE > m_outlineRoot
Root outline node.
std::vector< std::pair< BOX2I, std::vector< wxString > > > m_hyperlinkMenusInPage
Handles for all the hyperlink objects that will be deferred.
void closePdfObject()
Close the current PDF object.
virtual PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
int m_totalOutlineNodes
Total number of outline nodes.
Base plotter engine class.
Definition: plotter.h:104
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:108
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:267
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:63
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:178
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:208
virtual void FlashPadCircle(const VECTOR2I &aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, void *aData) override
Definition: PS_plotter.cpp:121
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:236
virtual void FlashPadRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
Definition: PS_plotter.cpp:138
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:316
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:352
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:276
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
Definition: PS_plotter.cpp:91
virtual bool EndPlot() override
Definition: PS_plotter.cpp:881
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:895
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:555
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:926
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:577
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:335
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:497
virtual void SetDash(int aLineWidth, PLOT_DASH_TYPE aLineStyle) override
PostScript supports dashed lines.
Definition: PS_plotter.cpp:464
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:508
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:720
virtual PLOT_FORMAT GetPlotterType() const override
Returns 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:525
virtual void emitSetRGBColor(double r, double g, double b, double a) override
Virtual primitive for emitting the setrgbcolor operator.
Definition: PS_plotter.cpp:444
virtual void SetCurrentLineWidth(int width, void *aData=nullptr) override
Set the current line width (in IUs) for the next plot.
Definition: PS_plotter.cpp:424
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:685
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.
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 In KiCad the bezier curves have 4 control...
virtual void SetDash(int aLineWidth, PLOT_DASH_TYPE aLineStyle) override
SVG supports dashed lines.
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
Returns the effective plot engine in use.
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.
long m_brush_rgb_color
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
static wxString GetDefaultFileExtension()
bool m_graphics_changed
PLOT_DASH_TYPE m_dashed
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:55
OUTLINE_MODE
Definition: outline_mode.h:25
PLOT_TEXT_MODE
Which kind of text to output with the PSLIKE plotters.
Definition: plotter.h:90
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:64
PLOT_DASH_TYPE
Dashed line types.
Definition: stroke_params.h:48
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
GR_TEXT_V_ALIGN_T