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-2022 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
90 virtual void SetColor( const COLOR4D& color ) override;
91
92protected:
101 void computeTextParameters( const VECTOR2I& aPos,
102 const wxString& aText,
103 const EDA_ANGLE& aOrient,
104 const VECTOR2I& aSize,
105 bool aMirror,
106 enum GR_TEXT_H_ALIGN_T aH_justify,
107 enum GR_TEXT_V_ALIGN_T aV_justify,
108 int aWidth,
109 bool aItalic,
110 bool aBold,
111 double *wideningFactor,
112 double *ctm_a,
113 double *ctm_b,
114 double *ctm_c,
115 double *ctm_d,
116 double *ctm_e,
117 double *ctm_f,
118 double *heightFactor );
119
126 void postscriptOverlinePositions( const wxString& aText, int aXSize, bool aItalic, bool aBold,
127 std::vector<int> *pos_pairs );
128
131 virtual std::string encodeStringForPlotter( const wxString& aUnicode );
132
134 virtual void emitSetRGBColor( double r, double g, double b, double a ) = 0;
135
137 static const double postscriptTextAscent; // = 0.718;
138
145 int returnPostscriptTextWidth( const wxString& aText, int aXSize, bool aItalic, bool aBold );
146
149
152};
153
154
156{
157public:
159 {
160 // The phantom plot in postscript is an hack and reportedly
161 // crashes Adobe's own postscript interpreter!
162 m_textMode = PLOT_TEXT_MODE::STROKE;
163 }
164
165 static wxString GetDefaultFileExtension()
166 {
167 return wxString( wxT( "ps" ) );
168 }
169
170 virtual PLOT_FORMAT GetPlotterType() const override
171 {
172 return PLOT_FORMAT::POST;
173 }
174
188 virtual bool StartPlot( const wxString& aPageNumber ) override;
189 virtual bool EndPlot() override;
190
194 virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) override;
195
199 virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) override;
200
201 virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
202 double aScale, bool aMirror ) override;
203 virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
204 int width = USE_DEFAULT_LINE_WIDTH ) override;
205 virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
206 int width = USE_DEFAULT_LINE_WIDTH ) override;
207 virtual void Arc( const VECTOR2I& aCenter, const VECTOR2I& aStart, const VECTOR2I& aEnd,
208 FILL_T aFill, int aWidth, int aMaxError ) override;
209
210 virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
211 int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
212
216 virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos,
217 double aScaleFactor ) override;
218
219 virtual void PenTo( const VECTOR2I& pos, char plume ) override;
220 virtual void Text( const VECTOR2I& aPos,
221 const COLOR4D& aColor,
222 const wxString& aText,
223 const EDA_ANGLE& aOrient,
224 const VECTOR2I& aSize,
225 enum GR_TEXT_H_ALIGN_T aH_justify,
226 enum GR_TEXT_V_ALIGN_T aV_justify,
227 int aWidth,
228 bool aItalic,
229 bool aBold,
230 bool aMultilineAllowed = false,
231 KIFONT::FONT* aFont = nullptr,
232 void* aData = nullptr ) override;
233
234 virtual void PlotText( const VECTOR2I& aPos,
235 const COLOR4D& aColor,
236 const wxString& aText,
237 const TEXT_ATTRIBUTES& aAttributes,
238 KIFONT::FONT* aFont,
239 void* aData = nullptr ) override;
240
241
242protected:
243 virtual void emitSetRGBColor( double r, double g, double b, double a ) override;
244};
245
246
248{
249public:
251 m_pageTreeHandle( 0 ),
255 m_workFile( nullptr ),
257 {
258 }
259
260 virtual PLOT_FORMAT GetPlotterType() const override
261 {
262 return PLOT_FORMAT::PDF;
263 }
264
265 static wxString GetDefaultFileExtension()
266 {
267 return wxString( wxT( "pdf" ) );
268 }
269
279 virtual bool OpenFile( const wxString& aFullFilename ) override;
280
285 virtual bool StartPlot( const wxString& aPageNumber ) override;
286
287 virtual bool StartPlot( const wxString& aPageNumber,
288 const wxString& aPageName = wxEmptyString );
289
290 virtual bool EndPlot() override;
291
295 virtual void StartPage( const wxString& aPageNumber, const wxString& aPageName = wxEmptyString );
296
300 virtual void ClosePage();
301
310 virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) override;
311
315 virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) override;
316
321 virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
322 double aScale, bool aMirror ) override;
323
327 virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
328 int width = USE_DEFAULT_LINE_WIDTH ) override;
329
333 virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
334 int width = USE_DEFAULT_LINE_WIDTH ) override;
335
339 virtual void Arc( const VECTOR2I& aCenter, const VECTOR2I& aStart, const VECTOR2I& aEnd,
340 FILL_T aFill, int aWidth, int aMaxError ) 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 = false,
361 KIFONT::FONT* aFont = nullptr,
362 void* aData = nullptr ) override;
363
364 virtual void PlotText( const VECTOR2I& aPos,
365 const COLOR4D& aColor,
366 const wxString& aText,
367 const TEXT_ATTRIBUTES& aAttributes,
368 KIFONT::FONT* aFont,
369 void* aData = nullptr ) override;
370
371 void HyperlinkBox( const BOX2I& aBox, const wxString& aDestinationURL ) override;
372
373 void HyperlinkMenu( const BOX2I& aBox, const std::vector<wxString>& aDestURLs ) override;
374
375 void Bookmark( const BOX2I& aBox, const wxString& aName, const wxString& aGroupName = wxEmptyString ) override;
376
380 void PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double aScaleFactor ) override;
381
382
383protected:
385 {
387 wxString title;
389
390 std::vector<OUTLINE_NODE*> children;
391
393 {
394 std::for_each( children.begin(), children.end(),
395 []( OUTLINE_NODE* node )
396 {
397 delete node;
398 } );
399 }
400
401 OUTLINE_NODE* AddChild( int aActionHandle, const wxString& aTitle, int aEntryHandle )
402 {
403 OUTLINE_NODE* child = new OUTLINE_NODE
404 {
405 aActionHandle, aTitle, aEntryHandle, {}
406 };
407
408 children.push_back( child );
409
410 return child;
411 }
412 };
413
423 OUTLINE_NODE* addOutlineNode( OUTLINE_NODE* aParent, int aActionHandle,
424 const wxString& aTitle );
425
426 virtual void Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
427 const EDA_ANGLE& aEndAngle, int aRadius,
428 FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
429
432 std::string encodeStringForPlotter( const wxString& aUnicode ) override;
433
443 virtual void emitSetRGBColor( double r, double g, double b, double a ) override;
444
450 int allocPdfObject();
451
456 int startPdfObject(int handle = -1);
457
461 void closePdfObject();
462
469 int startPdfStream(int handle = -1);
470
474 void closePdfStream();
475
479 int emitOutline();
480
484 void emitOutlineNode( OUTLINE_NODE* aNode, int aParentHandle, int aNextNode, int aPrevNode );
485
491 int emitGoToAction( int aPageHandle, const VECTOR2I& aBottomLeft, const VECTOR2I& aTopRight );
492 int emitGoToAction( int aPageHandle );
493
496 std::vector<int> m_pageHandles;
500 wxString m_pageName;
502 std::vector<long> m_xrefTable;
503
505 std::vector<wxString> m_pageNumbers;
506
508 std::vector<std::pair<BOX2I, wxString>> m_hyperlinksInPage;
509 std::vector<std::pair<BOX2I, std::vector<wxString>>> m_hyperlinkMenusInPage;
510
512 std::map<int, std::pair<BOX2D, wxString>> m_hyperlinkHandles;
513 std::map<int, std::pair<BOX2D, std::vector<wxString>>> m_hyperlinkMenuHandles;
514
515 std::map<wxString, std::vector<std::pair<BOX2I, wxString>>> m_bookmarksInPage;
516
517 std::unique_ptr<OUTLINE_NODE> m_outlineRoot;
519};
520
521
523{
524public:
525 SVG_PLOTTER();
526
527 static wxString GetDefaultFileExtension()
528 {
529 return wxString( wxT( "svg" ) );
530 }
531
532 virtual PLOT_FORMAT GetPlotterType() const override
533 {
534 return PLOT_FORMAT::SVG;
535 }
536
537 virtual void SetColor( const COLOR4D& color ) override;
538
542 virtual bool StartPlot( const wxString& aPageNumber ) override;
543 virtual bool EndPlot() override;
544
548 virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) override;
549
553 virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) override;
554
555 virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
556 double aScale, bool aMirror ) override;
557 virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
558 int width = USE_DEFAULT_LINE_WIDTH ) override;
559 virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
560 int width = USE_DEFAULT_LINE_WIDTH ) override;
561
562 virtual void BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1,
563 const VECTOR2I& aControl2, const VECTOR2I& aEnd,
564 int aTolerance,
565 int aLineThickness = USE_DEFAULT_LINE_WIDTH ) override;
566
567 virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
568 int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = nullptr ) override;
569
573 virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos,
574 double aScaleFactor ) override;
575
576 virtual void PenTo( const VECTOR2I& pos, char plume ) override;
577
588 virtual void SetSvgCoordinatesFormat( unsigned aPrecision ) override;
589
595 virtual void StartBlock( void* aData ) override;
596
602 virtual void EndBlock( void* aData ) override;
603
604 virtual void Text( const VECTOR2I& aPos,
605 const COLOR4D& aColor,
606 const wxString& aText,
607 const EDA_ANGLE& aOrient,
608 const VECTOR2I& aSize,
609 enum GR_TEXT_H_ALIGN_T aH_justify,
610 enum GR_TEXT_V_ALIGN_T aV_justify,
611 int aWidth,
612 bool aItalic,
613 bool aBold,
614 bool aMultilineAllowed = false,
615 KIFONT::FONT* aFont = nullptr,
616 void* aData = nullptr ) override;
617
618
619 virtual void PlotText( const VECTOR2I& aPos,
620 const COLOR4D& aColor,
621 const wxString& aText,
622 const TEXT_ATTRIBUTES& aAttributes,
623 KIFONT::FONT* aFont,
624 void* aData = nullptr ) override;
625
626protected:
627 virtual void Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
628 const EDA_ANGLE& aEndAngle, int aRadius,
629 FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
630
635 virtual void emitSetRGBColor( double r, double g, double b, double a ) override;
636
643 void setSVGPlotStyle( int aLineWidth, bool aIsGroup = true,
644 const std::string& aExtraStyle = {} );
645
649 void setFillMode( FILL_T fill );
650
651 FILL_T m_fillMode; // true if the current contour
652 // rect, arc, circle, polygon must be filled
653 long m_pen_rgb_color; // current rgb color value: each color has
654 // a value 0 ... 255, and the 3 colors are
655 // grouped in a 3x8 bits value
656 // (written in hex to svg files)
657 long m_brush_rgb_color; // same as m_pen_rgb_color, used to fill
658 // some contours.
660 bool m_graphics_changed; // true if a pen/brush parameter is modified
661 // color, pen size, fill mode ...
662 // the new SVG stype must be output on file
663 PLOT_DASH_TYPE m_dashed; // plot line style
664 bool m_useInch; // is 0 if the step size is 10**-n*mm
665 // is 1 if the step size is 10**-n*inch
666 // Where n is given from m_precision
667 unsigned m_precision; // How fine the step size is
668 // Use 3-6 (3 means um precision, 6 nm precision) in PcbNew
669 // 3-4 in other modules (avoid values >4 to avoid overflow)
670 // see also comment for m_useInch.
671};
int color
Definition: DXF_plotter.cpp:57
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:105
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
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 PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, void *aData=nullptr) override
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.
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.
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=false, KIFONT::FONT *aFont=nullptr, void *aData=nullptr) override
Draw text with the plotter.
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...
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.
virtual void Arc(const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aEnd, FILL_T aFill, int aWidth, int aMaxError) override
The PDF engine can't directly plot arcs so we use polygonization.
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.
std::map< int, std::pair< BOX2D, wxString > > m_hyperlinkHandles
int m_pageTreeHandle
Handle to the root of the page tree object.
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.
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:48
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.
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:110
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:114
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:280
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:62
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:177
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:214
virtual void FlashPadCircle(const VECTOR2I &aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, void *aData) override
Definition: PS_plotter.cpp:120
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:249
virtual void FlashPadRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
Definition: PS_plotter.cpp:137
int returnPostscriptTextWidth(const wxString &aText, int aXSize, bool aItalic, bool aBold)
Sister function for the GraphicTextWidth in drawtxt.cpp Does the same processing (i....
Definition: PS_plotter.cpp:329
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:401
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:289
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
Definition: PS_plotter.cpp:90
void postscriptOverlinePositions(const wxString &aText, int aXSize, bool aItalic, bool aBold, std::vector< int > *pos_pairs)
Computes the x coordinates for the overlining in a string of text.
Definition: PS_plotter.cpp:352
virtual void Arc(const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aEnd, FILL_T aFill, int aWidth, int aMaxError) override
Generic fallback: arc rendered as a polyline.
Definition: PS_plotter.cpp:574
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, void *aData=nullptr) override
Definition: PS_plotter.cpp:970
virtual bool EndPlot() override
Definition: PS_plotter.cpp:926
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=false, KIFONT::FONT *aFont=nullptr, void *aData=nullptr) override
Draw text with the plotter.
Definition: PS_plotter.cpp:940
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:600
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:622
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:384
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:546
virtual void SetDash(int aLineWidth, PLOT_DASH_TYPE aLineStyle) override
PostScript supports dashed lines.
Definition: PS_plotter.cpp:513
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:557
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:765
virtual PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
virtual void emitSetRGBColor(double r, double g, double b, double a) override
Virtual primitive for emitting the setrgbcolor operator.
Definition: PS_plotter.cpp:493
virtual void SetCurrentLineWidth(int width, void *aData=nullptr) override
Set the current line width (in IUs) for the next plot.
Definition: PS_plotter.cpp:473
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:730
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.
double m_brush_alpha
virtual void Arc(const VECTOR2I &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle, int aRadius, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.
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 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=false, KIFONT::FONT *aFont=nullptr, void *aData=nullptr) override
Draw text with the plotter.
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
virtual void SetColor(const COLOR4D &color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
void setSVGPlotStyle(int aLineWidth, bool aIsGroup=true, const std::string &aExtraStyle={})
Output the string which define pen and brush color, shape, transparency.
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()
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, void *aData=nullptr) override
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 SetCurrentLineWidth(int width, void *aData=nullptr) override
Set the current line width (in IUs) for the next plot.
FILL_T
Definition: eda_shape.h:54
OUTLINE_MODE
Definition: outline_mode.h:25
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
PLOT_TEXT_MODE
Which kind of text to output with the PSLIKE plotters.
Definition: plotter.h:96
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:70
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