KiCad PCB EDA Suite
gr_basic.cpp File Reference
#include <fctsys.h>
#include <gr_basic.h>
#include <common.h>
#include <trigo.h>
#include <macros.h>
#include <base_struct.h>
#include <base_screen.h>
#include <bezier_curves.h>
#include <math_for_graphics.h>
#include <wx/graphics.h>
#include <wx/tokenzr.h>
#include <geometry/geometry_utils.h>
#include <math/util.h>
#include <algorithm>
#include <SutherlandHodgmanClipPoly.h>

Go to the source code of this file.

Macros

#define DEBUG_DUMP_CLIP_ERROR_COORDS   0
 
#define DEBUG_DUMP_CLIP_COORDS   0
 

Functions

static void ClipAndDrawPoly (EDA_RECT *aClipBox, wxDC *aDC, const wxPoint *Points, int n)
 Function ClipAndDrawPoly Used to clip a polygon and draw it as Filled Polygon uses the Sutherland and Hodgman algo to clip the given poly against a rectangle. More...
 
static void GRSRect (EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, int aWidth, COLOR4D aColor, wxPenStyle aStyle=wxPENSTYLE_SOLID)
 
static void WinClipAndDrawLine (EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width)
 
void GRResetPenAndBrush (wxDC *DC)
 
