KiCad PCB EDA Suite
|
#include <gr_basic.h>
#include <trigo.h>
#include <eda_item.h>
#include <wx/graphics.h>
#include <math/vector2wx.h>
#include <algorithm>
Go to the source code of this file.
Functions | |
static void | GRSRect (wxDC *aDC, int x1, int y1, int x2, int y2, int aWidth, const COLOR4D &aColor) |
static void | vector2IwxDrawPolygon (wxDC *aDC, const VECTOR2I *Points, int n) |
static void | winDrawLine (wxDC *DC, int x1, int y1, int x2, int y2, int width) |
void | GRResetPenAndBrush (wxDC *DC) |
void | GRSetColorPen (wxDC *DC, const COLOR4D &Color, int width, wxPenStyle style) |
void | GRSetBrush (wxDC *DC, const COLOR4D &Color, bool fill) |
void | GRForceBlackPen (bool flagforce) |
bool | GetGRForceBlackPenState (void) |
void | GRLine (wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle) |
void | GRLine (wxDC *aDC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor, wxPenStyle aStyle) |
void | GRMoveTo (int x, int y) |
void | GRLineTo (wxDC *DC, int x, int y, int width, const COLOR4D &Color) |
void | GRCSegm (wxDC *DC, const VECTOR2I &A, const VECTOR2I &B, int width, const COLOR4D &Color) |
void | GRFilledSegment (wxDC *aDC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor) |
static void | GRSPoly (wxDC *DC, int n, const VECTOR2I *Points, bool Fill, int width, const COLOR4D &Color, const COLOR4D &BgColor) |
Draw a new polyline and fill it if Fill, in screen space. | |
static void | GRSClosedPoly (wxDC *aDC, int aPointCount, const VECTOR2I *aPoints, bool aFill, int aWidth, const COLOR4D &aColor, const COLOR4D &aBgColor) |
Draw a new closed polyline and fill it if Fill, in screen space. | |
void | GRPoly (wxDC *DC, int n, const VECTOR2I *Points, bool Fill, int width, const COLOR4D &Color, const COLOR4D &BgColor) |
Draw a new polyline and fill it if Fill, in drawing space. | |
void | GRClosedPoly (wxDC *DC, int n, const VECTOR2I *Points, bool Fill, const COLOR4D &Color) |
Draw a closed polyline and fill it if Fill, in object space. | |
void | GRCircle (wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aColor) |
void | GRFilledCircle (wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aStrokeColor, const COLOR4D &aFillColor) |
Draw a circle onto the drawing context aDC centered at the user coordinates (x,y). | |
void | GRArc (wxDC *aDC, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, int aWidth, const COLOR4D &aColor) |
void | GRFilledArc (wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, int width, const COLOR4D &Color, const COLOR4D &BgColor) |
void | GRRect (wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor) |
void | GRFilledRect (wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor, const COLOR4D &aBgColor) |
void | GRSFilledRect (wxDC *aDC, int x1, int y1, int x2, int y2, int aWidth, const COLOR4D &aColor, const COLOR4D &aBgColor) |
Variables | |
static const bool | FILLED = true |
static const bool | NOT_FILLED = false |
GR_DRAWMODE | g_XorMode = GR_NXOR |
static int | GRLastMoveToX |
static int | GRLastMoveToY |
static bool | s_ForceBlackPen |
static COLOR4D | s_DC_lastbrushcolor (0, 0, 0, 0) |
static bool | s_DC_lastbrushfill = false |
static wxDC * | s_DC_lastDC = nullptr |
bool GetGRForceBlackPenState | ( | void | ) |
Definition at line 165 of file gr_basic.cpp.
References s_ForceBlackPen.
Referenced by BITMAP_BASE::DrawBitmap(), SCH_FIELD::Print(), SCH_PIN::Print(), SCH_SHAPE::Print(), SCH_SHEET::Print(), SCH_LABEL_BASE::Print(), SCH_TEXT::Print(), SCH_TEXTBOX::Print(), LIB_SYMBOL::PrintBackground(), SCH_PIN::printPinElectricalTypeName(), SCH_PIN::printPinSymbol(), and SCH_PIN::printPinTexts().
void GRArc | ( | wxDC * | aDC, |
const VECTOR2I & | aStart, | ||
const VECTOR2I & | aEnd, | ||
const VECTOR2I & | aCenter, | ||
int | aWidth, | ||
const COLOR4D & | aColor | ||
) |
Definition at line 378 of file gr_basic.cpp.
References GRSetBrush(), GRSetColorPen(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by SCH_SHAPE::Print(), and GERBER_DRAW_ITEM::Print().
void GRCircle | ( | wxDC * | aDC, |
const VECTOR2I & | aPos, | ||
int | aRadius, | ||
int | aWidth, | ||
const COLOR4D & | aColor | ||
) |
Definition at line 357 of file gr_basic.cpp.
References GRSetBrush(), GRSetColorPen(), NOT_FILLED, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by D_CODE::DrawFlashedShape(), SCH_PIN::Print(), SCH_SHAPE::Print(), SCH_LABEL_BASE::Print(), GERBER_DRAW_ITEM::Print(), and SCH_PIN::printPinSymbol().
Draw a closed polyline and fill it if Fill, in object space.
Draw a closed polygon onto the drawing context aDC and optionally fills and/or draws a border around it.
Definition at line 351 of file gr_basic.cpp.
References GRSClosedPoly().
Referenced by D_CODE::DrawFlashedPolygon(), GRPrintText(), GERBER_DRAW_ITEM::PrintGerberPoly(), and MARKER_BASE::PrintMarker().
void GRCSegm | ( | wxDC * | DC, |
const VECTOR2I & | A, | ||
const VECTOR2I & | B, | ||
int | width, | ||
const COLOR4D & | Color | ||
) |
Definition at line 201 of file gr_basic.cpp.
References GRLastMoveToX, GRLastMoveToY, GRSetBrush(), GRSetColorPen(), NOT_FILLED, RotatePoint(), ToWxPoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by D_CODE::DrawFlashedShape(), GRPrintText(), and GERBER_DRAW_ITEM::Print().
void GRFilledArc | ( | wxDC * | DC, |
const VECTOR2I & | aStart, | ||
const VECTOR2I & | aEnd, | ||
const VECTOR2I & | aCenter, | ||
int | width, | ||
const COLOR4D & | Color, | ||
const COLOR4D & | BgColor | ||
) |
Definition at line 387 of file gr_basic.cpp.
References FILLED, GRSetBrush(), GRSetColorPen(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by SCH_SHAPE::Print(), and SCH_SHAPE::PrintBackground().
void GRFilledCircle | ( | wxDC * | aDC, |
const VECTOR2I & | aPos, | ||
int | aRadius, | ||
int | aWidth, | ||
const COLOR4D & | aStrokeColor, | ||
const COLOR4D & | aFillColor | ||
) |
Draw a circle onto the drawing context aDC centered at the user coordinates (x,y).
aDC | the device context into which drawing should occur. |
x | The x coordinate in user space of the center of the circle. |
y | The y coordinate in user space of the center of the circle. |
aRadius | is the radius of the circle. |
aColor | is the color to draw. |
Definition at line 369 of file gr_basic.cpp.
References FILLED, GRSetBrush(), GRSetColorPen(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by D_CODE::DrawFlashedShape(), SCH_JUNCTION::Print(), SCH_SHAPE::Print(), SCH_LABEL_BASE::Print(), and SCH_SHAPE::PrintBackground().
void GRFilledRect | ( | wxDC * | DC, |
const VECTOR2I & | aStart, | ||
const VECTOR2I & | aEnd, | ||
int | aWidth, | ||
const COLOR4D & | aColor, | ||
const COLOR4D & | aBgColor | ||
) |
Definition at line 403 of file gr_basic.cpp.
References GRSFilledRect(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by D_CODE::DrawFlashedShape(), SCH_SHAPE::Print(), SCH_SHEET::Print(), SCH_TEXTBOX::Print(), SCH_SHAPE::PrintBackground(), and DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample().
void GRFilledSegment | ( | wxDC * | aDC, |
const VECTOR2I & | aStart, | ||
const VECTOR2I & | aEnd, | ||
int | aWidth, | ||
const COLOR4D & | aColor | ||
) |
Definition at line 278 of file gr_basic.cpp.
References GRSetColorPen(), winDrawLine(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by D_CODE::DrawFlashedShape(), SCH_SHEET::Print(), SCH_SYMBOL::Print(), and GERBER_DRAW_ITEM::Print().
void GRForceBlackPen | ( | bool | flagforce | ) |
flagforce | True to force a black pen whenever the asked color. |
Definition at line 159 of file gr_basic.cpp.
References s_ForceBlackPen.
Referenced by SCH_EDIT_FRAME::DrawCurrentSheetToClipboard(), PLEDITOR_PRINTOUT::PrintPage(), and SCH_PRINTOUT::PrintPage().
void GRLine | ( | wxDC * | aDC, |
const VECTOR2I & | aStart, | ||
const VECTOR2I & | aEnd, | ||
int | aWidth, | ||
const COLOR4D & | aColor, | ||
wxPenStyle | aStyle | ||
) |
Definition at line 181 of file gr_basic.cpp.
References GRLine(), VECTOR2< T >::x, and VECTOR2< T >::y.
void GRLine | ( | wxDC * | DC, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | width, | ||
const COLOR4D & | Color, | ||
wxPenStyle | aStyle | ||
) |
Definition at line 171 of file gr_basic.cpp.
References GRLastMoveToX, GRLastMoveToY, GRSetColorPen(), and winDrawLine().
Referenced by GRLine(), GRLineTo(), GRPrintText(), SCH_BUS_ENTRY_BASE::Print(), SCH_LINE::Print(), SCH_NO_CONNECT::Print(), SCH_SHAPE::Print(), SCH_LABEL_BASE::Print(), SCH_TABLE::Print(), SCH_TEXTBOX::Print(), SCH_PIN::printPinSymbol(), and DS_DRAW_ITEM_LINE::PrintWsItem().
void GRLineTo | ( | wxDC * | DC, |
int | x, | ||
int | y, | ||
int | width, | ||
const COLOR4D & | Color | ||
) |
Definition at line 195 of file gr_basic.cpp.
References GRLastMoveToX, GRLastMoveToY, and GRLine().
Referenced by GRSClosedPoly(), GRSPoly(), and SCH_PIN::printPinSymbol().
void GRMoveTo | ( | int | x, |
int | y | ||
) |
Definition at line 188 of file gr_basic.cpp.
References GRLastMoveToX, and GRLastMoveToY.
Referenced by GRSClosedPoly(), GRSPoly(), and SCH_PIN::printPinSymbol().
void GRPoly | ( | wxDC * | DC, |
int | n, | ||
const VECTOR2I * | Points, | ||
bool | Fill, | ||
int | width, | ||
const COLOR4D & | Color, | ||
const COLOR4D & | BgColor | ||
) |
Draw a new polyline and fill it if Fill, in drawing space.
Definition at line 341 of file gr_basic.cpp.
References GRSPoly().
Referenced by SCH_SHAPE::Print(), SCH_LABEL_BASE::Print(), SCH_SHAPE::PrintBackground(), and DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem().
void GRRect | ( | wxDC * | DC, |
const VECTOR2I & | aStart, | ||
const VECTOR2I & | aEnd, | ||
int | aWidth, | ||
const COLOR4D & | aColor | ||
) |
Definition at line 396 of file gr_basic.cpp.
References GRSRect(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by D_CODE::DrawFlashedShape(), SCH_SHAPE::Print(), SCH_SHEET::Print(), SCH_TABLE::Print(), SCH_TEXTBOX::Print(), and DS_DRAW_ITEM_RECT::PrintWsItem().
void GRResetPenAndBrush | ( | wxDC * | DC | ) |
Definition at line 73 of file gr_basic.cpp.
References BLACK, GRSetBrush(), s_DC_lastbrushcolor, s_DC_lastDC, and KIGFX::COLOR4D::UNSPECIFIED.
Referenced by SCH_EDIT_FRAME::DrawCurrentSheetToClipboard(), DIALOG_PIN_PROPERTIES::OnPaintShowPanel(), PLEDITOR_PRINTOUT::PrintPage(), SCH_PRINTOUT::PrintPage(), and DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample().
|
static |
Draw a new closed polyline and fill it if Fill, in screen space.
Definition at line 311 of file gr_basic.cpp.
References FILLED, GRLastMoveToX, GRLastMoveToY, GRLineTo(), GRMoveTo(), GRSetBrush(), GRSetColorPen(), vector2IwxDrawPolygon(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by GRClosedPoly(), and GRSRect().
void GRSetBrush | ( | wxDC * | DC, |
const COLOR4D & | Color, | ||
bool | fill | ||
) |
Definition at line 132 of file gr_basic.cpp.
References KIGFX::COLOR4D::BLACK, color, s_DC_lastbrushcolor, s_DC_lastbrushfill, s_DC_lastDC, and s_ForceBlackPen.
Referenced by GRArc(), GRCircle(), GRCSegm(), GRFilledArc(), GRFilledCircle(), GRResetPenAndBrush(), GRSClosedPoly(), GRSFilledRect(), and GRSPoly().
void GRSetColorPen | ( | wxDC * | DC, |
const COLOR4D & | Color, | ||
int | width, | ||
wxPenStyle | style | ||
) |
Definition at line 81 of file gr_basic.cpp.
References KIGFX::COLOR4D::BLACK, color, s_ForceBlackPen, and KIGFX::COLOR4D::UNSPECIFIED.
Referenced by GRArc(), GRCircle(), GRCSegm(), GRFilledArc(), GRFilledCircle(), GRFilledSegment(), GRLine(), GRSClosedPoly(), GRSFilledRect(), and GRSPoly().
void GRSFilledRect | ( | wxDC * | aDC, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | aWidth, | ||
const COLOR4D & | aColor, | ||
const COLOR4D & | aBgColor | ||
) |
Definition at line 422 of file gr_basic.cpp.
References FILLED, GRSetBrush(), GRSetColorPen(), and vector2IwxDrawPolygon().
Referenced by GRFilledRect(), and SCH_PRINTOUT::PrintPage().
|
static |
Draw a new polyline and fill it if Fill, in screen space.
Definition at line 288 of file gr_basic.cpp.
References FILLED, GRLineTo(), GRMoveTo(), GRSetBrush(), GRSetColorPen(), and vector2IwxDrawPolygon().
Referenced by GRPoly().
|
static |
Definition at line 410 of file gr_basic.cpp.
References GRSClosedPoly(), and NOT_FILLED.
Referenced by GRRect().
|
static |
Definition at line 53 of file gr_basic.cpp.
Referenced by GRSClosedPoly(), GRSFilledRect(), and GRSPoly().
|
static |
Definition at line 65 of file gr_basic.cpp.
References GRLastMoveToX, and GRLastMoveToY.
Referenced by GRFilledSegment(), and GRLine().
|
static |
Definition at line 30 of file gr_basic.cpp.
Referenced by DIALOG_PLOT::applyPlotSettings(), GERBER_WRITER::createDrillFile(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), PLOTTER::FilledCircle(), GERBER_PLOTTER::FilledCircle(), GERBER_PLOTTER::FlashPadChamferRoundRect(), HPGL_PLOTTER::FlashPadCircle(), PSLIKE_PLOTTER::FlashPadCircle(), HPGL_PLOTTER::FlashPadCustom(), PSLIKE_PLOTTER::FlashPadCustom(), GERBER_PLOTTER::FlashPadCustom(), GERBER_PLOTTER::FlashPadOval(), HPGL_PLOTTER::FlashPadOval(), PSLIKE_PLOTTER::FlashPadOval(), HPGL_PLOTTER::FlashPadRect(), PSLIKE_PLOTTER::FlashPadRect(), GERBER_PLOTTER::FlashPadRoundRect(), HPGL_PLOTTER::FlashPadRoundRect(), PSLIKE_PLOTTER::FlashPadRoundRect(), HPGL_PLOTTER::FlashPadTrapez(), PSLIKE_PLOTTER::FlashPadTrapez(), GRFilledArc(), GRFilledCircle(), GRSClosedPoly(), GRSFilledRect(), GRSPoly(), PCB_PLOT_PARAMS_PARSER::Parse(), PCB_PLOT_PARAMS::PCB_PLOT_PARAMS(), SCH_LABEL_BASE::Plot(), SCH_SHEET::Plot(), SCH_SYMBOL::PlotDNP(), BRDITEMS_PLOTTER::PlotDrillMarks(), DXF_PLOTTER::PlotPoly(), PlotStandardLayer(), BRDITEMS_PLOTTER::PlotText(), BRDITEMS_PLOTTER::PlotZone(), DS_DRAW_ITEM_TEXT::PrintWsItem(), DIALOG_PLOT::SetPlotFormat(), PLOTTER::ThickArc(), GERBER_PLOTTER::ThickArc(), PLOTTER::ThickCircle(), GERBER_PLOTTER::ThickCircle(), PLOTTER::ThickRect(), GERBER_PLOTTER::ThickRect(), PLOTTER::ThickSegment(), and GERBER_PLOTTER::ThickSegment().
GR_DRAWMODE g_XorMode = GR_NXOR |
Definition at line 34 of file gr_basic.cpp.
|
static |
Definition at line 45 of file gr_basic.cpp.
Referenced by GRCSegm(), GRLine(), GRLineTo(), GRMoveTo(), GRSClosedPoly(), and winDrawLine().
|
static |
Definition at line 45 of file gr_basic.cpp.
Referenced by GRCSegm(), GRLine(), GRLineTo(), GRMoveTo(), GRSClosedPoly(), and winDrawLine().
|
static |
Definition at line 31 of file gr_basic.cpp.
Referenced by GRCircle(), GRCSegm(), and GRSRect().
|
static |
Referenced by GRResetPenAndBrush(), and GRSetBrush().
|
static |
Definition at line 49 of file gr_basic.cpp.
Referenced by GRSetBrush().
|
static |
Definition at line 50 of file gr_basic.cpp.
Referenced by GRResetPenAndBrush(), and GRSetBrush().
|
static |
Definition at line 46 of file gr_basic.cpp.
Referenced by GetGRForceBlackPenState(), GRForceBlackPen(), GRSetBrush(), and GRSetColorPen().