80 if(
color != COLOR4D::WHITE )
101 if( size.
x > size.
y )
103 std::swap( size.
x, size.
y );
114 if( aTraceMode ==
FILLED )
115 ThickSegment( a + aPadPos, b + aPadPos, size.
x, aTraceMode,
nullptr );
124 if( aTraceMode ==
FILLED )
126 Circle( aPadPos, aDiameter, FILL_T::FILLED_SHAPE, 0 );
142 std::vector<VECTOR2I> cornerList;
144 cornerList.reserve( 4 );
146 if( aTraceMode ==
FILLED )
155 corner.
x = aPadPos.
x - dx;
156 corner.
y = aPadPos.
y + dy;
157 cornerList.push_back( corner );
158 corner.
x = aPadPos.
x - dx;
159 corner.
y = aPadPos.
y - dy;
160 cornerList.push_back( corner );
161 corner.
x = aPadPos.
x + dx;
162 corner.
y = aPadPos.
y - dy;
163 cornerList.push_back( corner );
164 corner.
x = aPadPos.
x + dx;
165 corner.
y = aPadPos.
y + dy,
166 cornerList.push_back( corner );
168 for(
unsigned ii = 0; ii < cornerList.size(); ii++ )
169 RotatePoint( cornerList[ii], aPadPos, aPadOrient );
171 cornerList.push_back( cornerList[0] );
173 PlotPoly( cornerList, ( aTraceMode ==
FILLED ) ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL,
179 int aCornerRadius,
const EDA_ANGLE& aOrient,
182 if( aTraceMode ==
FILLED )
191 std::vector<VECTOR2I> cornerList;
197 for(
int ii = 0; ii < poly.
PointCount(); ++ii )
198 cornerList.emplace_back( poly.
CPoint( ii ).
x, poly.
CPoint( ii ).
y );
201 cornerList.push_back( cornerList[0] );
203 PlotPoly( cornerList, ( aTraceMode ==
FILLED ) ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL,
212 if( aTraceMode ==
FILLED )
217 std::vector<VECTOR2I> cornerList;
219 for(
int cnt = 0; cnt < aPolygons->
OutlineCount(); ++cnt )
224 for(
int ii = 0; ii < poly.
PointCount(); ++ii )
225 cornerList.emplace_back( poly.
CPoint( ii ).
x, poly.
CPoint( ii ).
y );
228 cornerList.push_back( cornerList[0] );
230 PlotPoly( cornerList, ( aTraceMode ==
FILLED ) ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL,
240 static std::vector<VECTOR2I> cornerList;
243 for(
int ii = 0; ii < 4; ii++ )
244 cornerList.push_back( aCorners[ii] );
246 if( aTraceMode ==
FILLED )
255 for(
int ii = 0; ii < 4; ii++ )
258 cornerList[ii] += aPadPos;
261 cornerList.push_back( cornerList[0] );
262 PlotPoly( cornerList, ( aTraceMode ==
FILLED ) ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL,
279 std::string converted;
283 for(
unsigned i = 0; i < aUnicode.Len(); i++ )
286 wchar_t ch = aUnicode[i];
317 bool aItalic,
bool aBold )
323 for(
wchar_t asciiCode : aText)
326 if( asciiCode !=
'~' && asciiCode < 256 )
327 tally += width_table[asciiCode];
336 double aScale,
bool aMirror )
353 const wxString& aText,
362 double *wideningFactor,
369 double *heightFactor )
385 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
395 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
407 *wideningFactor = sz_dev.
x / sz_dev.
y;
411 *wideningFactor = -*wideningFactor;
415 double sinalpha = sin( alpha );
416 double cosalpha = cos( alpha );
438 else if( aWidth == 0 )
441 wxASSERT_MSG( aWidth > 0,
"Plotter called to set negative pen width" );
460 r = ( r * a ) + ( 1 - a );
461 g = ( g * a ) + ( 1 - a );
462 b = ( b * a ) + ( 1 - a );
466 fprintf(
m_outputFile,
"%.3g %.3g %.3g setrgbcolor\n", r, g, b );
474 case LINE_STYLE::DASH:
479 case LINE_STYLE::DOT:
484 case LINE_STYLE::DASHDOT:
490 case LINE_STYLE::DASHDOTDOT:
491 fprintf(
m_outputFile,
"[%d %d %d %d %d %d] 0 setdash\n",
505 if( fill == FILL_T::NO_FILL && width <= 0 )
512 fprintf(
m_outputFile,
"%g %g %g %g rect%d\n", p1_dev.
x, p1_dev.
y,
513 p2_dev.
x - p1_dev.
x, p2_dev.
y - p1_dev.
y,
getFillId( fill ) );
519 if( fill == FILL_T::NO_FILL && width <= 0 )
546 VECTOR2D start( aRadius * aStartAngle.
Cos(), aRadius * aStartAngle.
Sin() );
559 std::swap( startAngle, endAngle );
563 fprintf(
m_outputFile,
"%g %g %g %g %g arc%d\n", center_device.
x, center_device.
y,
570 if( aFill == FILL_T::NO_FILL && aWidth <= 0 )
573 if( aCornerList.size() <= 1 )
581 for(
unsigned ii = 1; ii < aCornerList.size(); ii++ )
595 pix_size.
x = aImage.GetWidth();
596 pix_size.
y = aImage.GetHeight();
597 VECTOR2D drawsize( aScaleFactor * pix_size.
x,
598 aScaleFactor * pix_size.
y );
602 start.
x -= drawsize.
x / 2;
603 start.
y += drawsize.
y / 2;
607 end.
x = start.
x + drawsize.
x;
608 end.
y = start.
y - drawsize.
y;
615 fprintf(
m_outputFile,
"%g %g translate\n", start_dev.
x, start_dev.
y );
627 fprintf(
m_outputFile,
" [%d 0 0 %d 0 %d]\n", pix_size.
x, -pix_size.
y , pix_size.
y);
630 fprintf(
m_outputFile,
"{currentfile pix readhexstring pop}\n" );
641 for(
int yy = 0; yy < pix_size.
y; yy ++ )
643 for(
int xx = 0; xx < pix_size.
x; xx++, jj++ )
651 int red, green, blue;
652 red = aImage.GetRed( xx, yy) & 0xFF;
653 green = aImage.GetGreen( xx, yy) & 0xFF;
654 blue = aImage.GetBlue( xx, yy) & 0xFF;
657 if( aImage.HasAlpha() )
659 unsigned char alpha = aImage.GetAlpha( xx, yy ) & 0xFF;
663 float a = 1.0 - ( (float) alpha / 255.0 );
664 red = ( int )(
red + ( a * 0xFF ) ) & 0xFF;
665 green = ( int )( green + ( a * 0xFF ) ) & 0xFF;
666 blue = ( int )( blue + ( a * 0xFF ) ) & 0xFF;
670 if( aImage.HasMask() )
672 if(
red == aImage.GetMaskRed() && green == aImage.GetMaskGreen()
673 && blue == aImage.GetMaskBlue() )
688 unsigned char grey =
KiROUND(
red * 0.2126 + green * 0.7152 + blue * 0.0722 );
726 pos_dev.
x, pos_dev.
y,
727 ( plume==
'D' ) ?
"line" :
"move" );
739 static const char* PSMacro[] =
742 "/line { newpath moveto lineto stroke } bind def\n",
743 "/cir0 { newpath 0 360 arc stroke } bind def\n",
744 "/cir1 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
745 "/cir2 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
746 "/arc0 { newpath arc stroke } bind def\n",
747 "/arc1 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
748 " grestore stroke } bind def\n",
749 "/arc2 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
750 " grestore stroke } bind def\n",
751 "/poly0 { stroke } bind def\n",
752 "/poly1 { closepath gsave fill grestore stroke } bind def\n",
753 "/poly2 { closepath gsave fill grestore stroke } bind def\n",
754 "/rect0 { rectstroke } bind def\n",
755 "/rect1 { rectfill } bind def\n",
756 "/rect2 { rectfill } bind def\n",
757 "/linemode0 { 0 setlinecap 0 setlinejoin 0 setlinewidth } bind def\n",
758 "/linemode1 { 1 setlinecap 1 setlinejoin } bind def\n",
759 "/dashedline { [200] 100 setdash } bind def\n",
760 "/solidline { [] 0 setdash } bind def\n",
763 "/phantomshow { moveto\n",
764 " /KicadFont findfont 0.000001 scalefont setfont\n",
765 " show } bind def\n",
768 "/textshow { gsave\n",
769 " findfont exch scalefont setfont concat 1 scale 0 0 moveto show\n",
774 " findfont dup length dict begin\n",
775 " { 1 index /FID ne\n",
777 " { pop pop } ifelse\n",
779 " /Encoding ISOLatin1Encoding def\n",
784 "/KicadFont /Helvetica reencodefont definefont pop\n",
785 "/KicadFont-Bold /Helvetica-Bold reencodefont definefont pop\n",
786 "/KicadFont-Oblique /Helvetica-Oblique reencodefont definefont pop\n",
787 "/KicadFont-BoldOblique /Helvetica-BoldOblique reencodefont definefont pop\n",
792 time_t time1970 = time(
nullptr );
800 fprintf(
m_outputFile,
"%%%%CreationDate: %s", ctime( &time1970 ) );
806 const double BIGPTsPERMIL = 0.072;
820 (
int) ceil( psPaperSize.
x * BIGPTsPERMIL ),
821 (
int) ceil( psPaperSize.
y * BIGPTsPERMIL ) );
840 fprintf(
m_outputFile,
"%%%%DocumentMedia: Custom %d %d 0 () ()\n",
841 KiROUND( psPaperSize.
x * BIGPTsPERMIL ),
842 KiROUND( psPaperSize.
y * BIGPTsPERMIL ) );
846 fprintf(
m_outputFile,
"%%%%DocumentMedia: %s %d %d 0 () ()\n",
848 KiROUND( psPaperSize.
x * BIGPTsPERMIL ),
849 KiROUND( psPaperSize.
y * BIGPTsPERMIL ) );
855 fprintf(
m_outputFile,
"%%%%Orientation: Landscape\n" );
861 for(
int ii = 0; PSMacro[ii] !=
nullptr; ii++ )
871 fprintf(
m_outputFile,
"%%Page: %s 1\n", page_num.c_str() );
873 fputs(
"%%BeginPageSetup\n"
875 "0.0072 0.0072 scale\n"
881 fprintf(
m_outputFile,
"%d 0 translate 90 rotate\n", 10 * psPaperSize.
x );
912 const wxString& aText,
920 bool aMultilineAllowed,
933 fprintf(
m_outputFile,
"%s %g %g phantomshow\n", ps_test.c_str(), pos_dev.
x, pos_dev.
y );
936 PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
937 aBold, aMultilineAllowed, aFont, aFontMetrics, aData );
943 const wxString& aText,
957 fprintf(
m_outputFile,
"%s %g %g phantomshow\n", ps_test.c_str(), pos_dev.
x, pos_dev.
y );
960 PLOTTER::PlotText( aPos, aColor, aText, aAttributes, aFont, aFontMetrics, aData );
968 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
969 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
970 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
971 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
972 0.278, 0.278, 0.355, 0.556, 0.556, 0.889, 0.667, 0.191,
973 0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
974 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
975 0.556, 0.556, 0.278, 0.278, 0.584, 0.584, 0.584, 0.556,
976 1.015, 0.667, 0.667, 0.722, 0.722, 0.667, 0.611, 0.778,
977 0.722, 0.278, 0.500, 0.667, 0.556, 0.833, 0.722, 0.778,
978 0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
979 0.667, 0.667, 0.611, 0.278, 0.278, 0.278, 0.469, 0.556,
980 0.333, 0.556, 0.556, 0.500, 0.556, 0.556, 0.278, 0.556,
981 0.556, 0.222, 0.222, 0.500, 0.222, 0.833, 0.556, 0.556,
982 0.556, 0.556, 0.333, 0.500, 0.278, 0.556, 0.500, 0.722,
983 0.500, 0.500, 0.500, 0.334, 0.260, 0.334, 0.584, 0.278,
984 0.278, 0.278, 0.222, 0.556, 0.333, 1.000, 0.556, 0.556,
985 0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
986 0.278, 0.222, 0.222, 0.333, 0.333, 0.350, 0.556, 1.000,
987 0.333, 1.000, 0.500, 0.333, 0.944, 0.278, 0.278, 0.667,
988 0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.260, 0.556,
989 0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
990 0.400, 0.584, 0.333, 0.333, 0.333, 0.556, 0.537, 0.278,
991 0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
992 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 1.000, 0.722,
993 0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
994 0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
995 0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
996 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.500,
997 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
998 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.584,
999 0.611, 0.556, 0.556, 0.556, 0.556, 0.500, 0.556, 0.500
1007 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
1008 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
1009 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
1010 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
1011 0.278, 0.333, 0.474, 0.556, 0.556, 0.889, 0.722, 0.238,
1012 0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
1013 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
1014 0.556, 0.556, 0.333, 0.333, 0.584, 0.584, 0.584, 0.611,
1015 0.975, 0.722, 0.722, 0.722, 0.722, 0.667, 0.611, 0.778,
1016 0.722, 0.278, 0.556, 0.722, 0.611, 0.833, 0.722, 0.778,
1017 0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
1018 0.667, 0.667, 0.611, 0.333, 0.278, 0.333, 0.584, 0.556,
1019 0.333, 0.556, 0.611, 0.556, 0.611, 0.556, 0.333, 0.611,
1020 0.611, 0.278, 0.278, 0.556, 0.278, 0.889, 0.611, 0.611,
1021 0.611, 0.611, 0.389, 0.556, 0.333, 0.611, 0.556, 0.778,
1022 0.556, 0.556, 0.500, 0.389, 0.280, 0.389, 0.584, 0.278,
1023 0.278, 0.278, 0.278, 0.556, 0.500, 1.000, 0.556, 0.556,
1024 0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
1025 0.278, 0.278, 0.278, 0.500, 0.500, 0.350, 0.556, 1.000,
1026 0.333, 1.000, 0.556, 0.333, 0.944, 0.278, 0.278, 0.667,
1027 0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.280, 0.556,
1028 0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
1029 0.400, 0.584, 0.333, 0.333, 0.333, 0.611, 0.556, 0.278,
1030 0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
1031 0.722, 0.722, 0.722, 0.722, 0.722, 0.722, 1.000, 0.722,
1032 0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
1033 0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
1034 0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
1035 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.556,
1036 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
1037 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584,
1038 0.611, 0.611, 0.611, 0.611, 0.611, 0.556, 0.611, 0.556
1046 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
1047 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
1048 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
1049 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
1050 0.278, 0.278, 0.355, 0.556, 0.556, 0.889, 0.667, 0.191,
1051 0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
1052 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
1053 0.556, 0.556, 0.278, 0.278, 0.584, 0.584, 0.584, 0.556,
1054 1.015, 0.667, 0.667, 0.722, 0.722, 0.667, 0.611, 0.778,
1055 0.722, 0.278, 0.500, 0.667, 0.556, 0.833, 0.722, 0.778,
1056 0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
1057 0.667, 0.667, 0.611, 0.278, 0.278, 0.278, 0.469, 0.556,
1058 0.333, 0.556, 0.556, 0.500, 0.556, 0.556, 0.278, 0.556,
1059 0.556, 0.222, 0.222, 0.500, 0.222, 0.833, 0.556, 0.556,
1060 0.556, 0.556, 0.333, 0.500, 0.278, 0.556, 0.500, 0.722,
1061 0.500, 0.500, 0.500, 0.334, 0.260, 0.334, 0.584, 0.278,
1062 0.278, 0.278, 0.222, 0.556, 0.333, 1.000, 0.556, 0.556,
1063 0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
1064 0.278, 0.222, 0.222, 0.333, 0.333, 0.350, 0.556, 1.000,
1065 0.333, 1.000, 0.500, 0.333, 0.944, 0.278, 0.278, 0.667,
1066 0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.260, 0.556,
1067 0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
1068 0.400, 0.584, 0.333, 0.333, 0.333, 0.556, 0.537, 0.278,
1069 0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
1070 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 1.000, 0.722,
1071 0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
1072 0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
1073 0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
1074 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.500,
1075 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
1076 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.584,
1077 0.611, 0.556, 0.556, 0.556, 0.556, 0.500, 0.556, 0.500
1085 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
1086 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
1087 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
1088 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
1089 0.278, 0.333, 0.474, 0.556, 0.556, 0.889, 0.722, 0.238,
1090 0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
1091 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
1092 0.556, 0.556, 0.333, 0.333, 0.584, 0.584, 0.584, 0.611,
1093 0.975, 0.722, 0.722, 0.722, 0.722, 0.667, 0.611, 0.778,
1094 0.722, 0.278, 0.556, 0.722, 0.611, 0.833, 0.722, 0.778,
1095 0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
1096 0.667, 0.667, 0.611, 0.333, 0.278, 0.333, 0.584, 0.556,
1097 0.333, 0.556, 0.611, 0.556, 0.611, 0.556, 0.333, 0.611,
1098 0.611, 0.278, 0.278, 0.556, 0.278, 0.889, 0.611, 0.611,
1099 0.611, 0.611, 0.389, 0.556, 0.333, 0.611, 0.556, 0.778,
1100 0.556, 0.556, 0.500, 0.389, 0.280, 0.389, 0.584, 0.278,
1101 0.278, 0.278, 0.278, 0.556, 0.500, 1.000, 0.556, 0.556,
1102 0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
1103 0.278, 0.278, 0.278, 0.500, 0.500, 0.350, 0.556, 1.000,
1104 0.333, 1.000, 0.556, 0.333, 0.944, 0.278, 0.278, 0.667,
1105 0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.280, 0.556,
1106 0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
1107 0.400, 0.584, 0.333, 0.333, 0.333, 0.611, 0.556, 0.278,
1108 0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
1109 0.722, 0.722, 0.722, 0.722, 0.722, 0.722, 1.000, 0.722,
1110 0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
1111 0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
1112 0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
1113 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.556,
1114 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
1115 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584,
1116 0.611, 0.611, 0.611, 0.611, 0.611, 0.556, 0.611, 0.556
VECTOR2D mapCoords(const VECTOR2D &aSource)
const double hvbo_widths[256]
Character widths for Helvetica-BoldOblique.
static int getFillId(FILL_T aFill)
const double hvb_widths[256]
Character widths for Helvetica-Bold.
const double hv_widths[256]
Character widths for Helvetica.
const double hvo_widths[256]
Character widths for Helvetica-Oblique.
FONT is an abstract base class for both outline and stroke fonts.
A color representation with 4 components: red, green, blue, alpha.
int GetDefaultPenWidth() const
const VECTOR2D & GetSizeMils() const
double GetHeightMils() const
const wxString & GetType() const
double GetWidthMils() const
double GetDotMarkLenIU(int aLineWidth) const
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode, void *aData)
double GetDashGapLenIU(int aLineWidth) const
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
static const int USE_DEFAULT_LINE_WIDTH
virtual VECTOR2D userToDeviceCoordinates(const VECTOR2I &aCoordinate)
Modify coordinates according to the orientation, scale factor, and offsets trace.
virtual VECTOR2D userToDeviceSize(const VECTOR2I &size)
Modify size according to the plotter scale factors (VECTOR2I version, returns a VECTOR2D).
void sketchOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, int aWidth)
int GetPlotterArcHighDef() const
double m_plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
FILE * m_outputFile
Output file.
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).
static const int DO_NOT_SET_LINE_WIDTH
RENDER_SETTINGS * m_renderSettings
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 aPenWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr)
Draw text with the plotter.
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)
virtual int GetCurrentLineWidth() const
double GetDashMarkLenIU(int aLineWidth) const
static const double postscriptTextAscent
Height of the postscript font (from the AFM)
virtual void FlashRegularPolygon(const VECTOR2I &aShapePos, int aDiameter, int aCornerCount, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
Flash a regular polygon.
virtual void SetColor(const COLOR4D &color) override
The SetColor implementation is split with the subclasses: the PSLIKE computes the rgb values,...
virtual void FlashPadRoundRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
virtual void FlashPadCustom(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, SHAPE_POLY_SET *aPolygons, OUTLINE_MODE aTraceMode, void *aData) override
virtual void FlashPadCircle(const VECTOR2I &aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, void *aData) override
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 FlashPadTrapez(const VECTOR2I &aPadPos, const VECTOR2I *aCorners, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
Flash a trapezoidal pad.
virtual void FlashPadRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
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.
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.
virtual std::string encodeStringForPlotter(const wxString &aUnicode)
convert a wxString unicode string to a char string compatible with the accepted string plotter format...
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
virtual bool EndPlot() override
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.
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 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 PlotImage(const wxImage &aImage, const VECTOR2I &aPos, double aScaleFactor) override
PostScript-likes at the moment are the only plot engines supporting bitmaps.
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 Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle) override
PostScript supports dashed lines.
virtual bool StartPlot(const wxString &aPageNumber) override
The code within this function (and the CloseFilePS function) creates postscript files whose contents ...
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 emitSetRGBColor(double r, double g, double b, double a) override
Virtual primitive for emitting the setrgbcolor operator.
virtual void SetCurrentLineWidth(int width, void *aData=nullptr) override
Set the current line width (in IUs) for the next plot.
virtual void PenTo(const VECTOR2I &pos, char plume) override
Moveto/lineto primitive, moves the 'pen' to the specified direction.
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.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int OutlineCount() const
Return the number of outlines in the set.
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_0
static constexpr EDA_ANGLE ANGLE_90
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Plotting engines similar to ps (PostScript, Gerber, svg)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
LINE_STYLE
Dashed line types.
@ GR_TEXT_H_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_INDETERMINATE
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.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
VECTOR2< double > VECTOR2D