void GRSetColorPen (wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
 Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context. More...
 
void GRSetBrush (wxDC *DC, COLOR4D Color, bool fill)
 
void GRForceBlackPen (bool flagforce)
 Function GRForceBlackPen. More...
 
bool GetGRForceBlackPenState (void)
 Function GetGRForceBlackPenState. More...
 
void GRPutPixel (EDA_RECT *ClipBox, wxDC *DC, int x, int y, COLOR4D Color)
 
void GRLine (EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
 
void GRLine (EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor, wxPenStyle aStyle)
 
void GRMoveTo (int x, int y)
 
void GRLineTo (EDA_RECT *ClipBox, wxDC *DC, int x, int y, int width, COLOR4D Color)
 
void GRLineArray (EDA_RECT *aClipBox, wxDC *aDC, std::vector< wxPoint > &aLines, int aWidth, COLOR4D aColor)
 Function GRLineArray draws an array of lines (not a polygon). More...
 
void GRCSegm (EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
 
void GRCSegm (EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
 
void GRCSegm (EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor)
 
void GRFillCSegm (EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
 
void GRFilledSegment (EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor)
 
static bool IsGRSPolyDrawable (EDA_RECT *ClipBox, int n, const wxPoint *Points)
 
static void GRSPoly (EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
 
static void GRSClosedPoly (EDA_RECT *aClipBox, wxDC *aDC, int aPointCount, const wxPoint *aPoints, bool aFill, int aWidth, COLOR4D aColor, COLOR4D aBgColor)
 
void GRPoly (EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
 
void GRClosedPoly (EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, COLOR4D Color, COLOR4D BgColor)
 Function GRClosedPoly draws a closed polygon onto the drawing context aDC and optionally fills and/or draws a border around it. More...
 
void GRClosedPoly (EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
 Function GRClosedPoly draws a closed polygon onto the drawing context aDC and optionally fills and/or draws a border around it. More...
 
static bool clipCircle (EDA_RECT *aClipBox, int xc, int yc, int r, int aWidth)
 
void GRCircle (EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
 
void GRCircle (EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, COLOR4D Color)
 Function GRCircle draws a circle onto the drawing context aDC centered at the user coordinates (x,y) More...
 
void GRCircle (EDA_RECT *aClipBox, wxDC *aDC, wxPoint aPos, int aRadius, int aWidth, COLOR4D aColor)
 
void GRFilledCircle (EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, COLOR4D Color, COLOR4D BgColor)
 
void GRFilledCircle (EDA_RECT *aClipBox, wxDC *aDC, wxPoint aPos, int aRadius, COLOR4D aColor)
 
void GRArc1 (EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int xc, int yc, COLOR4D Color)
 
void GRArc1 (EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int xc, int yc, int width, COLOR4D Color)
 
void GRArc1 (EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, wxPoint aCenter, int aWidth, COLOR4D aColor)
 
void GRFilledArc (EDA_RECT *ClipBox, wxDC *DC, int x, int y, double StAngle, double EndAngle, int r, int width, COLOR4D Color, COLOR4D BgColor)
 
void GRFilledArc (EDA_RECT *ClipBox, wxDC *DC, int x, int y, double StAngle, double EndAngle, int r, COLOR4D Color, COLOR4D BgColor)
 
void GRArc (EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, double StAngle, double EndAngle, int r, COLOR4D Color)
 
void GRArc (EDA_RECT *ClipBox, wxDC *DC, int x, int y, double StAngle, double EndAngle, int r, int width, COLOR4D Color)
 
void GRRect (EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
 
void GRRectPs (EDA_RECT *aClipBox, wxDC *aDC, const EDA_RECT &aRect, COLOR4D aColor, wxPenStyle aStyle)
 
void GRRect (EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
 
void GRRect (EDA_RECT *aClipBox, wxDC *aDC, const EDA_RECT &aRect, int aWidth, COLOR4D aColor)
 
void GRFilledRect (EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, COLOR4D Color, COLOR4D BgColor)
 
void GRFilledRect (EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, COLOR4D BgColor)
 
void GRSFilledRect (EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, int aWidth, COLOR4D aColor, COLOR4D aBgColor)
 
void GRBezier (EDA_RECT *aClipBox, wxDC *aDC, std::vector< wxPoint > &aPoint, int aWidth, COLOR4D aColor)
 Draw cubic (4 points: start control1, control2, end) bezier curve. More...
 
void GRDrawAnchor (EDA_RECT *aClipBox, wxDC *aDC, int x, int y, int aSize, COLOR4D aColor)
 
void GRDrawWrappedText (wxDC &aDC, wxString const &aText)
 Draw text centered on a wxDC with wrapping. More...
 

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 int xcliplo = 0
 
static int ycliplo = 0
 
static int xcliphi = 2000
 
static int ycliphi = 2000
 
static COLOR4D s_DC_lastcolor (0, 0, 0, 0)
 
static COLOR4D s_DC_lastbrushcolor (0, 0, 0, 0)
 
static bool s_DC_lastbrushfill = false
 
static wxDC * s_DC_lastDC = NULL
 

Macro Definition Documentation

◆ DEBUG_DUMP_CLIP_COORDS

#define DEBUG_DUMP_CLIP_COORDS   0

Definition at line 70 of file gr_basic.cpp.

◆ DEBUG_DUMP_CLIP_ERROR_COORDS

#define DEBUG_DUMP_CLIP_ERROR_COORDS   0

Definition at line 69 of file gr_basic.cpp.

Function Documentation

◆ ClipAndDrawPoly()

void ClipAndDrawPoly ( EDA_RECT aClipBox,
wxDC *  aDC,
const wxPoint Points,
int  n 
)
static

Function ClipAndDrawPoly Used to clip a polygon and draw it as Filled Polygon uses the Sutherland and Hodgman algo to clip the given poly against a rectangle.

This rectangle is the drawing area this is useful under Linux (2009) because filled polygons are incorrectly drawn if they have too large coordinates (seems due to integer overflows in calculations) Could be removed in some years, if become unnecessary.

Definition at line 959 of file gr_basic.cpp.

960 {
961  if( aClipBox == NULL )
962  {
963  aDC->DrawPolygon( n, Points );
964  return;
965  }
966 
967  // A clip box exists: clip and draw the polygon.
968  static std::vector<wxPoint> clippedPolygon;
969  static pointVector inputPolygon, outputPolygon;
970 
971  inputPolygon.clear();
972  outputPolygon.clear();
973  clippedPolygon.clear();
974 
975  for( int ii = 0; ii < n; ii++ )
976  inputPolygon.push_back( PointF( (REAL) Points[ii].x, (REAL) Points[ii].y ) );
977 
978  RectF window( (REAL) aClipBox->GetX(), (REAL) aClipBox->GetY(),
979  (REAL) aClipBox->GetWidth(), (REAL) aClipBox->GetHeight() );
980 
981  SutherlandHodgman sh( window );
982  sh.Clip( inputPolygon, outputPolygon );
983 
984  for( cpointIterator cit = outputPolygon.begin(); cit != outputPolygon.end(); ++cit )
985  {
986  clippedPolygon.emplace_back( KiROUND( cit->X ), KiROUND( cit->Y ) );
987  }
988 
989  if( clippedPolygon.size() )
990  aDC->DrawPolygon( clippedPolygon.size(), &clippedPolygon[0] );
991 }
int GetX() const
Definition: eda_rect.h:111
int GetWidth() const
Definition: eda_rect.h:119
#define NULL
int GetHeight() const
Definition: eda_rect.h:120
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
int GetY() const
Definition: eda_rect.h:112

References EDA_RECT::GetHeight(), EDA_RECT::GetWidth(), EDA_RECT::GetX(), EDA_RECT::GetY(), KiROUND(), and NULL.

Referenced by GRSClosedPoly(), GRSFilledRect(), and GRSPoly().

◆ clipCircle()

static bool clipCircle ( EDA_RECT aClipBox,
int  xc,
int  yc,
int  r,
int  aWidth 
)
static

Definition at line 568 of file gr_basic.cpp.

569 {
570  // Clip circles that are outside the ClipBox.
571  if( aClipBox )
572  {
573  int x0, y0, xm, ym;
574  x0 = aClipBox->GetX();
575  y0 = aClipBox->GetY();
576  xm = aClipBox->GetRight();
577  ym = aClipBox->GetBottom();
578 
579  r += aWidth;
580 
581  if( xc < ( x0 - r ) )
582  return true;
583 
584  if( yc < ( y0 - r ) )
585  return true;
586 
587  if( xc > ( r + xm ) )
588  return true;
589 
590  if( yc > ( r + ym ) )
591  return true;
592  }
593 
594  return false;
595 }
int GetX() const
Definition: eda_rect.h:111
int GetBottom() const
Definition: eda_rect.h:124
int GetRight() const
Definition: eda_rect.h:121
int GetY() const
Definition: eda_rect.h:112

References EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), and EDA_RECT::GetY().

Referenced by GRCircle(), and GRFilledCircle().

◆ GetGRForceBlackPenState()

bool GetGRForceBlackPenState ( void  )

Function GetGRForceBlackPenState.

Returns
s_ForceBlackPen (True if a black pen was forced)

Definition at line 213 of file gr_basic.cpp.

214 {
215  return s_ForceBlackPen;
216 }
static bool s_ForceBlackPen
Definition: gr_basic.cpp:90

References s_ForceBlackPen.

Referenced by BITMAP_BASE::DrawBitmap(), and LIB_PART::Print().

◆ GRArc() [1/2]

void GRArc ( EDA_RECT ClipBox,
wxDC *  DC,
int  xc,
int  yc,
double  StAngle,
double  EndAngle,
int  r,
COLOR4D  Color 
)

Definition at line 751 of file gr_basic.cpp.

753 {
754  int x1, y1, x2, y2;
755 
756  /* Clip arcs off screen */
757  if( ClipBox )
758  {
759  int radius = r + 1;
760  int x0, y0, xm, ym, x, y;
761  x0 = ClipBox->GetX();
762  y0 = ClipBox->GetY();
763  xm = ClipBox->GetRight();
764  ym = ClipBox->GetBottom();
765  x = xc;
766  y = yc;
767 
768  if( x < ( x0 - radius ) )
769  return;
770  if( y < ( y0 - radius ) )
771  return;
772  if( x > ( xm + radius ) )
773  return;
774  if( y > ( ym + radius ) )
775  return;
776  }
777 
778  x1 = r;
779  y1 = 0;
780  RotatePoint( &x1, &y1, EndAngle );
781 
782  x2 = r;
783  y2 = 0;
784  RotatePoint( &x2, &y2, StAngle );
785 
786  GRSetBrush( DC, Color, NOT_FILLED );
787  GRSetColorPen( DC, Color );
788  DC->DrawArc( xc + x1, yc - y1, xc + x2, yc - y2, xc, yc );
789 }
int GetX() const
Definition: eda_rect.h:111
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
int GetBottom() const
Definition: eda_rect.h:124
static const bool NOT_FILLED
Definition: gr_basic.cpp:44
int GetRight() const
Definition: eda_rect.h:121
void GRSetBrush(wxDC *DC, COLOR4D Color, bool fill)
Definition: gr_basic.cpp:172
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135
int GetY() const
Definition: eda_rect.h:112

References EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), GRSetBrush(), GRSetColorPen(), NOT_FILLED, and RotatePoint().

◆ GRArc() [2/2]

void GRArc ( EDA_RECT ClipBox,
wxDC *  DC,
int  x,
int  y,
double  StAngle,
double  EndAngle,
int  r,
int  width,
COLOR4D  Color 
)

Definition at line 795 of file gr_basic.cpp.

804 {
805  int x1, y1, x2, y2;
806 
807  /* Clip arcs off screen. */
808  if( ClipBox )
809  {
810  int x0, y0, xm, ym;
811  x0 = ClipBox->GetX();
812  y0 = ClipBox->GetY();
813  xm = ClipBox->GetRight();
814  ym = ClipBox->GetBottom();
815 
816  if( x < ( x0 - r - width ) )
817  return;
818 
819  if( y < ( y0 - r - width ) )
820  return;
821 
822  if( x > ( r + xm + width ) )
823  return;
824 
825  if( y > ( r + ym + width ) )
826  return;
827  }
828 
829  x1 = r;
830  y1 = 0;
831  RotatePoint( &x1, &y1, EndAngle );
832 
833  x2 = r;
834  y2 = 0;
835  RotatePoint( &x2, &y2, StAngle );
836 
837  GRSetBrush( DC, Color );
838  GRSetColorPen( DC, Color, width );
839  DC->DrawArc( x + x1, y - y1, x + x2, y - y2, x, y );
840 }
int GetX() const
Definition: eda_rect.h:111
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
int GetBottom() const
Definition: eda_rect.h:124
int GetRight() const
Definition: eda_rect.h:121
void GRSetBrush(wxDC *DC, COLOR4D Color, bool fill)
Definition: gr_basic.cpp:172
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135
int GetY() const
Definition: eda_rect.h:112

References EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), GRSetBrush(), GRSetColorPen(), and RotatePoint().

◆ GRArc1() [1/3]

void GRArc1 ( EDA_RECT ClipBox,
wxDC *  DC,
int  x1,
int  y1,
int  x2,
int  y2,
int  xc,
int  yc,
COLOR4D  Color 
)

Definition at line 642 of file gr_basic.cpp.

644 {
645  GRArc1( ClipBox, DC, x1, y1, x2, y2, xc, yc, 0, Color );
646 }
void GRArc1(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int xc, int yc, COLOR4D Color)
Definition: gr_basic.cpp:642

References GRArc1().

Referenced by GRArc1(), LIB_ARC::print(), and GERBER_DRAW_ITEM::Print().

◆ GRArc1() [2/3]

void GRArc1 ( EDA_RECT ClipBox,
wxDC *  DC,
int  x1,
int  y1,
int  x2,
int  y2,
int  xc,
int  yc,
int  width,
COLOR4D  Color 
)

Definition at line 652 of file gr_basic.cpp.

654 {
655  /* Clip arcs off screen. */
656  if( ClipBox )
657  {
658  int x0, y0, xm, ym, r;
659  x0 = ClipBox->GetX();
660  y0 = ClipBox->GetY();
661  xm = ClipBox->GetRight();
662  ym = ClipBox->GetBottom();
663  r = KiROUND( Distance( x1, y1, xc, yc ) );
664  if( xc < ( x0 - r ) )
665  return;
666  if( yc < ( y0 - r ) )
667  return;
668  if( xc > ( r + xm ) )
669  return;
670  if( yc > ( r + ym ) )
671  return;
672  }
673 
674  GRSetBrush( DC, Color );
675  GRSetColorPen( DC, Color, width );
676  DC->DrawArc( x1, y1, x2, y2, xc, yc );
677 }
int GetX() const
Definition: eda_rect.h:111
int GetBottom() const
Definition: eda_rect.h:124
int GetRight() const
Definition: eda_rect.h:121
void GRSetBrush(wxDC *DC, COLOR4D Color, bool fill)
Definition: gr_basic.cpp:172
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
int GetY() const
Definition: eda_rect.h:112

References EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), GRSetBrush(), GRSetColorPen(), and KiROUND().

◆ GRArc1() [3/3]

void GRArc1 ( EDA_RECT aClipBox,
wxDC *  aDC,
wxPoint  aStart,
wxPoint  aEnd,
wxPoint  aCenter,
int  aWidth,
COLOR4D  aColor 
)

Definition at line 680 of file gr_basic.cpp.

682 {
683  GRArc1( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aCenter.x, aCenter.y,
684  aWidth, aColor );
685 }
void GRArc1(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int xc, int yc, COLOR4D Color)
Definition: gr_basic.cpp:642

References GRArc1(), wxPoint::x, and wxPoint::y.

◆ GRBezier()

void GRBezier ( EDA_RECT aClipBox,
wxDC *  aDC,
std::vector< wxPoint > &  aPoint,
int  aWidth,
COLOR4D  aColor 
)

Draw cubic (4 points: start control1, control2, end) bezier curve.

Definition at line 994 of file gr_basic.cpp.

997 {
998  std::vector<wxPoint> output;
999 
1000  BEZIER_POLY converter( aPoint );
1001  converter.GetPoly( output, aWidth );
1002 
1003  GRPoly( aClipBox, aDC, output.size(), &output[0], false, aWidth, aColor, aColor );
1004 }
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:544
Bezier curves to polygon converter.
Definition: bezier_curves.h:35

References BEZIER_POLY::GetPoly(), and GRPoly().

◆ GRCircle() [1/3]

void GRCircle ( EDA_RECT ClipBox,
wxDC *  DC,
int  xc,
int  yc,
int  r,
int  width,
COLOR4D  Color 
)

Definition at line 598 of file gr_basic.cpp.

599 {
600  if( clipCircle( ClipBox, xc, yc, r, width ) || r <= 0 )
601  return;
602 
603  GRSetBrush( DC, Color, NOT_FILLED );
604  GRSetColorPen( DC, Color, width );
605  DC->DrawEllipse( xc - r, yc - r, r + r, r + r );
606 }
static bool clipCircle(EDA_RECT *aClipBox, int xc, int yc, int r, int aWidth)
Definition: gr_basic.cpp:568
static const bool NOT_FILLED
Definition: gr_basic.cpp:44
void GRSetBrush(wxDC *DC, COLOR4D Color, bool fill)
Definition: gr_basic.cpp:172
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135

References clipCircle(), GRSetBrush(), GRSetColorPen(), and NOT_FILLED.

Referenced by D_CODE::DrawFlashedShape(), GRCircle(), LIB_CIRCLE::print(), GERBER_DRAW_ITEM::Print(), and LIB_PIN::printPinSymbol().

◆ GRCircle() [2/3]

void GRCircle ( EDA_RECT ClipBox,
wxDC *  aDC,
int  x,
int  y,
int  aRadius,
COLOR4D  aColor 
)

Function GRCircle draws a circle onto the drawing context aDC centered at the user coordinates (x,y)

Parameters
ClipBoxdefines a rectangular boundary outside of which no drawing will occur.
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 609 of file gr_basic.cpp.

610 {
611  GRCircle( ClipBox, DC, x, y, r, 0, Color );
612 }
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:598

References GRCircle().

◆ GRCircle() [3/3]

void GRCircle ( EDA_RECT aClipBox,
wxDC *  aDC,
wxPoint  aPos,
int  aRadius,
int  aWidth,
COLOR4D  aColor 
)

Definition at line 615 of file gr_basic.cpp.

616 {
617  GRCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, aWidth, aColor );
618 }
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:598

References GRCircle(), wxPoint::x, and wxPoint::y.

◆ GRClosedPoly() [1/2]

void GRClosedPoly ( EDA_RECT ClipBox,
wxDC *  aDC,
int  aPointCount,
const wxPoint aPoints,
bool  doFill,
COLOR4D  aPenColor,
COLOR4D  aFillColor 
)

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

Parameters
ClipBoxdefines a rectangular boundary outside of which no drawing will occur.
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.
aPenColorthe color of the border.
aFillColorthe fill color of the polygon's interior.

Definition at line 554 of file gr_basic.cpp.

556 {
557  GRClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor );
558 }
void GRClosedPoly(EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, COLOR4D Color, COLOR4D BgColor)
Function GRClosedPoly draws a closed polygon onto the drawing context aDC and optionally fills and/or...
Definition: gr_basic.cpp:554

References GRClosedPoly().

Referenced by APERTURE_MACRO::DrawApertureMacroShape(), D_CODE::DrawFlashedPolygon(), GRClosedPoly(), GERBER_DRAW_ITEM::PrintGerberPoly(), and MARKER_BASE::PrintMarker().

◆ GRClosedPoly() [2/2]

void GRClosedPoly ( EDA_RECT ClipBox,
wxDC *  aDC,
int  aPointCount,
const wxPoint aPoints,
bool  doFill,
int  aPenWidth,
COLOR4D  aPenColor,
COLOR4D  aFillColor 
)

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

Parameters
ClipBoxdefines a rectangular boundary outside of which no drawing will occur.
aDCthe device context into which drawing should occur.
aPointCountthe number of points in the array aPointArray.
aPointsthe points to draw.
doFilltrue if polygon is to be filled, else false and only the boundary is drawn.
aPenWidthis the width of the pen to use on the perimeter, can be zero.
aPenColorthe color of the border.
aFillColorthe fill color of the polygon's interior.

Definition at line 561 of file gr_basic.cpp.

563 {
564  GRSClosedPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor );
565 }
static void GRSClosedPoly(EDA_RECT *aClipBox, wxDC *aDC, int aPointCount, const wxPoint *aPoints, bool aFill, int aWidth, COLOR4D aColor, COLOR4D aBgColor)
Definition: gr_basic.cpp:507

References GRSClosedPoly().

◆ GRCSegm() [1/3]

void GRCSegm ( EDA_RECT ClipBox,
wxDC *  DC,
int  x1,
int  y1,
int  x2,
int  y2,
int  width,
int  aPenSize,
COLOR4D  Color 
)

Definition at line 314 of file gr_basic.cpp.

316 {
317  GRLastMoveToX = x2;
318  GRLastMoveToY = y2;
319 
320  if( ClipBox )
321  {
322  EDA_RECT clipbox(*ClipBox);
323  clipbox.Inflate(width/2);
324 
325  if( ClipLine( &clipbox, x1, y1, x2, y2 ) )
326  return;
327  }
328 
329 
330  if( width <= 2 ) /* single line or 2 pixels */
331  {
332  GRSetColorPen( DC, Color, width );
333  DC->DrawLine( x1, y1, x2, y2 );
334  return;
335  }
336 
337  GRSetBrush( DC, Color, NOT_FILLED );
338  GRSetColorPen( DC, Color, aPenSize );
339 
340  int radius = (width + 1) >> 1;
341  int dx = x2 - x1;
342  int dy = y2 - y1;
343  double angle = -ArcTangente( dy, dx );
344  wxPoint start;
345  wxPoint end;
346  wxPoint org( x1, y1);
347  int len = (int) hypot( dx, dy );
348 
349  // We know if the DC is mirrored, to draw arcs
350  int slx = DC->DeviceToLogicalX( 1 ) - DC->DeviceToLogicalX( 0 );
351  int sly = DC->DeviceToLogicalY( 1 ) - DC->DeviceToLogicalY( 0 );
352  bool mirrored = (slx > 0 && sly < 0) || (slx < 0 && sly > 0);
353 
354  // first edge
355  start.x = 0;
356  start.y = radius;
357  end.x = len;
358  end.y = radius;
359  RotatePoint( &start, angle);
360  RotatePoint( &end, angle);
361 
362  start += org;
363  end += org;
364 
365  DC->DrawLine( start, end );
366 
367  // first rounded end
368  end.x = 0;
369  end.y = -radius;
370  RotatePoint( &end, angle);
371  end += org;
372 
373  if( !mirrored )
374  DC->DrawArc( end, start, org );
375  else
376  DC->DrawArc( start, end, org );
377 
378 
379  // second edge
380  start.x = len;
381  start.y = -radius;
382  RotatePoint( &start, angle);
383  start += org;
384 
385  DC->DrawLine( start, end );
386 
387  // second rounded end
388  end.x = len;
389  end.y = radius;
390  RotatePoint( &end, angle);
391  end += org;
392 
393  if( !mirrored )
394  DC->DrawArc( end.x, end.y, start.x, start.y, x2, y2 );
395  else
396  DC->DrawArc( start.x, start.y, end.x, end.y, x2, y2 );
397 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
static int GRLastMoveToX
Definition: gr_basic.cpp:89
bool ClipLine(const EDA_RECT *aClipBox, int &x1, int &y1, int &x2, int &y2)
Test if any part of a line falls within the bounds of a rectangle.
static const bool NOT_FILLED
Definition: gr_basic.cpp:44
static int GRLastMoveToY
Definition: gr_basic.cpp:89
void GRSetBrush(wxDC *DC, COLOR4D Color, bool fill)
Definition: gr_basic.cpp:172
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:162

References PNS::angle(), ArcTangente(), ClipLine(), GRLastMoveToX, GRLastMoveToY, GRSetBrush(), GRSetColorPen(), EDA_RECT::Inflate(), NOT_FILLED, RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by D_CODE::DrawFlashedShape(), BASIC_GAL::DrawLine(), BASIC_GAL::DrawPolyline(), GRCSegm(), and GERBER_DRAW_ITEM::Print().

◆ GRCSegm() [2/3]

void GRCSegm ( EDA_RECT ClipBox,
wxDC *  DC,
int  x1,
int  y1,
int  x2,
int  y2,
int  width,
COLOR4D  Color 
)

Definition at line 400 of file gr_basic.cpp.

402 {
403  GRCSegm( ClipBox, DC, x1, y1, x2, y2, width, 0, Color );
404 }
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:314

References GRCSegm().

◆ GRCSegm() [3/3]

void GRCSegm ( EDA_RECT aClipBox,
wxDC *  aDC,
wxPoint  aStart,
wxPoint  aEnd,
int  aWidth,
COLOR4D  aColor 
)

Definition at line 407 of file gr_basic.cpp.

409 {
410  GRCSegm( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, 0, aColor );
411 }
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:314

References GRCSegm(), wxPoint::x, and wxPoint::y.

◆ GRDrawAnchor()

void GRDrawAnchor ( EDA_RECT aClipBox,
wxDC *  aDC,
int  x,
int  y,
int  aSize,
COLOR4D  aColor 
)

Definition at line 1007 of file gr_basic.cpp.

1009 {
1010  int anchor_size = aDC->DeviceToLogicalXRel( aSize );
1011 
1012  GRLine( aClipBox, aDC,
1013  x - anchor_size, y,
1014  x + anchor_size, y, 0, aColor );
1015  GRLine( aClipBox, aDC,
1016  x, y - anchor_size,
1017  x, y + anchor_size, 0, aColor );
1018 }
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:232

References GRLine().

◆ GRDrawWrappedText()

void GRDrawWrappedText ( wxDC &  aDC,
wxString const &  aText 
)

Draw text centered on a wxDC with wrapping.

Parameters
aDCwxDC instance onto which the text will be drawn
aTextthe text to draw

Definition at line 1021 of file gr_basic.cpp.

1022 {
1023  wxStringTokenizer tokenizer( aText, " " );
1024  wxSize const dc_size = aDC.GetSize();
1025  wxSize const margin = aDC.GetTextExtent( " " );
1026  std::vector<wxString> lines;
1027  wxString line_accumulator;
1028  int total_height = 0;
1029 
1030  while( tokenizer.HasMoreTokens() )
1031  {
1032  wxString word = tokenizer.GetNextToken();
1033  wxSize linesize = aDC.GetTextExtent( line_accumulator + " " + word );
1034 
1035  if( linesize.x >= dc_size.x - margin.x && !line_accumulator.IsEmpty() )
1036  {
1037  lines.push_back( line_accumulator );
1038  line_accumulator = word;
1039  }
1040  else
1041  {
1042  line_accumulator += " ";
1043  line_accumulator += word;
1044  }
1045  }
1046 
1047  if( !line_accumulator.IsEmpty() )
1048  {
1049  lines.push_back( line_accumulator );
1050  }
1051 
1052  for( auto const& line: lines )
1053  {
1054  wxSize linesize = aDC.GetTextExtent( line );
1055  total_height += linesize.y;
1056  }
1057 
1058  int top = ( dc_size.y - total_height ) / 2;
1059  int pos = top;
1060 
1061  for( auto const& line: lines )
1062  {
1063  wxSize linesize = aDC.GetTextExtent( line );
1064  aDC.DrawText( line, ( dc_size.x - linesize.x ) / 2, pos );
1065  pos += linesize.y;
1066  }
1067 }

◆ GRFillCSegm()

void GRFillCSegm ( EDA_RECT ClipBox,
wxDC *  DC,
int  x1,
int  y1,
int  x2,
int  y2,
int  width,
COLOR4D  Color 
)

Definition at line 417 of file gr_basic.cpp.

419 {
420  GRSetColorPen( DC, Color, width );
421  WinClipAndDrawLine( ClipBox, DC, x1, y1, x2, y2, width );
422 }
static void WinClipAndDrawLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width)
Definition: gr_basic.cpp:102
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135

References GRSetColorPen(), and WinClipAndDrawLine().

Referenced by D_CODE::DrawFlashedShape().

◆ GRFilledArc() [1/2]

void GRFilledArc ( EDA_RECT ClipBox,
wxDC *  DC,
int  x,
int  y,
double  StAngle,
double  EndAngle,
int  r,
int  width,
COLOR4D  Color,
COLOR4D  BgColor 
)

Definition at line 691 of file gr_basic.cpp.

701 {
702  int x1, y1, x2, y2;
703 
704  /* Clip arcs off screen */
705  if( ClipBox )
706  {
707  int x0, y0, xm, ym;
708  x0 = ClipBox->GetX();
709  y0 = ClipBox->GetY();
710  xm = ClipBox->GetRight();
711  ym = ClipBox->GetBottom();
712 
713  if( x < ( x0 - r - 1 ) )
714  return;
715 
716  if( y < ( y0 - r - 1 ) )
717  return;
718 
719  if( x > ( r + xm + 1 ) )
720  return;
721 
722  if( y > ( r + ym + 1 ) )
723  return;
724  }
725 
726  x1 = r;
727  y1 = 0;
728  RotatePoint( &x1, &y1, EndAngle );
729 
730  x2 = r;
731  y2 = 0;
732  RotatePoint( &x2, &y2, StAngle );
733 
734  GRSetBrush( DC, BgColor, FILLED );
735  GRSetColorPen( DC, Color, width );
736  DC->DrawArc( x + x1, y - y1, x + x2, y - y2, x, y );
737 }
static const bool FILLED
Definition: gr_basic.cpp:43
int GetX() const
Definition: eda_rect.h:111
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
int GetBottom() const
Definition: eda_rect.h:124
int GetRight() const
Definition: eda_rect.h:121
void GRSetBrush(wxDC *DC, COLOR4D Color, bool fill)
Definition: gr_basic.cpp:172
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135
int GetY() const
Definition: eda_rect.h:112

References FILLED, EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), GRSetBrush(), GRSetColorPen(), and RotatePoint().

Referenced by GRFilledArc(), and LIB_ARC::print().

◆ GRFilledArc() [2/2]

void GRFilledArc ( EDA_RECT ClipBox,
wxDC *  DC,
int  x,
int  y,
double  StAngle,
double  EndAngle,
int  r,
COLOR4D  Color,
COLOR4D  BgColor 
)

Definition at line 740 of file gr_basic.cpp.

743 {
744  GRFilledArc( ClipBox, DC, x, y, StAngle, EndAngle, r, 0, Color, BgColor );
745 }
void GRFilledArc(EDA_RECT *ClipBox, wxDC *DC, int x, int y, double StAngle, double EndAngle, int r, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:691

References GRFilledArc().

◆ GRFilledCircle() [1/2]

void GRFilledCircle ( EDA_RECT ClipBox,
wxDC *  DC,
int  x,
int  y,
int  r,
int  width,
COLOR4D  Color,
COLOR4D  BgColor 
)

Definition at line 621 of file gr_basic.cpp.

623 {
624  if( clipCircle( ClipBox, x, y, r, width ) || r <= 0 )
625  return;
626 
627  GRSetBrush( DC, BgColor, FILLED );
628  GRSetColorPen( DC, Color, width );
629  DC->DrawEllipse( x - r, y - r, r + r, r + r );
630 }
static const bool FILLED
Definition: gr_basic.cpp:43
static bool clipCircle(EDA_RECT *aClipBox, int xc, int yc, int r, int aWidth)
Definition: gr_basic.cpp:568
void GRSetBrush(wxDC *DC, COLOR4D Color, bool fill)
Definition: gr_basic.cpp:172
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135

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

Referenced by D_CODE::DrawFlashedShape(), GRFilledCircle(), SCH_JUNCTION::Print(), and LIB_CIRCLE::print().

◆ GRFilledCircle() [2/2]

void GRFilledCircle ( EDA_RECT aClipBox,
wxDC *  aDC,
wxPoint  aPos,
int  aRadius,
COLOR4D  aColor 
)

Definition at line 633 of file gr_basic.cpp.

634 {
635  GRFilledCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, 0, aColor, aColor );
636 }
void GRFilledCircle(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:621

References GRFilledCircle(), wxPoint::x, and wxPoint::y.

◆ GRFilledRect() [1/2]

void GRFilledRect ( EDA_RECT ClipBox,
wxDC *  DC,
int  x1,
int  y1,
int  x2,
int  y2,
COLOR4D  Color,
COLOR4D  BgColor 
)

Definition at line 886 of file gr_basic.cpp.

888 {
889  GRSFilledRect( ClipBox, DC, x1, y1, x2, y2, 0, Color, BgColor );
890 }
void GRSFilledRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, int aWidth, COLOR4D aColor, COLOR4D aBgColor)
Definition: gr_basic.cpp:921

References GRSFilledRect().

Referenced by D_CODE::DrawFlashedShape(), LIB_RECTANGLE::print(), and DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample().

◆ GRFilledRect() [2/2]

void GRFilledRect ( EDA_RECT ClipBox,
wxDC *  DC,
int  x1,
int  y1,
int  x2,
int  y2,
int  width,
COLOR4D  Color,
COLOR4D  BgColor 
)

Definition at line 896 of file gr_basic.cpp.

898 {
899  GRSFilledRect( ClipBox, DC, x1, y1, x2, y2, width, Color, BgColor );
900 }
void GRSFilledRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, int aWidth, COLOR4D aColor, COLOR4D aBgColor)
Definition: gr_basic.cpp:921

References GRSFilledRect().

◆ GRFilledSegment()

void GRFilledSegment ( EDA_RECT aClipBox,
wxDC *  aDC,
wxPoint  aStart,
wxPoint  aEnd,
int  aWidth,
COLOR4D  aColor 
)

Definition at line 425 of file gr_basic.cpp.

427 {
428  GRSetColorPen( aDC, aColor, aWidth );
429  WinClipAndDrawLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth );
430 }
static void WinClipAndDrawLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width)
Definition: gr_basic.cpp:102
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135

