KiCad PCB EDA Suite
Loading...
Searching...
No Matches
gr_basic.h File Reference
#include <gal/color4d.h>
#include <math/box2.h>
#include <vector>
#include <wx/pen.h>
#include <wx/dc.h>

Go to the source code of this file.

Enumerations

enum  GR_DRAWMODE {
  GR_OR = 0x01000000 , GR_XOR = 0x02000000 , GR_AND = 0x04000000 , GR_NXOR = 0x08000000 ,
  GR_INVERT = 0x10000000 , GR_ALLOW_HIGHCONTRAST = 0x20000000 , GR_COPY = 0x40000000 , GR_HIGHLIGHT = 0x80000000 ,
  UNSPECIFIED_DRAWMODE = -1
}
 Drawmode. Compositing mode plus a flag or two. More...
 
enum  GRLineStypeType { GR_SOLID_LINE = 0 , GR_DOTTED_LINE = 1 , GR_DASHED_LINE = 3 }
 

Functions

GR_DRAWMODE operator~ (const GR_DRAWMODE &a)
 
GR_DRAWMODE operator| (const GR_DRAWMODE &a, const GR_DRAWMODE &b)
 
GR_DRAWMODE operator& (const GR_DRAWMODE &a, const GR_DRAWMODE &b)
 
void GRResetPenAndBrush (wxDC *DC)
 
void GRSetColorPen (wxDC *DC, const COLOR4D &Color, int width=1, wxPenStyle stype=wxPENSTYLE_SOLID)
 
void GRSetBrush (wxDC *DC, const COLOR4D &Color, bool fill=false)
 
void GRForceBlackPen (bool flagforce)
 
bool GetGRForceBlackPenState (void)
 
void GRLine (wxDC *aDC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor, wxPenStyle aStyle=wxPENSTYLE_SOLID)
 
void GRLine (wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle=wxPENSTYLE_SOLID)
 
void GRMoveTo (int x, int y)
 
void GRLineTo (wxDC *DC, int x, int y, int width, const COLOR4D &Color)
 
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 *aDC, int aPointCount, const VECTOR2I *aPoints, bool doFill, const COLOR4D &aColor)
 Draw a closed polygon onto the drawing context aDC and optionally fills and/or draws a border around it.
 
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 GRCircle (wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aColor)
 
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 GRFilledSegment (wxDC *aDC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor)
 
void GRCSegm (wxDC *aDC, 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 GRRect (wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor)
 
void GRSFilledRect (wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, const COLOR4D &BgColor)
 

Variables

GR_DRAWMODE g_XorMode
 

Enumeration Type Documentation

◆ GR_DRAWMODE

Drawmode. Compositing mode plus a flag or two.

Enumerator
GR_OR 
GR_XOR 
GR_AND 
GR_NXOR 
GR_INVERT 
GR_ALLOW_HIGHCONTRAST 
GR_COPY 
GR_HIGHLIGHT 
UNSPECIFIED_DRAWMODE 

Definition at line 35 of file gr_basic.h.

◆ GRLineStypeType

Enumerator
GR_SOLID_LINE 
GR_DOTTED_LINE 
GR_DASHED_LINE 

Definition at line 64 of file gr_basic.h.

Function Documentation

◆ GetGRForceBlackPenState()

◆ GRArc()

void GRArc ( wxDC *  aDC,
const VECTOR2I aStart,
const VECTOR2I aEnd,
const VECTOR2I aCenter,
int  aWidth,
const COLOR4D aColor 
)

◆ GRCircle()

void GRCircle ( wxDC *  aDC,
const VECTOR2I aPos,
int  aRadius,
int  aWidth,
const COLOR4D aColor 
)

◆ GRClosedPoly()

void GRClosedPoly ( wxDC *  DC,
int  n,
const VECTOR2I Points,
bool  Fill,
const COLOR4D Color 
)

Draw a closed polygon onto the drawing context aDC and optionally fills and/or draws a border around it.

Parameters
aDCthe device context into which drawing should occur.
aPointCountthe number of points in the array aPoints.
aPointsThe points to draw.
doFilltrue if polygon is to be filled, else false and only the boundary is drawn.
aColorthe color of the border and the fill.

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().

◆ GRCSegm()

void GRCSegm ( wxDC *  aDC,
const VECTOR2I aStart,
const VECTOR2I aEnd,
int  aWidth,
const COLOR4D aColor 
)

◆ GRFilledArc()

void GRFilledArc ( wxDC *  DC,
const VECTOR2I aStart,
const VECTOR2I aEnd,
const VECTOR2I aCenter,
int  width,
const COLOR4D Color,
const COLOR4D BgColor 
)

◆ GRFilledCircle()

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).