References GRSetColorPen(), WinClipAndDrawLine(), wxPoint::x, and wxPoint::y.

Referenced by GERBER_DRAW_ITEM::Print().

◆ GRForceBlackPen()

void GRForceBlackPen ( bool  flagforce)

Function GRForceBlackPen.

Parameters
flagforceTrue to force a black pen whenever the asked color

Definition at line 203 of file gr_basic.cpp.

204 {
205  s_ForceBlackPen = flagforce;
206 }
static bool s_ForceBlackPen
Definition: gr_basic.cpp:90

References s_ForceBlackPen.

Referenced by SCH_EDIT_FRAME::DrawCurrentSheetToClipboard(), PLEDITOR_PRINTOUT::PrintPage(), and SCH_PRINTOUT::PrintPage().

◆ GRLine() [1/2]

void GRLine ( EDA_RECT ClipBox,
wxDC *  DC,
int  x1,
int  y1,
int  x2,
int  y2,
int  width,
COLOR4D  Color,
wxPenStyle  aStyle 
)

Definition at line 232 of file gr_basic.cpp.

241 {
242  GRSetColorPen( DC, Color, width, aStyle );
243  WinClipAndDrawLine( ClipBox, DC, x1, y1, x2, y2, width );
244  GRLastMoveToX = x2;
245  GRLastMoveToY = y2;
246 }
static int GRLastMoveToX
Definition: gr_basic.cpp:89
static int GRLastMoveToY
Definition: gr_basic.cpp:89
static void WinClipAndDrawLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width)
Definition: gr_basic.cpp:102
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135

References GRLastMoveToX, GRLastMoveToY, GRSetColorPen(), and WinClipAndDrawLine().

Referenced by BASIC_GAL::DrawLine(), GRDrawAnchor(), GRLine(), GRLineTo(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::onPaintPolyPanel(), SCH_NO_CONNECT::Print(), SCH_BUS_ENTRY_BASE::Print(), SCH_LINE::Print(), LIB_PIN::printPinSymbol(), and WS_DRAW_ITEM_LINE::PrintWsItem().

◆ GRLine() [2/2]

void GRLine ( EDA_RECT aClipBox,
wxDC *  aDC,
wxPoint  aStart,
wxPoint  aEnd,
int  aWidth,
COLOR4D  aColor,
wxPenStyle  aStyle 
)

Definition at line 249 of file gr_basic.cpp.

250 {
251  GRLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, aColor, aStyle );
252 }
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:232

References GRLine(), wxPoint::x, and wxPoint::y.

◆ GRLineArray()

void GRLineArray ( EDA_RECT aClipBox,
wxDC *  aDC,
std::vector< wxPoint > &  aLines,
int  aWidth,
COLOR4D  aColor 
)

Function GRLineArray draws an array of lines (not a polygon).

Parameters
aClipBox= the clip box
aDC= the device context into which drawing should occur.
aLines= a list of pair of coordinate in user space: a pair for each line.
aWidth= the width of each line.
aColor= color to draw the lines
See also
COLOR4D