Parameters
aDCthe device context into which drawing should occur.
xThe x coordinate in user space of the center of the circle.
yThe y coordinate in user space of the center of the circle.
aRadiusis the radius of the circle.
aColoris the color to draw.
See also
COLOR4D

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().

◆ GRFilledRect()

void GRFilledRect ( wxDC *  DC,
const VECTOR2I aStart,
const VECTOR2I aEnd,
int  aWidth,
const COLOR4D aColor,
const COLOR4D aBgColor 
)

◆ GRFilledSegment()

void GRFilledSegment ( wxDC *  aDC,
const VECTOR2I aStart,
const VECTOR2I aEnd,
int  aWidth,
const COLOR4D aColor 
)

◆ GRForceBlackPen()

void GRForceBlackPen ( bool  flagforce)
Parameters
flagforceTrue 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().

◆ GRLine() [1/2]

void GRLine ( wxDC *  aDC,
const VECTOR2I aStart,
const VECTOR2I aEnd,
int  aWidth,
const COLOR4D aColor,
wxPenStyle  aStyle = wxPENSTYLE_SOLID 
)

Definition at line 181 of file gr_basic.cpp.

References GRLine(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ GRLine() [2/2]

void GRLine ( wxDC *  DC,
int  x1,
int  y1,
int  x2,
int  y2,
int  width,
const COLOR4D Color,
wxPenStyle  aStyle = wxPENSTYLE_SOLID 
)

◆ GRLineTo()

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().

◆ GRMoveTo()

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().

◆ GRPoly()

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().

◆ GRRect()

void GRRect ( wxDC *  DC,
const VECTOR2I aStart,
const VECTOR2I aEnd,
int  aWidth,
const COLOR4D aColor 
)

◆ GRResetPenAndBrush()

◆ GRSetBrush()

void GRSetBrush ( wxDC *  DC,
const COLOR4D Color,
bool  fill = false 
)

◆ GRSetColorPen()

void GRSetColorPen ( wxDC *  DC,
const COLOR4D Color,
int  width = 1,
wxPenStyle  stype = wxPENSTYLE_SOLID 
)

◆ GRSFilledRect()

void GRSFilledRect ( wxDC *  DC,
int  x1,
int  y1,
int  x2,
int  y2,
int  width,
const COLOR4D Color,
const COLOR4D BgColor 
)

Definition at line 422 of file gr_basic.cpp.

References FILLED, GRSetBrush(), GRSetColorPen(), and vector2IwxDrawPolygon().

Referenced by GRFilledRect(), and SCH_PRINTOUT::PrintPage().

◆ operator&()

GR_DRAWMODE operator& ( const GR_DRAWMODE a,
const GR_DRAWMODE b 
)
inline

Definition at line 57 of file gr_basic.h.

◆ operator|()

GR_DRAWMODE operator| ( const GR_DRAWMODE a,
const GR_DRAWMODE b 
)
inline

Definition at line 52 of file gr_basic.h.

◆ operator~()

GR_DRAWMODE operator~ ( const GR_DRAWMODE a)
inline

Definition at line 47 of file gr_basic.h.

Variable Documentation

◆ g_XorMode

GR_DRAWMODE g_XorMode
extern

Definition at line 34 of file gr_basic.cpp.