Definition at line 286 of file gr_basic.cpp.

288 {
289  if( aLines.empty() )
290  return;
291 
292  GRSetColorPen( aDC, aColor, aWidth );
293 
294  if( aClipBox )
295  aClipBox->Inflate( aWidth / 2 );
296 
297  for( unsigned i = 0; i < aLines.size(); i += 2 )
298  {
299  int x1 = aLines[i].x;
300  int y1 = aLines[i].y;
301  int x2 = aLines[i + 1].x;
302  int y2 = aLines[i + 1].y;
303  if( ( aClipBox == NULL ) || !ClipLine( aClipBox, x1, y1, x2, y2 ) )
304  aDC->DrawLine( x1, y1, x2, y2 );
305  }
306 
307  GRMoveTo( aLines[aLines.size() - 1].x, aLines[aLines.size() - 1].y );
308 
309  if( aClipBox )
310  aClipBox->Inflate(-aWidth/2);
311 }
bool ClipLine(const EDA_RECT *aClipBox, int &x1, int &y1, int &x2, int &y2)
Test if any part of a line falls within the bounds of a rectangle.
#define NULL
void GRMoveTo(int x, int y)
Definition: gr_basic.cpp:258
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

References ClipLine(), GRMoveTo(), GRSetColorPen(), EDA_RECT::Inflate(), and NULL.

◆ GRLineTo()

void GRLineTo ( EDA_RECT ClipBox,
wxDC *  DC,
int  x,
int  y,
int  width,
COLOR4D  Color 
)

Definition at line 268 of file gr_basic.cpp.

269 {
270  GRLine( ClipBox, DC, GRLastMoveToX, GRLastMoveToY, x, y, width, Color );
271 }
static int GRLastMoveToX
Definition: gr_basic.cpp:89
static int GRLastMoveToY
Definition: gr_basic.cpp:89
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:232

References GRLastMoveToX, GRLastMoveToY, and GRLine().

Referenced by GRSClosedPoly(), GRSPoly(), and LIB_PIN::printPinSymbol().

◆ GRMoveTo()

void GRMoveTo ( int  x,
int  y 
)

Definition at line 258 of file gr_basic.cpp.

259 {
260  GRLastMoveToX = x;
261  GRLastMoveToY = y;
262 }
static int GRLastMoveToX
Definition: gr_basic.cpp:89
static int GRLastMoveToY
Definition: gr_basic.cpp:89

References GRLastMoveToX, and GRLastMoveToY.

Referenced by GRLineArray(), GRSClosedPoly(), GRSPoly(), and LIB_PIN::printPinSymbol().

◆ GRPoly()

void GRPoly ( EDA_RECT ClipBox,
wxDC *  DC,
int  n,
const wxPoint Points,
bool  Fill,
int  width,
COLOR4D  Color,
COLOR4D  BgColor 
)

Definition at line 544 of file gr_basic.cpp.

546 {
547  GRSPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor );
548 }
static void GRSPoly(EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:475

References GRSPoly().

Referenced by BASIC_GAL::DrawPolyline(), GRBezier(), LIB_POLYLINE::print(), LIB_BEZIER::print(), SCH_GLOBALLABEL::Print(), SCH_HIERLABEL::Print(), and WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem().

◆ GRPutPixel()

void GRPutPixel ( EDA_RECT ClipBox,
wxDC *  DC,
int  x,
int  y,
COLOR4D  Color 
)

Definition at line 219 of file gr_basic.cpp.

220 {
221  if( ClipBox && !ClipBox->Contains( x, y ) )
222  return;
223 
224  GRSetColorPen( DC, Color );
225  DC->DrawPoint( x, y );
226 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135

References EDA_RECT::Contains(), and GRSetColorPen().

◆ GRRect() [1/3]

void GRRect ( EDA_RECT aClipBox,
wxDC *  aDC,
int  x1,
int  y1,
int  x2,
int  y2,
COLOR4D  aColor 
)

Definition at line 846 of file gr_basic.cpp.

847 {
848  GRSRect( aClipBox, aDC, x1, y1, x2, y2, 0, aColor );
849 }
static void GRSRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, int aWidth, COLOR4D aColor, wxPenStyle aStyle=wxPENSTYLE_SOLID)
Definition: gr_basic.cpp:907

References GRSRect().

Referenced by D_CODE::DrawFlashedShape(), LIB_RECTANGLE::print(), SCH_SHEET::Print(), and WS_DRAW_ITEM_RECT::PrintWsItem().

◆ GRRect() [2/3]

void GRRect ( EDA_RECT ClipBox,
wxDC *  DC,
int  x1,
int  y1,
int  x2,
int  y2,
int  width,
COLOR4D  Color 
)

Definition at line 866 of file gr_basic.cpp.

867 {
868  GRSRect( ClipBox, DC, x1, y1, x2, y2, width, Color );
869 }
static void GRSRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, int aWidth, COLOR4D aColor, wxPenStyle aStyle=wxPENSTYLE_SOLID)
Definition: gr_basic.cpp:907

References GRSRect().

◆ GRRect() [3/3]

void GRRect ( EDA_RECT aClipBox,
wxDC *  aDC,
const EDA_RECT aRect,
int  aWidth,
COLOR4D  aColor 
)

Definition at line 872 of file gr_basic.cpp.

873 {
874  int x1 = aRect.GetX();
875  int y1 = aRect.GetY();
876  int x2 = aRect.GetRight();
877  int y2 = aRect.GetBottom();
878 
879  GRSRect( aClipBox, aDC, x1, y1, x2, y2, aWidth, aColor );
880 }
int GetX() const
Definition: eda_rect.h:111
int GetBottom() const
Definition: eda_rect.h:124
int GetRight() const
Definition: eda_rect.h:121
int GetY() const
Definition: eda_rect.h:112
static void GRSRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, int aWidth, COLOR4D aColor, wxPenStyle aStyle=wxPENSTYLE_SOLID)
Definition: gr_basic.cpp:907

References EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), and GRSRect().

◆ GRRectPs()

void GRRectPs ( EDA_RECT aClipBox,
wxDC *  aDC,
const EDA_RECT aRect,
COLOR4D  aColor,
wxPenStyle  aStyle 
)

Definition at line 852 of file gr_basic.cpp.

853 {
854  int x1 = aRect.GetX();
855  int y1 = aRect.GetY();
856  int x2 = aRect.GetRight();
857  int y2 = aRect.GetBottom();
858 
859  GRSRect( aClipBox, aDC, x1, y1, x2, y2, 0, aColor, aStyle );
860 }
int GetX() const
Definition: eda_rect.h:111
int GetBottom() const
Definition: eda_rect.h:124
int GetRight() const
Definition: eda_rect.h:121
int GetY() const
Definition: eda_rect.h:112
static void GRSRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, int aWidth, COLOR4D aColor, wxPenStyle aStyle=wxPENSTYLE_SOLID)
Definition: gr_basic.cpp:907

References EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), and GRSRect().

◆ GRResetPenAndBrush()

void GRResetPenAndBrush ( wxDC *  DC)

Definition at line 122 of file gr_basic.cpp.

123 {
124  GRSetBrush( DC, BLACK ); // Force no fill
125  s_DC_lastbrushcolor = COLOR4D::UNSPECIFIED;
126  s_DC_lastcolor = COLOR4D::UNSPECIFIED;
127  s_DC_lastDC = NULL;
128 }
Definition: color4d.h:44
#define NULL
static wxDC * s_DC_lastDC
Definition: gr_basic.cpp:100
static COLOR4D s_DC_lastbrushcolor(0, 0, 0, 0)
static COLOR4D s_DC_lastcolor(0, 0, 0, 0)
void GRSetBrush(wxDC *DC, COLOR4D Color, bool fill)
Definition: gr_basic.cpp:172

References BLACK, GRSetBrush(), NULL, s_DC_lastbrushcolor, s_DC_lastcolor, and s_DC_lastDC.

Referenced by SCH_EDIT_FRAME::DrawCurrentSheetToClipboard(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::onPaintPolyPanel(), DIALOG_PIN_PROPERTIES::OnPaintShowPanel(), PLEDITOR_PRINTOUT::PrintPage(), SCH_PRINTOUT::PrintPage(), and DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample().

◆ GRSClosedPoly()

static void GRSClosedPoly ( EDA_RECT aClipBox,
wxDC *  aDC,
int  aPointCount,
const wxPoint aPoints,
bool  aFill,
int  aWidth,
COLOR4D  aColor,
COLOR4D  aBgColor 
)
static

Definition at line 507 of file gr_basic.cpp.

509 {
510  if( !IsGRSPolyDrawable( aClipBox, aPointCount, aPoints ) )
511  return;
512 
513  if( aFill && ( aPointCount > 2 ) )
514  {
515  GRLastMoveToX = aPoints[aPointCount - 1].x;
516  GRLastMoveToY = aPoints[aPointCount - 1].y;
517  GRSetBrush( aDC, aBgColor, FILLED );
518  GRSetColorPen( aDC, aColor, aWidth );
519  ClipAndDrawPoly( aClipBox, aDC, aPoints, aPointCount );
520  }
521  else
522  {
523 
524  GRMoveTo( aPoints[0].x, aPoints[0].y );
525  for( int i = 1; i < aPointCount; ++i )
526  {
527  GRLineTo( aClipBox, aDC, aPoints[i].x, aPoints[i].y, aWidth, aColor );
528  }
529 
530  int lastpt = aPointCount - 1;
531 
532  // Close the polygon
533  if( aPoints[lastpt] != aPoints[0] )
534  {
535  GRLineTo( aClipBox, aDC, aPoints[0].x, aPoints[0].y, aWidth, aColor );
536  }
537  }
538 }
static const bool FILLED
Definition: gr_basic.cpp:43
static int GRLastMoveToX
Definition: gr_basic.cpp:89
void GRLineTo(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int width, COLOR4D Color)
Definition: gr_basic.cpp:268
static int GRLastMoveToY
Definition: gr_basic.cpp:89
static bool IsGRSPolyDrawable(EDA_RECT *ClipBox, int n, const wxPoint *Points)
Definition: gr_basic.cpp:433
void GRSetBrush(wxDC *DC, COLOR4D Color, bool fill)
Definition: gr_basic.cpp:172
void GRMoveTo(int x, int y)
Definition: gr_basic.cpp:258
static void ClipAndDrawPoly(EDA_RECT *ClipBox, wxDC *DC, const wxPoint *Points, int n)
Function ClipAndDrawPoly Used to clip a polygon and draw it as Filled Polygon uses the Sutherland and...
Definition: gr_basic.cpp:959
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135

References ClipAndDrawPoly(), FILLED, GRLastMoveToX, GRLastMoveToY, GRLineTo(), GRMoveTo(), GRSetBrush(), GRSetColorPen(), IsGRSPolyDrawable(), wxPoint::x, and wxPoint::y.

Referenced by GRClosedPoly(), and GRSRect().

◆ GRSetBrush()

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

Definition at line 172 of file gr_basic.cpp.

173 {
174  if( s_ForceBlackPen )
175  Color = COLOR4D::BLACK;
176 
177  if( s_DC_lastbrushcolor != Color
178  || s_DC_lastbrushfill != fill
179  || s_DC_lastDC != DC )
180  {
181  wxBrush brush;
182 
183  brush.SetColour( Color.ToColour() );
184 
185  if( fill )
186  brush.SetStyle( wxBRUSHSTYLE_SOLID );
187  else
188  brush.SetStyle( wxBRUSHSTYLE_TRANSPARENT );
189 
190  DC->SetBrush( brush );
191 
192  s_DC_lastbrushcolor = Color;
193  s_DC_lastbrushfill = fill;
194  s_DC_lastDC = DC;
195  }
196 }
Definition: color4d.h:44
static wxDC * s_DC_lastDC
Definition: gr_basic.cpp:100
static COLOR4D s_DC_lastbrushcolor(0, 0, 0, 0)
static bool s_DC_lastbrushfill
Definition: gr_basic.cpp:99
static bool s_ForceBlackPen
Definition: gr_basic.cpp:90

References BLACK, s_DC_lastbrushcolor, s_DC_lastbrushfill, s_DC_lastDC, and s_ForceBlackPen.

Referenced by GRArc(), GRArc1(), GRCircle(), GRCSegm(), GRFilledArc(), GRFilledCircle(), GRResetPenAndBrush(), GRSClosedPoly(), GRSFilledRect(), and GRSPoly().

◆ GRSetColorPen()

void GRSetColorPen ( wxDC *  DC,
COLOR4D  Color,
int  width,
wxPenStyle  style 
)

Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.

Definition at line 135 of file gr_basic.cpp.

136 {
137  wxDash dots[2] = { 1, 3 };
138  // Under OSX and while printing when wxPen is set to 0, renderer follows the request drawing
139  // nothing & in the bitmap world the minimum is enough to light a pixel, in vectorial one not
140  if( width <= 1 )
141  width = DC->DeviceToLogicalXRel( 1 );
142 
143  if( s_ForceBlackPen )
144  Color = COLOR4D::BLACK;
145 
146  const wxPen& curr_pen = DC->GetPen();
147 
148  if( !curr_pen.IsOk() || curr_pen.GetColour() != Color.ToColour()
149  || curr_pen.GetWidth() != width
150  || curr_pen.GetStyle() != style )
151  {
152  wxPen pen;
153  pen.SetColour( Color.ToColour() );
154  if( style == wxPENSTYLE_DOT )
155  {
156  style = wxPENSTYLE_USER_DASH;
157  pen.SetDashes( 2, dots );
158  }
159  pen.SetWidth( width );
160  pen.SetStyle( style );
161  DC->SetPen( pen );
162  }
163  else
164  // Should be not needed, but on Linux, in printing process
165  // the curr pen settings needs to be sometimes re-initialized
166  // Clearly, this is due to a bug, related to SetBrush(),
167  // but we have to live with it, at least on wxWidgets 3.0
168  DC->SetPen( curr_pen );
169 }
Definition: color4d.h:44
static bool s_ForceBlackPen
Definition: gr_basic.cpp:90

References BLACK, and s_ForceBlackPen.

Referenced by GRArc(), GRArc1(), GRCircle(), GRCSegm(), GRFillCSegm(), GRFilledArc(), GRFilledCircle(), GRFilledSegment(), GRLine(), GRLineArray(), GRPutPixel(), GRSClosedPoly(), GRSFilledRect(), and GRSPoly().

◆ GRSFilledRect()

void GRSFilledRect ( EDA_RECT aClipBox,
wxDC *  aDC,
int  x1,
int  y1,
int  x2,
int  y2,
int  aWidth,
COLOR4D  aColor,
COLOR4D  aBgColor 
)

Definition at line 921 of file gr_basic.cpp.

923 {
924  wxPoint points[5];
925  points[0] = wxPoint(x1, y1);
926  points[1] = wxPoint(x1, y2);
927  points[2] = wxPoint(x2, y2);
928  points[3] = wxPoint(x2, y1);
929  points[4] = points[0];
930 
931  GRSetBrush( aDC, aBgColor, FILLED );
932  GRSetColorPen( aDC, aBgColor, aWidth );
933 
934  if( aClipBox && (aWidth > 0) )
935  {
936  EDA_RECT clipbox(*aClipBox);
937  clipbox.Inflate(aWidth);
938  ClipAndDrawPoly(&clipbox, aDC, points, 5); // polygon approach is more accurate
939  }
940  else
941  ClipAndDrawPoly(aClipBox, aDC, points, 5 );
942 }
static const bool FILLED
Definition: gr_basic.cpp:43
void GRSetBrush(wxDC *DC, COLOR4D Color, bool fill)
Definition: gr_basic.cpp:172
static void ClipAndDrawPoly(EDA_RECT *ClipBox, wxDC *DC, const wxPoint *Points, int n)
Function ClipAndDrawPoly Used to clip a polygon and draw it as Filled Polygon uses the Sutherland and...
Definition: gr_basic.cpp:959
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

References ClipAndDrawPoly(), FILLED, GRSetBrush(), GRSetColorPen(), and EDA_RECT::Inflate().

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

◆ GRSPoly()

static void GRSPoly ( EDA_RECT ClipBox,
wxDC *  DC,
int  n,
const wxPoint Points,
bool  Fill,
int  width,
COLOR4D  Color,
COLOR4D  BgColor 
)
static

Definition at line 475 of file gr_basic.cpp.

477 {
478  if( !IsGRSPolyDrawable( ClipBox, n, Points ) )
479  return;
480 
481  if( Fill && ( n > 2 ) )
482  {
483  GRSetBrush( DC, BgColor, FILLED );
484  GRSetColorPen( DC, Color, width );
485 
486  /* clip before send the filled polygon to wxDC, because under linux
487  * (GTK?) polygons having large coordinates are incorrectly drawn
488  * (integer overflow in coordinates, I am guessing)
489  */
490  ClipAndDrawPoly( ClipBox, DC, Points, n );
491  }
492  else
493  {
494 
495  GRMoveTo( Points[0].x, Points[0].y );
496  for( int i = 1; i < n; ++i )
497  {
498  GRLineTo( ClipBox, DC, Points[i].x, Points[i].y, width, Color );
499  }
500  }
501 }
static const bool FILLED
Definition: gr_basic.cpp:43
void GRLineTo(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int width, COLOR4D Color)
Definition: gr_basic.cpp:268
static bool IsGRSPolyDrawable(EDA_RECT *ClipBox, int n, const wxPoint *Points)
Definition: gr_basic.cpp:433
void GRSetBrush(wxDC *DC, COLOR4D Color, bool fill)
Definition: gr_basic.cpp:172
void GRMoveTo(int x, int y)
Definition: gr_basic.cpp:258
static void ClipAndDrawPoly(EDA_RECT *ClipBox, wxDC *DC, const wxPoint *Points, int n)
Function ClipAndDrawPoly Used to clip a polygon and draw it as Filled Polygon uses the Sutherland and...
Definition: gr_basic.cpp:959
void GRSetColorPen(wxDC *DC, COLOR4D Color, int width, wxPenStyle style)
Function GRSetColorPen sets a pen style, width, color, and alpha into the given device context.
Definition: gr_basic.cpp:135

References ClipAndDrawPoly(), FILLED, GRLineTo(), GRMoveTo(), GRSetBrush(), GRSetColorPen(), and IsGRSPolyDrawable().

Referenced by GRPoly().

◆ GRSRect()

void GRSRect ( EDA_RECT aClipBox,
wxDC *  aDC,
int  x1,
int  y1,
int  x2,
int  y2,
int  aWidth,
COLOR4D  aColor,
wxPenStyle  aStyle = wxPENSTYLE_SOLID 
)
static

Definition at line 907 of file gr_basic.cpp.

909 {
910  wxPoint points[5];
911  points[0] = wxPoint(x1, y1);
912  points[1] = wxPoint(x1, y2);
913  points[2] = wxPoint(x2, y2);
914  points[3] = wxPoint(x2, y1);
915  points[4] = points[0];
916  GRSClosedPoly( aClipBox, aDC, 5, points, NOT_FILLED, aWidth,
917  aColor, aColor );
918 }
static const bool NOT_FILLED
Definition: gr_basic.cpp:44
static void GRSClosedPoly(EDA_RECT *aClipBox, wxDC *aDC, int aPointCount, const wxPoint *aPoints, bool aFill, int aWidth, COLOR4D aColor, COLOR4D aBgColor)
Definition: gr_basic.cpp:507

References GRSClosedPoly(), and NOT_FILLED.

Referenced by GRRect(), and GRRectPs().

◆ IsGRSPolyDrawable()

static bool IsGRSPolyDrawable ( EDA_RECT ClipBox,
int  n,
const wxPoint Points 
)
static

Definition at line 433 of file gr_basic.cpp.

434 {
435  if( !ClipBox )
436  return true;
437 
438  if( n <= 0 )
439  return false;
440 
441  int Xmin, Xmax, Ymin, Ymax;
442 
443  Xmin = Xmax = Points[0].x;
444  Ymin = Ymax = Points[0].y;
445 
446  for( int ii = 1; ii < n; ii++ ) // calculate rectangle
447  {
448  Xmin = std::min( Xmin, Points[ii].x );
449  Xmax = std::max( Xmax, Points[ii].x );
450  Ymin = std::min( Ymin, Points[ii].y );
451  Ymax = std::max( Ymax, Points[ii].y );
452  }
453 
454  xcliplo = ClipBox->GetX();
455  ycliplo = ClipBox->GetY();
456  xcliphi = ClipBox->GetRight();
457  ycliphi = ClipBox->GetBottom();
458 
459  if( Xmax < xcliplo )
460  return false;
461  if( Xmin > xcliphi )
462  return false;
463  if( Ymax < ycliplo )
464  return false;
465  if( Ymin > ycliphi )
466  return false;
467 
468  return true;
469 }
static int ycliplo
Definition: gr_basic.cpp:93
static int ycliphi
Definition: gr_basic.cpp:95
int GetX() const
Definition: eda_rect.h:111
static int xcliphi
Definition: gr_basic.cpp:94
int GetBottom() const
Definition: eda_rect.h:124
static int xcliplo
Definition: gr_basic.cpp:92
int GetRight() const
Definition: eda_rect.h:121
int GetY() const
Definition: eda_rect.h:112

References EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), wxPoint::x, xcliphi, xcliplo, wxPoint::y, ycliphi, and ycliplo.

Referenced by GRSClosedPoly(), and GRSPoly().

◆ WinClipAndDrawLine()

static void WinClipAndDrawLine ( EDA_RECT ClipBox,
wxDC *  DC,
int  x1,
int  y1,
int  x2,
int  y2,
int  width 
)
static

Definition at line 102 of file gr_basic.cpp.

103 {
104  GRLastMoveToX = x2;
105  GRLastMoveToY = y2;
106 
107  if( ClipBox )
108  {
109  EDA_RECT clipbox(*ClipBox);
110  clipbox.Inflate(width/2);
111  if( ClipLine( &clipbox, x1, y1, x2, y2 ) )
112  return;
113  }
114 
115  DC->DrawLine( x1, y1, x2, y2 );
116 }
static int GRLastMoveToX
Definition: gr_basic.cpp:89
bool ClipLine(const EDA_RECT *aClipBox, int &x1, int &y1, int &x2, int &y2)
Test if any part of a line falls within the bounds of a rectangle.
static int GRLastMoveToY
Definition: gr_basic.cpp:89
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

References ClipLine(), GRLastMoveToX, GRLastMoveToY, and EDA_RECT::Inflate().

Referenced by GRFillCSegm(), GRFilledSegment(), and GRLine().

Variable Documentation

◆ FILLED

const bool FILLED = true
static

Definition at line 43 of file gr_basic.cpp.

Referenced by GRFilledArc(), GRFilledCircle(), GRSClosedPoly(), GRSFilledRect(), and GRSPoly().

◆ g_XorMode

GR_DRAWMODE g_XorMode = GR_NXOR

Definition at line 74 of file gr_basic.cpp.

◆ GRLastMoveToX

int GRLastMoveToX
static

Definition at line 89 of file gr_basic.cpp.

Referenced by GRCSegm(), GRLine(), GRLineTo(), GRMoveTo(), GRSClosedPoly(), and WinClipAndDrawLine().

◆ GRLastMoveToY

int GRLastMoveToY
static

Definition at line 89 of file gr_basic.cpp.

Referenced by GRCSegm(), GRLine(), GRLineTo(), GRMoveTo(), GRSClosedPoly(), and WinClipAndDrawLine().

◆ NOT_FILLED

const bool NOT_FILLED = false
static

Definition at line 44 of file gr_basic.cpp.

Referenced by GRArc(), GRCircle(), GRCSegm(), and GRSRect().

◆ s_DC_lastbrushcolor

COLOR4D s_DC_lastbrushcolor(0, 0, 0, 0)
static

Referenced by GRResetPenAndBrush(), and GRSetBrush().

◆ s_DC_lastbrushfill

bool s_DC_lastbrushfill = false
static

Definition at line 99 of file gr_basic.cpp.

Referenced by GRSetBrush().

◆ s_DC_lastcolor

COLOR4D s_DC_lastcolor(0, 0, 0, 0)
static

Referenced by GRResetPenAndBrush().

◆ s_DC_lastDC

wxDC* s_DC_lastDC = NULL
static

Definition at line 100 of file gr_basic.cpp.

Referenced by GRResetPenAndBrush(), and GRSetBrush().

◆ s_ForceBlackPen

bool s_ForceBlackPen
static

Definition at line 90 of file gr_basic.cpp.

Referenced by GetGRForceBlackPenState(), GRForceBlackPen(), GRSetBrush(), and GRSetColorPen().

◆ xcliphi

int xcliphi = 2000
static

Definition at line 94 of file gr_basic.cpp.

Referenced by IsGRSPolyDrawable().

◆ xcliplo

int xcliplo = 0
static

Definition at line 92 of file gr_basic.cpp.

Referenced by IsGRSPolyDrawable().

◆ ycliphi

int ycliphi = 2000
static

Definition at line 95 of file gr_basic.cpp.

Referenced by IsGRSPolyDrawable().

◆ ycliplo

int ycliplo = 0
static

Definition at line 93 of file gr_basic.cpp.

Referenced by IsGRSPolyDrawable().