Pass COLOR4D object by reference instead of on the stack.
This commit is contained in:
parent
cb917e4c42
commit
89b1fdabe9
|
@ -546,7 +546,7 @@ SFVEC4F BOARD_ADAPTER::GetItemColor( int aItemId ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SFVEC4F BOARD_ADAPTER::GetColor( COLOR4D aColor ) const
|
SFVEC4F BOARD_ADAPTER::GetColor( const COLOR4D& aColor ) const
|
||||||
{
|
{
|
||||||
return SFVEC4F( aColor.r, aColor.g, aColor.b, aColor.a );
|
return SFVEC4F( aColor.r, aColor.g, aColor.b, aColor.a );
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,10 +339,10 @@ public:
|
||||||
SFVEC4F GetItemColor( int aItemId ) const;
|
SFVEC4F GetItemColor( int aItemId ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param aColor the color mapped.
|
* @param[in] aColor is the color mapped.
|
||||||
* @return the color in SFVEC3F format
|
* @return the color in SFVEC3F format
|
||||||
*/
|
*/
|
||||||
SFVEC4F GetColor( COLOR4D aColor ) const;
|
SFVEC4F GetColor( const COLOR4D& aColor ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the top z position.
|
* Get the top z position.
|
||||||
|
|
|
@ -331,7 +331,7 @@ void BITMAP_BASE::Rotate( bool aRotateCCW )
|
||||||
|
|
||||||
void BITMAP_BASE::PlotImage( PLOTTER* aPlotter,
|
void BITMAP_BASE::PlotImage( PLOTTER* aPlotter,
|
||||||
const wxPoint& aPos,
|
const wxPoint& aPos,
|
||||||
COLOR4D aDefaultColor,
|
const COLOR4D& aDefaultColor,
|
||||||
int aDefaultPensize ) const
|
int aDefaultPensize ) const
|
||||||
{
|
{
|
||||||
if( m_image == nullptr )
|
if( m_image == nullptr )
|
||||||
|
|
|
@ -405,7 +405,7 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
|
||||||
|
|
||||||
|
|
||||||
void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||||
COLOR4D aColor, OUTLINE_MODE aFillMode )
|
const COLOR4D& aColor, OUTLINE_MODE aFillMode )
|
||||||
{
|
{
|
||||||
if( IsMultilineAllowed() )
|
if( IsMultilineAllowed() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright 2012 Torsten Hueter, torstenhtr <at> gmx.de
|
* Copyright 2012 Torsten Hueter, torstenhtr <at> gmx.de
|
||||||
* Copyright 2017-2019 Kicad Developers, see AUTHORS.txt for contributors.
|
* Copyright 2017-2021 Kicad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -108,89 +108,86 @@ COLOR4D::COLOR4D( EDA_COLOR_T aColor )
|
||||||
|
|
||||||
|
|
||||||
#ifdef WX_COMPATIBILITY
|
#ifdef WX_COMPATIBILITY
|
||||||
COLOR4D::COLOR4D( const wxColour& aColor )
|
COLOR4D::COLOR4D( const wxColour& aColor )
|
||||||
|
{
|
||||||
|
r = aColor.Red() / 255.0;
|
||||||
|
g = aColor.Green() / 255.0;
|
||||||
|
b = aColor.Blue() / 255.0;
|
||||||
|
a = aColor.Alpha() / 255.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool COLOR4D::SetFromWxString( const wxString& aColorString )
|
||||||
|
{
|
||||||
|
wxColour c;
|
||||||
|
|
||||||
|
if( c.Set( aColorString ) )
|
||||||
{
|
{
|
||||||
r = aColor.Red() / 255.0;
|
|
||||||
g = aColor.Green() / 255.0;
|
|
||||||
b = aColor.Blue() / 255.0;
|
|
||||||
a = aColor.Alpha() / 255.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool COLOR4D::SetFromWxString( const wxString& aColorString )
|
|
||||||
{
|
|
||||||
wxColour c;
|
|
||||||
|
|
||||||
if( c.Set( aColorString ) )
|
|
||||||
{
|
|
||||||
r = c.Red() / 255.0;
|
|
||||||
g = c.Green() / 255.0;
|
|
||||||
b = c.Blue() / 255.0;
|
|
||||||
a = c.Alpha() / 255.0;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxString COLOR4D::ToWxString( long flags ) const
|
|
||||||
{
|
|
||||||
wxColour c = ToColour();
|
|
||||||
return c.GetAsString( flags );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxColour COLOR4D::ToColour() const
|
|
||||||
{
|
|
||||||
using CHAN_T = wxColourBase::ChannelType;
|
|
||||||
|
|
||||||
const wxColour colour(
|
|
||||||
static_cast<CHAN_T>( r * 255 + 0.5 ),
|
|
||||||
static_cast<CHAN_T>( g * 255 + 0.5 ),
|
|
||||||
static_cast<CHAN_T>( b * 255 + 0.5 ),
|
|
||||||
static_cast<CHAN_T>( a * 255 + 0.5 )
|
|
||||||
);
|
|
||||||
return colour;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
COLOR4D COLOR4D::LegacyMix( COLOR4D aColor ) const
|
|
||||||
{
|
|
||||||
COLOR4D candidate;
|
|
||||||
|
|
||||||
// Blend the two colors (i.e. OR the RGB values)
|
|
||||||
candidate.r = ( (unsigned)( 255.0 * r ) | (unsigned)( 255.0 * aColor.r ) ) / 255.0,
|
|
||||||
candidate.g = ( (unsigned)( 255.0 * g ) | (unsigned)( 255.0 * aColor.g ) ) / 255.0,
|
|
||||||
candidate.b = ( (unsigned)( 255.0 * b ) | (unsigned)( 255.0 * aColor.b ) ) / 255.0,
|
|
||||||
|
|
||||||
// the alpha channel can be reinitialized
|
|
||||||
// but what is the best value?
|
|
||||||
candidate.a = ( aColor.a + a ) / 2;
|
|
||||||
|
|
||||||
return candidate;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int COLOR4D::ToU32() const
|
|
||||||
{
|
|
||||||
return ToColour().GetRGB();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void COLOR4D::FromU32( unsigned int aPackedColor )
|
|
||||||
{
|
|
||||||
wxColour c;
|
|
||||||
c.SetRGB( aPackedColor );
|
|
||||||
r = c.Red() / 255.0;
|
r = c.Red() / 255.0;
|
||||||
g = c.Green() / 255.0;
|
g = c.Green() / 255.0;
|
||||||
b = c.Blue() / 255.0;
|
b = c.Blue() / 255.0;
|
||||||
a = c.Alpha() / 255.0;
|
a = c.Alpha() / 255.0;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString COLOR4D::ToWxString( long flags ) const
|
||||||
|
{
|
||||||
|
wxColour c = ToColour();
|
||||||
|
return c.GetAsString( flags );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxColour COLOR4D::ToColour() const
|
||||||
|
{
|
||||||
|
using CHAN_T = wxColourBase::ChannelType;
|
||||||
|
|
||||||
|
const wxColour colour(
|
||||||
|
static_cast<CHAN_T>( r * 255 + 0.5 ), static_cast<CHAN_T>( g * 255 + 0.5 ),
|
||||||
|
static_cast<CHAN_T>( b * 255 + 0.5 ), static_cast<CHAN_T>( a * 255 + 0.5 ) );
|
||||||
|
return colour;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
COLOR4D COLOR4D::LegacyMix( const COLOR4D& aColor ) const
|
||||||
|
{
|
||||||
|
COLOR4D candidate;
|
||||||
|
|
||||||
|
// Blend the two colors (i.e. OR the RGB values)
|
||||||
|
candidate.r = ( (unsigned) ( 255.0 * r ) | (unsigned) ( 255.0 * aColor.r ) ) / 255.0,
|
||||||
|
candidate.g = ( (unsigned) ( 255.0 * g ) | (unsigned) ( 255.0 * aColor.g ) ) / 255.0,
|
||||||
|
candidate.b = ( (unsigned) ( 255.0 * b ) | (unsigned) ( 255.0 * aColor.b ) ) / 255.0,
|
||||||
|
|
||||||
|
// the alpha channel can be reinitialized but what is the best value?
|
||||||
|
candidate.a = ( aColor.a + a ) / 2;
|
||||||
|
|
||||||
|
return candidate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int COLOR4D::ToU32() const
|
||||||
|
{
|
||||||
|
return ToColour().GetRGB();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void COLOR4D::FromU32( unsigned int aPackedColor )
|
||||||
|
{
|
||||||
|
wxColour c;
|
||||||
|
c.SetRGB( aPackedColor );
|
||||||
|
r = c.Red() / 255.0;
|
||||||
|
g = c.Green() / 255.0;
|
||||||
|
b = c.Blue() / 255.0;
|
||||||
|
a = c.Alpha() / 255.0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace KIGFX {
|
namespace KIGFX {
|
||||||
|
|
||||||
const bool operator==( const COLOR4D& lhs, const COLOR4D& rhs )
|
const bool operator==( const COLOR4D& lhs, const COLOR4D& rhs )
|
||||||
|
@ -204,6 +201,7 @@ const bool operator!=( const COLOR4D& lhs, const COLOR4D& rhs )
|
||||||
return !( lhs == rhs );
|
return !( lhs == rhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const bool operator<( const COLOR4D& lhs, const COLOR4D& rhs )
|
const bool operator<( const COLOR4D& lhs, const COLOR4D& rhs )
|
||||||
{
|
{
|
||||||
if( lhs.r < rhs.r )
|
if( lhs.r < rhs.r )
|
||||||
|
@ -218,11 +216,13 @@ const bool operator<( const COLOR4D& lhs, const COLOR4D& rhs )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::ostream &operator<<( std::ostream &aStream, COLOR4D const &aColor )
|
std::ostream &operator<<( std::ostream &aStream, COLOR4D const &aColor )
|
||||||
{
|
{
|
||||||
return aStream << aColor.ToWxString( wxC2S_CSS_SYNTAX );
|
return aStream << aColor.ToWxString( wxC2S_CSS_SYNTAX );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void to_json( nlohmann::json& aJson, const COLOR4D& aColor )
|
void to_json( nlohmann::json& aJson, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
aJson = nlohmann::json( aColor.ToWxString( wxC2S_CSS_SYNTAX ).ToStdString() );
|
aJson = nlohmann::json( aColor.ToWxString( wxC2S_CSS_SYNTAX ).ToStdString() );
|
||||||
|
@ -309,7 +309,8 @@ void COLOR4D::FromHSL( double aInHue, double aInSaturation, double aInLightness
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void COLOR4D::ToHSV( double& aOutHue, double& aOutSaturation, double& aOutValue, bool aAlwaysDefineHue ) const
|
void COLOR4D::ToHSV( double& aOutHue, double& aOutSaturation, double& aOutValue,
|
||||||
|
bool aAlwaysDefineHue ) const
|
||||||
{
|
{
|
||||||
double min, max, delta;
|
double min, max, delta;
|
||||||
|
|
||||||
|
@ -450,6 +451,7 @@ COLOR4D& COLOR4D::Saturate( double aFactor )
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const COLOR4D COLOR4D::UNSPECIFIED( 0, 0, 0, 0 );
|
const COLOR4D COLOR4D::UNSPECIFIED( 0, 0, 0, 0 );
|
||||||
const COLOR4D COLOR4D::WHITE( 1, 1, 1, 1 );
|
const COLOR4D COLOR4D::WHITE( 1, 1, 1, 1 );
|
||||||
const COLOR4D COLOR4D::BLACK( 0, 0, 0, 1 );
|
const COLOR4D COLOR4D::BLACK( 0, 0, 0, 1 );
|
||||||
|
@ -477,9 +479,9 @@ EDA_COLOR_T COLOR4D::FindNearestLegacyColor( int aR, int aG, int aB )
|
||||||
trying = static_cast<EDA_COLOR_T>( int( trying ) + 1 ) )
|
trying = static_cast<EDA_COLOR_T>( int( trying ) + 1 ) )
|
||||||
{
|
{
|
||||||
const StructColors &c = colorRefs()[trying];
|
const StructColors &c = colorRefs()[trying];
|
||||||
int distance = (aR - c.m_Red) * (aR - c.m_Red) +
|
int distance = ( aR - c.m_Red ) * ( aR - c.m_Red ) +
|
||||||
(aG - c.m_Green) * (aG - c.m_Green) +
|
( aG - c.m_Green ) * ( aG - c.m_Green ) +
|
||||||
(aB - c.m_Blue) * (aB - c.m_Blue);
|
( aB - c.m_Blue ) * ( aB - c.m_Blue );
|
||||||
|
|
||||||
if( distance < nearest_distance && c.m_Red >= aR &&
|
if( distance < nearest_distance && c.m_Red >= aR &&
|
||||||
c.m_Green >= aG && c.m_Blue >= aB )
|
c.m_Green >= aG && c.m_Blue >= aB )
|
||||||
|
@ -492,6 +494,7 @@ EDA_COLOR_T COLOR4D::FindNearestLegacyColor( int aR, int aG, int aB )
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
COLOR4D& COLOR4D::FromCSSRGBA( int aRed, int aGreen, int aBlue, double aAlpha )
|
COLOR4D& COLOR4D::FromCSSRGBA( int aRed, int aGreen, int aBlue, double aAlpha )
|
||||||
{
|
{
|
||||||
r = std::max( 0, std::min( 255, aRed ) ) / 255.0;
|
r = std::max( 0, std::min( 255, aRed ) ) / 255.0;
|
||||||
|
|
|
@ -19,11 +19,6 @@
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/********************************/
|
|
||||||
/* Low level graphics routines */
|
|
||||||
/********************************/
|
|
||||||
|
|
||||||
|
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
#include <eda_item.h>
|
#include <eda_item.h>
|
||||||
|
@ -77,7 +72,7 @@ static void ClipAndDrawPoly( EDA_RECT* ClipBox, wxDC* DC, const wxPoint* Points,
|
||||||
* from user units to screen units(pixels coordinates)
|
* from user units to screen units(pixels coordinates)
|
||||||
*/
|
*/
|
||||||
static void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1,
|
static void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1,
|
||||||
int x2, int y2, int aWidth, COLOR4D aColor,
|
int x2, int y2, int aWidth, const COLOR4D& aColor,
|
||||||
wxPenStyle aStyle = wxPENSTYLE_SOLID );
|
wxPenStyle aStyle = wxPENSTYLE_SOLID );
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
@ -113,9 +108,6 @@ static void WinClipAndDrawLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Forcing a reset of the current pen.
|
|
||||||
* Must be called after changing the graphical device before any trace.
|
|
||||||
*/
|
|
||||||
void GRResetPenAndBrush( wxDC* DC )
|
void GRResetPenAndBrush( wxDC* DC )
|
||||||
{
|
{
|
||||||
GRSetBrush( DC, BLACK ); // Force no fill
|
GRSetBrush( DC, BLACK ); // Force no fill
|
||||||
|
@ -125,11 +117,10 @@ void GRResetPenAndBrush( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
void GRSetColorPen( wxDC* DC, const COLOR4D& Color, int width, wxPenStyle style )
|
||||||
* Set a pen style, width, color, and alpha into the given device context.
|
|
||||||
*/
|
|
||||||
void GRSetColorPen( wxDC* DC, COLOR4D Color, int width, wxPenStyle style )
|
|
||||||
{
|
{
|
||||||
|
COLOR4D color = Color;
|
||||||
|
|
||||||
wxDash dots[2] = { 1, 3 };
|
wxDash dots[2] = { 1, 3 };
|
||||||
|
|
||||||
// Under OSX and while printing when wxPen is set to 0, renderer follows the request drawing
|
// Under OSX and while printing when wxPen is set to 0, renderer follows the request drawing
|
||||||
|
@ -138,16 +129,15 @@ void GRSetColorPen( wxDC* DC, COLOR4D Color, int width, wxPenStyle style )
|
||||||
width = DC->DeviceToLogicalXRel( 1 );
|
width = DC->DeviceToLogicalXRel( 1 );
|
||||||
|
|
||||||
if( s_ForceBlackPen )
|
if( s_ForceBlackPen )
|
||||||
Color = COLOR4D::BLACK;
|
color = COLOR4D::BLACK;
|
||||||
|
|
||||||
const wxPen& curr_pen = DC->GetPen();
|
const wxPen& curr_pen = DC->GetPen();
|
||||||
|
|
||||||
if( !curr_pen.IsOk() || curr_pen.GetColour() != Color.ToColour()
|
if( !curr_pen.IsOk() || curr_pen.GetColour() != color.ToColour()
|
||||||
|| curr_pen.GetWidth() != width
|
|| curr_pen.GetWidth() != width || curr_pen.GetStyle() != style )
|
||||||
|| curr_pen.GetStyle() != style )
|
|
||||||
{
|
{
|
||||||
wxPen pen;
|
wxPen pen;
|
||||||
pen.SetColour( Color.ToColour() );
|
pen.SetColour( color.ToColour() );
|
||||||
|
|
||||||
if( style == wxPENSTYLE_DOT )
|
if( style == wxPENSTYLE_DOT )
|
||||||
{
|
{
|
||||||
|
@ -170,18 +160,18 @@ void GRSetColorPen( wxDC* DC, COLOR4D Color, int width, wxPenStyle style )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRSetBrush( wxDC* DC, COLOR4D Color, bool fill )
|
void GRSetBrush( wxDC* DC, const COLOR4D& Color, bool fill )
|
||||||
{
|
{
|
||||||
if( s_ForceBlackPen )
|
COLOR4D color = Color;
|
||||||
Color = COLOR4D::BLACK;
|
|
||||||
|
|
||||||
if( s_DC_lastbrushcolor != Color
|
if( s_ForceBlackPen )
|
||||||
|| s_DC_lastbrushfill != fill
|
color = COLOR4D::BLACK;
|
||||||
|| s_DC_lastDC != DC )
|
|
||||||
|
if( s_DC_lastbrushcolor != color || s_DC_lastbrushfill != fill || s_DC_lastDC != DC )
|
||||||
{
|
{
|
||||||
wxBrush brush;
|
wxBrush brush;
|
||||||
|
|
||||||
brush.SetColour( Color.ToColour() );
|
brush.SetColour( color.ToColour() );
|
||||||
|
|
||||||
if( fill )
|
if( fill )
|
||||||
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
||||||
|
@ -190,32 +180,26 @@ void GRSetBrush( wxDC* DC, COLOR4D Color, bool fill )
|
||||||
|
|
||||||
DC->SetBrush( brush );
|
DC->SetBrush( brush );
|
||||||
|
|
||||||
s_DC_lastbrushcolor = Color;
|
s_DC_lastbrushcolor = color;
|
||||||
s_DC_lastbrushfill = fill;
|
s_DC_lastbrushfill = fill;
|
||||||
s_DC_lastDC = DC;
|
s_DC_lastDC = DC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param flagforce True to force a black pen whenever the asked color.
|
|
||||||
*/
|
|
||||||
void GRForceBlackPen( bool flagforce )
|
void GRForceBlackPen( bool flagforce )
|
||||||
{
|
{
|
||||||
s_ForceBlackPen = flagforce;
|
s_ForceBlackPen = flagforce;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if a black pen was forced.
|
|
||||||
*/
|
|
||||||
bool GetGRForceBlackPenState( void )
|
bool GetGRForceBlackPenState( void )
|
||||||
{
|
{
|
||||||
return s_ForceBlackPen;
|
return s_ForceBlackPen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRPutPixel( EDA_RECT* ClipBox, wxDC* DC, int x, int y, COLOR4D Color )
|
void GRPutPixel( EDA_RECT* ClipBox, wxDC* DC, int x, int y, const COLOR4D& Color )
|
||||||
{
|
{
|
||||||
if( ClipBox && !ClipBox->Contains( x, y ) )
|
if( ClipBox && !ClipBox->Contains( x, y ) )
|
||||||
return;
|
return;
|
||||||
|
@ -225,18 +209,8 @@ 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,
|
||||||
* Draw a line, in object space.
|
const COLOR4D& Color, wxPenStyle aStyle)
|
||||||
*/
|
|
||||||
void GRLine( EDA_RECT* ClipBox,
|
|
||||||
wxDC* DC,
|
|
||||||
int x1,
|
|
||||||
int y1,
|
|
||||||
int x2,
|
|
||||||
int y2,
|
|
||||||
int width,
|
|
||||||
COLOR4D Color,
|
|
||||||
wxPenStyle aStyle)
|
|
||||||
{
|
{
|
||||||
GRSetColorPen( DC, Color, width, aStyle );
|
GRSetColorPen( DC, Color, width, aStyle );
|
||||||
WinClipAndDrawLine( ClipBox, DC, x1, y1, x2, y2, width );
|
WinClipAndDrawLine( ClipBox, DC, x1, y1, x2, y2, width );
|
||||||
|
@ -246,15 +220,12 @@ void GRLine( EDA_RECT* ClipBox,
|
||||||
|
|
||||||
|
|
||||||
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth,
|
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth,
|
||||||
COLOR4D aColor, wxPenStyle aStyle )
|
const COLOR4D& aColor, wxPenStyle aStyle )
|
||||||
{
|
{
|
||||||
GRLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, aColor, aStyle );
|
GRLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, aColor, aStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Move to a new position, in object space.
|
|
||||||
*/
|
|
||||||
void GRMoveTo( int x, int y )
|
void GRMoveTo( int x, int y )
|
||||||
{
|
{
|
||||||
GRLastMoveToX = x;
|
GRLastMoveToX = x;
|
||||||
|
@ -262,27 +233,14 @@ void GRMoveTo( int x, int y )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
void GRLineTo( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int width, const COLOR4D& Color )
|
||||||
* Draw line to a new position, in object space.
|
|
||||||
*/
|
|
||||||
void GRLineTo( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int width, COLOR4D Color )
|
|
||||||
{
|
{
|
||||||
GRLine( ClipBox, DC, GRLastMoveToX, GRLastMoveToY, x, y, width, Color );
|
GRLine( ClipBox, DC, GRLastMoveToX, GRLastMoveToY, x, y, width, Color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draw an array of lines (not a polygon).
|
|
||||||
*
|
|
||||||
* @param aClipBox is the clip box.
|
|
||||||
* @param aDC is the device context into which drawing should occur.
|
|
||||||
* @param aLines is a list of pair of coordinate in user space: a pair for each line.
|
|
||||||
* @param aWidth is the width of each line.
|
|
||||||
* @param aColor is the color to draw the lines.
|
|
||||||
* @see COLOR4D
|
|
||||||
*/
|
|
||||||
void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aLines,
|
void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aLines,
|
||||||
int aWidth, COLOR4D aColor )
|
int aWidth, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
if( aLines.empty() )
|
if( aLines.empty() )
|
||||||
return;
|
return;
|
||||||
|
@ -298,6 +256,7 @@ void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aLines,
|
||||||
int y1 = aLines[i].y;
|
int y1 = aLines[i].y;
|
||||||
int x2 = aLines[i + 1].x;
|
int x2 = aLines[i + 1].x;
|
||||||
int y2 = aLines[i + 1].y;
|
int y2 = aLines[i + 1].y;
|
||||||
|
|
||||||
if( ( aClipBox == nullptr ) || !ClipLine( aClipBox, x1, y1, x2, y2 ) )
|
if( ( aClipBox == nullptr ) || !ClipLine( aClipBox, x1, y1, x2, y2 ) )
|
||||||
aDC->DrawLine( x1, y1, x2, y2 );
|
aDC->DrawLine( x1, y1, x2, y2 );
|
||||||
}
|
}
|
||||||
|
@ -305,21 +264,20 @@ void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aLines,
|
||||||
GRMoveTo( aLines[aLines.size() - 1].x, aLines[aLines.size() - 1].y );
|
GRMoveTo( aLines[aLines.size() - 1].x, aLines[aLines.size() - 1].y );
|
||||||
|
|
||||||
if( aClipBox )
|
if( aClipBox )
|
||||||
aClipBox->Inflate(-aWidth/2);
|
aClipBox->Inflate( -aWidth / 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Draw the outline of a thick segment with rounded ends
|
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width,
|
||||||
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
int aPenSize, const COLOR4D& Color )
|
||||||
int width, int aPenSize, COLOR4D Color )
|
|
||||||
{
|
{
|
||||||
GRLastMoveToX = x2;
|
GRLastMoveToX = x2;
|
||||||
GRLastMoveToY = y2;
|
GRLastMoveToY = y2;
|
||||||
|
|
||||||
if( ClipBox )
|
if( ClipBox )
|
||||||
{
|
{
|
||||||
EDA_RECT clipbox(*ClipBox);
|
EDA_RECT clipbox( *ClipBox );
|
||||||
clipbox.Inflate(width/2);
|
clipbox.Inflate( width / 2 );
|
||||||
|
|
||||||
if( ClipLine( &clipbox, x1, y1, x2, y2 ) )
|
if( ClipLine( &clipbox, x1, y1, x2, y2 ) )
|
||||||
return;
|
return;
|
||||||
|
@ -335,27 +293,27 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
GRSetBrush( DC, Color, NOT_FILLED );
|
GRSetBrush( DC, Color, NOT_FILLED );
|
||||||
GRSetColorPen( DC, Color, aPenSize );
|
GRSetColorPen( DC, Color, aPenSize );
|
||||||
|
|
||||||
int radius = (width + 1) >> 1;
|
int radius = ( width + 1 ) >> 1;
|
||||||
int dx = x2 - x1;
|
int dx = x2 - x1;
|
||||||
int dy = y2 - y1;
|
int dy = y2 - y1;
|
||||||
double angle = -ArcTangente( dy, dx );
|
double angle = -ArcTangente( dy, dx );
|
||||||
wxPoint start;
|
wxPoint start;
|
||||||
wxPoint end;
|
wxPoint end;
|
||||||
wxPoint org( x1, y1);
|
wxPoint org( x1, y1 );
|
||||||
int len = (int) hypot( dx, dy );
|
int len = (int) hypot( dx, dy );
|
||||||
|
|
||||||
// We know if the DC is mirrored, to draw arcs
|
// We know if the DC is mirrored, to draw arcs
|
||||||
int slx = DC->DeviceToLogicalX( 1 ) - DC->DeviceToLogicalX( 0 );
|
int slx = DC->DeviceToLogicalX( 1 ) - DC->DeviceToLogicalX( 0 );
|
||||||
int sly = DC->DeviceToLogicalY( 1 ) - DC->DeviceToLogicalY( 0 );
|
int sly = DC->DeviceToLogicalY( 1 ) - DC->DeviceToLogicalY( 0 );
|
||||||
bool mirrored = (slx > 0 && sly < 0) || (slx < 0 && sly > 0);
|
bool mirrored = ( slx > 0 && sly < 0 ) || ( slx < 0 && sly > 0 );
|
||||||
|
|
||||||
// first edge
|
// first edge
|
||||||
start.x = 0;
|
start.x = 0;
|
||||||
start.y = radius;
|
start.y = radius;
|
||||||
end.x = len;
|
end.x = len;
|
||||||
end.y = radius;
|
end.y = radius;
|
||||||
RotatePoint( &start, angle);
|
RotatePoint( &start, angle );
|
||||||
RotatePoint( &end, angle);
|
RotatePoint( &end, angle );
|
||||||
|
|
||||||
start += org;
|
start += org;
|
||||||
end += org;
|
end += org;
|
||||||
|
@ -365,7 +323,7 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
// first rounded end
|
// first rounded end
|
||||||
end.x = 0;
|
end.x = 0;
|
||||||
end.y = -radius;
|
end.y = -radius;
|
||||||
RotatePoint( &end, angle);
|
RotatePoint( &end, angle );
|
||||||
end += org;
|
end += org;
|
||||||
|
|
||||||
if( !mirrored )
|
if( !mirrored )
|
||||||
|
@ -376,7 +334,7 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
// second edge
|
// second edge
|
||||||
start.x = len;
|
start.x = len;
|
||||||
start.y = -radius;
|
start.y = -radius;
|
||||||
RotatePoint( &start, angle);
|
RotatePoint( &start, angle );
|
||||||
start += org;
|
start += org;
|
||||||
|
|
||||||
DC->DrawLine( start, end );
|
DC->DrawLine( start, end );
|
||||||
|
@ -394,25 +352,22 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width,
|
||||||
int width, COLOR4D Color )
|
const COLOR4D& Color )
|
||||||
{
|
{
|
||||||
GRCSegm( ClipBox, DC, x1, y1, x2, y2, width, 0, Color );
|
GRCSegm( ClipBox, DC, x1, y1, x2, y2, width, 0, Color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
|
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth,
|
||||||
int aWidth, COLOR4D aColor )
|
const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
GRCSegm( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, 0, aColor );
|
GRCSegm( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, 0, aColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Draw segment (full) with rounded ends in object space (real coords.).
|
|
||||||
*/
|
|
||||||
void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
int width, COLOR4D Color )
|
int width, const COLOR4D& Color )
|
||||||
{
|
{
|
||||||
GRSetColorPen( DC, Color, width );
|
GRSetColorPen( DC, Color, width );
|
||||||
WinClipAndDrawLine( ClipBox, DC, x1, y1, x2, y2, width );
|
WinClipAndDrawLine( ClipBox, DC, x1, y1, x2, y2, width );
|
||||||
|
@ -420,13 +375,12 @@ void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
|
|
||||||
|
|
||||||
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
|
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
|
||||||
int aWidth, COLOR4D aColor )
|
int aWidth, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
GRSetColorPen( aDC, aColor, aWidth );
|
GRSetColorPen( aDC, aColor, aWidth );
|
||||||
WinClipAndDrawLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth );
|
WinClipAndDrawLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, const wxPoint* Points )
|
static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, const wxPoint* Points )
|
||||||
{
|
{
|
||||||
if( !ClipBox )
|
if( !ClipBox )
|
||||||
|
@ -466,11 +420,11 @@ static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, const wxPoint* Points )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Draw a new polyline and fill it if Fill, in screen space.
|
* Draw a new polyline and fill it if Fill, in screen space.
|
||||||
*/
|
*/
|
||||||
static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill,
|
static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill,
|
||||||
int width, COLOR4D Color, COLOR4D BgColor )
|
int width, const COLOR4D& Color, const COLOR4D& BgColor )
|
||||||
{
|
{
|
||||||
if( !IsGRSPolyDrawable( ClipBox, n, Points ) )
|
if( !IsGRSPolyDrawable( ClipBox, n, Points ) )
|
||||||
return;
|
return;
|
||||||
|
@ -499,11 +453,11 @@ static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Draw a new closed polyline and fill it if Fill, in screen space.
|
* Draw a new closed polyline and fill it if Fill, in screen space.
|
||||||
*/
|
*/
|
||||||
static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC, int aPointCount, const wxPoint* aPoints,
|
static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC, int aPointCount, const wxPoint* aPoints,
|
||||||
bool aFill, int aWidth, COLOR4D aColor, COLOR4D aBgColor )
|
bool aFill, int aWidth, const COLOR4D& aColor, const COLOR4D& aBgColor )
|
||||||
{
|
{
|
||||||
if( !IsGRSPolyDrawable( aClipBox, aPointCount, aPoints ) )
|
if( !IsGRSPolyDrawable( aClipBox, aPointCount, aPoints ) )
|
||||||
return;
|
return;
|
||||||
|
@ -537,28 +491,28 @@ static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC, int aPointCount, const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Draw a new polyline and fill it if Fill, in drawing space.
|
* Draw a new polyline and fill it if Fill, in drawing space.
|
||||||
*/
|
*/
|
||||||
void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width,
|
void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width,
|
||||||
COLOR4D Color, COLOR4D BgColor )
|
const COLOR4D& Color, const COLOR4D& BgColor )
|
||||||
{
|
{
|
||||||
GRSPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor );
|
GRSPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Draw a closed polyline and fill it if Fill, in object space.
|
* Draw a closed polyline and fill it if Fill, in object space.
|
||||||
*/
|
*/
|
||||||
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill,
|
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill,
|
||||||
COLOR4D Color, COLOR4D BgColor )
|
const COLOR4D& Color, const COLOR4D& BgColor )
|
||||||
{
|
{
|
||||||
GRClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor );
|
GRClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width,
|
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width,
|
||||||
COLOR4D Color, COLOR4D BgColor )
|
const COLOR4D& Color, const COLOR4D& BgColor )
|
||||||
{
|
{
|
||||||
GRSClosedPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor );
|
GRSClosedPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor );
|
||||||
}
|
}
|
||||||
|
@ -594,7 +548,7 @@ 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 xc, int yc, int r, int width, const COLOR4D& Color )
|
||||||
{
|
{
|
||||||
if( clipCircle( ClipBox, xc, yc, r, width ) || r <= 0 )
|
if( clipCircle( ClipBox, xc, yc, r, width ) || r <= 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -605,21 +559,21 @@ void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, int r, int width, CO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, COLOR4D Color )
|
void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, const COLOR4D& Color )
|
||||||
{
|
{
|
||||||
GRCircle( ClipBox, DC, x, y, r, 0, Color );
|
GRCircle( ClipBox, DC, x, y, r, 0, Color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth,
|
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth,
|
||||||
COLOR4D aColor )
|
const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
GRCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, aWidth, aColor );
|
GRCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, aWidth, aColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r,
|
void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width,
|
||||||
int width, COLOR4D Color, COLOR4D BgColor )
|
const COLOR4D& Color, const COLOR4D& BgColor )
|
||||||
{
|
{
|
||||||
if( clipCircle( ClipBox, x, y, r, width ) || r <= 0 )
|
if( clipCircle( ClipBox, x, y, r, width ) || r <= 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -630,27 +584,22 @@ void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, COLOR4D aColor )
|
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius,
|
||||||
|
const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
GRFilledCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, 0, aColor, aColor );
|
GRFilledCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, 0, aColor, aColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int xc, int yc,
|
||||||
* Draw an arc in user space.
|
const COLOR4D& Color )
|
||||||
*/
|
|
||||||
void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
|
||||||
int xc, int yc, COLOR4D Color )
|
|
||||||
{
|
{
|
||||||
GRArc1( ClipBox, DC, x1, y1, x2, y2, xc, yc, 0, Color );
|
GRArc1( ClipBox, DC, x1, y1, x2, y2, xc, yc, 0, Color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int xc, int yc,
|
||||||
* Draw an arc, width = width in user space.
|
int width, const 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 )
|
|
||||||
{
|
{
|
||||||
/* Clip arcs off screen. */
|
/* Clip arcs off screen. */
|
||||||
if( ClipBox )
|
if( ClipBox )
|
||||||
|
@ -661,12 +610,16 @@ void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
xm = ClipBox->GetRight();
|
xm = ClipBox->GetRight();
|
||||||
ym = ClipBox->GetBottom();
|
ym = ClipBox->GetBottom();
|
||||||
r = KiROUND( Distance( x1, y1, xc, yc ) );
|
r = KiROUND( Distance( x1, y1, xc, yc ) );
|
||||||
|
|
||||||
if( xc < ( x0 - r ) )
|
if( xc < ( x0 - r ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( yc < ( y0 - r ) )
|
if( yc < ( y0 - r ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( xc > ( r + xm ) )
|
if( xc > ( r + xm ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( yc > ( r + ym ) )
|
if( yc > ( r + ym ) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -677,27 +630,16 @@ void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
|
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, wxPoint aCenter,
|
||||||
wxPoint aCenter, int aWidth, COLOR4D aColor )
|
int aWidth, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
GRArc1( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aCenter.x, aCenter.y,
|
GRArc1( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aCenter.x, aCenter.y,
|
||||||
aWidth, aColor );
|
aWidth, aColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, double EndAngle,
|
||||||
* Draw a filled arc in drawing space.
|
int r, int width, const COLOR4D& Color, const COLOR4D& BgColor )
|
||||||
*/
|
|
||||||
void GRFilledArc( EDA_RECT* ClipBox,
|
|
||||||
wxDC* DC,
|
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
double StAngle,
|
|
||||||
double EndAngle,
|
|
||||||
int r,
|
|
||||||
int width,
|
|
||||||
COLOR4D Color,
|
|
||||||
COLOR4D BgColor )
|
|
||||||
{
|
{
|
||||||
int x1, y1, x2, y2;
|
int x1, y1, x2, y2;
|
||||||
|
|
||||||
|
@ -737,19 +679,15 @@ void GRFilledArc( EDA_RECT* ClipBox,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y,
|
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, double EndAngle,
|
||||||
double StAngle, double EndAngle, int r,
|
int r, const COLOR4D& Color, const COLOR4D& BgColor )
|
||||||
COLOR4D Color, COLOR4D BgColor )
|
|
||||||
{
|
{
|
||||||
GRFilledArc( ClipBox, DC, x, y, StAngle, EndAngle, r, 0, Color, BgColor );
|
GRFilledArc( ClipBox, DC, x, y, StAngle, EndAngle, r, 0, Color, BgColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, double StAngle, double EndAngle, int r,
|
||||||
* Draw an arc in drawing space.
|
const COLOR4D& Color )
|
||||||
*/
|
|
||||||
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, double StAngle,
|
|
||||||
double EndAngle, int r, COLOR4D Color )
|
|
||||||
{
|
{
|
||||||
int x1, y1, x2, y2;
|
int x1, y1, x2, y2;
|
||||||
|
|
||||||
|
@ -792,18 +730,8 @@ void GRArc( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, double StAngle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, double EndAngle,
|
||||||
* Draw an arc with width = width in drawing space.
|
int r, int width, const COLOR4D& Color )
|
||||||
*/
|
|
||||||
void GRArc( EDA_RECT* ClipBox,
|
|
||||||
wxDC* DC,
|
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
double StAngle,
|
|
||||||
double EndAngle,
|
|
||||||
int r,
|
|
||||||
int width,
|
|
||||||
COLOR4D Color )
|
|
||||||
{
|
{
|
||||||
int x1, y1, x2, y2;
|
int x1, y1, x2, y2;
|
||||||
|
|
||||||
|
@ -843,16 +771,13 @@ void GRArc( EDA_RECT* ClipBox,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
void GRRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, const COLOR4D& aColor )
|
||||||
* Draw a rectangle in drawing space.
|
|
||||||
*/
|
|
||||||
void GRRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, COLOR4D aColor )
|
|
||||||
{
|
{
|
||||||
GRSRect( aClipBox, aDC, x1, y1, x2, y2, 0, aColor );
|
GRSRect( aClipBox, aDC, x1, y1, x2, y2, 0, aColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRRectPs( EDA_RECT* aClipBox, wxDC* aDC, const EDA_RECT& aRect, COLOR4D aColor,
|
void GRRectPs( EDA_RECT* aClipBox, wxDC* aDC, const EDA_RECT& aRect, const COLOR4D& aColor,
|
||||||
wxPenStyle aStyle )
|
wxPenStyle aStyle )
|
||||||
{
|
{
|
||||||
int x1 = aRect.GetX();
|
int x1 = aRect.GetX();
|
||||||
|
@ -864,16 +789,15 @@ void GRRectPs( EDA_RECT* aClipBox, wxDC* aDC, const EDA_RECT& aRect, COLOR4D aCo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
void GRRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width,
|
||||||
* Draw a rectangle (thick lines) in drawing space.
|
const COLOR4D& Color )
|
||||||
*/
|
|
||||||
void GRRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color )
|
|
||||||
{
|
{
|
||||||
GRSRect( ClipBox, DC, x1, y1, x2, y2, width, Color );
|
GRSRect( ClipBox, DC, x1, y1, x2, y2, width, Color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRRect( EDA_RECT* aClipBox, wxDC* aDC, const EDA_RECT& aRect, int aWidth, COLOR4D aColor )
|
void GRRect( EDA_RECT* aClipBox, wxDC* aDC, const EDA_RECT& aRect, int aWidth,
|
||||||
|
const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
int x1 = aRect.GetX();
|
int x1 = aRect.GetX();
|
||||||
int y1 = aRect.GetY();
|
int y1 = aRect.GetY();
|
||||||
|
@ -884,31 +808,22 @@ void GRRect( EDA_RECT* aClipBox, wxDC* aDC, const EDA_RECT& aRect, int aWidth, C
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Draw a rectangle (filled with AreaColor) in drawing space.
|
|
||||||
*/
|
|
||||||
void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
COLOR4D Color, COLOR4D BgColor )
|
const COLOR4D& Color, const COLOR4D& BgColor )
|
||||||
{
|
{
|
||||||
GRSFilledRect( ClipBox, DC, x1, y1, x2, y2, 0, Color, BgColor );
|
GRSFilledRect( ClipBox, DC, x1, y1, x2, y2, 0, Color, BgColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Draw a rectangle (filled with AreaColor) in drawing space.
|
|
||||||
*/
|
|
||||||
void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
int width, COLOR4D Color, COLOR4D BgColor )
|
int width, const COLOR4D& Color, const COLOR4D& BgColor )
|
||||||
{
|
{
|
||||||
GRSFilledRect( ClipBox, DC, x1, y1, x2, y2, width, Color, BgColor );
|
GRSFilledRect( ClipBox, DC, x1, y1, x2, y2, width, Color, BgColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Draw a rectangle in screen space.
|
|
||||||
*/
|
|
||||||
void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
|
void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
|
||||||
int aWidth, COLOR4D aColor, wxPenStyle aStyle )
|
int aWidth, const COLOR4D& aColor, wxPenStyle aStyle )
|
||||||
{
|
{
|
||||||
wxPoint points[5];
|
wxPoint points[5];
|
||||||
points[0] = wxPoint( x1, y1 );
|
points[0] = wxPoint( x1, y1 );
|
||||||
|
@ -921,7 +836,7 @@ void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
|
||||||
|
|
||||||
|
|
||||||
void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
|
void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
|
||||||
int aWidth, COLOR4D aColor, COLOR4D aBgColor )
|
int aWidth, const COLOR4D& aColor, const COLOR4D& aBgColor )
|
||||||
{
|
{
|
||||||
wxPoint points[5];
|
wxPoint points[5];
|
||||||
points[0] = wxPoint( x1, y1 );
|
points[0] = wxPoint( x1, y1 );
|
||||||
|
@ -992,7 +907,7 @@ void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint* Points, int
|
||||||
|
|
||||||
|
|
||||||
void GRBezier( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aPoint,
|
void GRBezier( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aPoint,
|
||||||
int aWidth, COLOR4D aColor )
|
int aWidth, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
std::vector<wxPoint> output;
|
std::vector<wxPoint> output;
|
||||||
|
|
||||||
|
@ -1003,7 +918,7 @@ void GRBezier( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aPoint,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRDrawAnchor( EDA_RECT *aClipBox, wxDC *aDC, int x, int y, int aSize, COLOR4D aColor )
|
void GRDrawAnchor( EDA_RECT *aClipBox, wxDC *aDC, int x, int y, int aSize, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
int anchor_size = aDC->DeviceToLogicalXRel( aSize );
|
int anchor_size = aDC->DeviceToLogicalXRel( aSize );
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
|
||||||
* @param aPlotter is a PLOTTER instance, when this function is used to plot
|
* @param aPlotter is a PLOTTER instance, when this function is used to plot
|
||||||
* the text. NULL to draw this text.
|
* the text. NULL to draw this text.
|
||||||
*/
|
*/
|
||||||
void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aText,
|
void GRText( wxDC* aDC, const wxPoint& aPos, const COLOR4D& aColor, const wxString& aText,
|
||||||
double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
|
||||||
void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ),
|
void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ),
|
||||||
|
@ -171,28 +171,31 @@ void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aTe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRHaloText( wxDC* aDC, const wxPoint &aPos, COLOR4D aBgColor, COLOR4D aColor1,
|
void GRHaloText( wxDC* aDC, const wxPoint &aPos, const COLOR4D& aBgColor, const COLOR4D& aColor1,
|
||||||
COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize,
|
const COLOR4D& aColor2, const wxString &aText, double aOrient, const wxSize &aSize,
|
||||||
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth, bool aItalic, bool aBold,
|
int aWidth, bool aItalic, bool aBold,
|
||||||
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ),
|
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ),
|
||||||
void* aCallbackData, PLOTTER * aPlotter )
|
void* aCallbackData, PLOTTER * aPlotter )
|
||||||
{
|
{
|
||||||
|
COLOR4D color1 = aColor1;
|
||||||
|
COLOR4D color2 = aColor2;
|
||||||
|
|
||||||
// Swap color if contrast would be better
|
// Swap color if contrast would be better
|
||||||
// TODO: Maybe calculate contrast some way other than brightness
|
// TODO: Maybe calculate contrast some way other than brightness
|
||||||
if( aBgColor.GetBrightness() > 0.5 )
|
if( aBgColor.GetBrightness() > 0.5 )
|
||||||
{
|
{
|
||||||
COLOR4D c = aColor1;
|
COLOR4D c = color1;
|
||||||
aColor1 = aColor2;
|
color1 = color2;
|
||||||
aColor2 = c;
|
color2 = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the background
|
// Draw the background
|
||||||
GRText( aDC, aPos, aColor1, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
|
GRText( aDC, aPos, color1, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
|
||||||
aBold, aCallback, aCallbackData, aPlotter );
|
aBold, aCallback, aCallbackData, aPlotter );
|
||||||
|
|
||||||
// Draw the text
|
// Draw the text
|
||||||
GRText( aDC, aPos, aColor2, aText, aOrient, aSize, aH_justify, aV_justify, aWidth/4, aItalic,
|
GRText( aDC, aPos, color2, aText, aOrient, aSize, aH_justify, aV_justify, aWidth / 4, aItalic,
|
||||||
aBold, aCallback, aCallbackData, aPlotter );
|
aBold, aCallback, aCallbackData, aPlotter );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 Kicad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2019-2021 Kicad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -105,7 +105,7 @@ KIGFX::PREVIEW::TEXT_DIMS KIGFX::PREVIEW::SetConstantGlyphHeight( KIGFX::GAL* aG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KIGFX::COLOR4D KIGFX::PREVIEW::GetShadowColor(class KIGFX::COLOR4D aColor)
|
KIGFX::COLOR4D KIGFX::PREVIEW::GetShadowColor( const KIGFX::COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
if( aColor.GetBrightness() > 0.5 )
|
if( aColor.GetBrightness() > 0.5 )
|
||||||
return COLOR4D::BLACK;
|
return COLOR4D::BLACK;
|
||||||
|
|
|
@ -346,7 +346,7 @@ COLOR4D COLOR_SETTINGS::GetDefaultColor( int aLayer )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void COLOR_SETTINGS::SetColor( int aLayer, COLOR4D aColor )
|
void COLOR_SETTINGS::SetColor( int aLayer, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
m_colors[ aLayer ] = aColor;
|
m_colors[ aLayer ] = aColor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,8 @@ bool LAYER_SELECTOR::SetLayersHotkeys( bool value )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LAYER_SELECTOR::DrawColorSwatch( wxBitmap& aLayerbmp, COLOR4D aBackground, COLOR4D aColor )
|
void LAYER_SELECTOR::DrawColorSwatch( wxBitmap& aLayerbmp, const COLOR4D& aBackground,
|
||||||
|
const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
wxMemoryDC bmpDC;
|
wxMemoryDC bmpDC;
|
||||||
wxBrush brush;
|
wxBrush brush;
|
||||||
|
|
|
@ -858,7 +858,7 @@ SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* a
|
||||||
|
|
||||||
|
|
||||||
void APERTURE_MACRO::DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox,
|
void APERTURE_MACRO::DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox,
|
||||||
wxDC* aDC, COLOR4D aColor, wxPoint aShapePos,
|
wxDC* aDC, const COLOR4D& aColor, wxPoint aShapePos,
|
||||||
bool aFilledShape )
|
bool aFilledShape )
|
||||||
{
|
{
|
||||||
SHAPE_POLY_SET* shapeBuffer = GetApertureMacroShape( aParent, aShapePos );
|
SHAPE_POLY_SET* shapeBuffer = GetApertureMacroShape( aParent, aShapePos );
|
||||||
|
|
|
@ -204,7 +204,7 @@ struct APERTURE_MACRO
|
||||||
* @param aFilledShape set to true to draw in filled mode, false to draw in sketch mode.
|
* @param aFilledShape set to true to draw in filled mode, false to draw in sketch mode.
|
||||||
*/
|
*/
|
||||||
void DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC,
|
void DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC,
|
||||||
COLOR4D aColor, wxPoint aShapePos, bool aFilledShape );
|
const COLOR4D& aColor, wxPoint aShapePos, bool aFilledShape );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate a value that can be used to evaluate the size of text when displaying the
|
* Calculate a value that can be used to evaluate the size of text when displaying the
|
||||||
|
|
|
@ -646,7 +646,7 @@ void GERBER_DRAW_ITEM::ConvertSegmentToPolygon()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBER_DRAW_ITEM::PrintGerberPoly( wxDC* aDC, COLOR4D aColor, const wxPoint& aOffset,
|
void GERBER_DRAW_ITEM::PrintGerberPoly( wxDC* aDC, const COLOR4D& aColor, const wxPoint& aOffset,
|
||||||
bool aFilledShape )
|
bool aFilledShape )
|
||||||
{
|
{
|
||||||
std::vector<wxPoint> points;
|
std::vector<wxPoint> points;
|
||||||
|
|
|
@ -192,7 +192,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* Print the polygon stored in m_PolyCorners.
|
* Print the polygon stored in m_PolyCorners.
|
||||||
*/
|
*/
|
||||||
void PrintGerberPoly( wxDC* aDC, COLOR4D aColor, const wxPoint& aOffset, bool aFilledShape );
|
void PrintGerberPoly( wxDC* aDC, const COLOR4D& aColor, const wxPoint& aOffset,
|
||||||
|
bool aFilledShape );
|
||||||
|
|
||||||
int Shape() const { return m_Shape; }
|
int Shape() const { return m_Shape; }
|
||||||
|
|
||||||
|
|
|
@ -755,7 +755,7 @@ void GERBVIEW_FRAME::SetGridVisibility( bool aVisible )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBVIEW_FRAME::SetVisibleElementColor( int aLayerID, COLOR4D aColor )
|
void GERBVIEW_FRAME::SetVisibleElementColor( int aLayerID, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
|
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
|
||||||
|
|
||||||
|
@ -768,6 +768,7 @@ void GERBVIEW_FRAME::SetVisibleElementColor( int aLayerID, COLOR4D aColor )
|
||||||
|
|
||||||
case LAYER_GERBVIEW_DRAWINGSHEET:
|
case LAYER_GERBVIEW_DRAWINGSHEET:
|
||||||
settings->SetColor( LAYER_GERBVIEW_DRAWINGSHEET, aColor );
|
settings->SetColor( LAYER_GERBVIEW_DRAWINGSHEET, aColor );
|
||||||
|
|
||||||
// LAYER_DRAWINGSHEET color is also used to draw the drawing-sheet
|
// LAYER_DRAWINGSHEET color is also used to draw the drawing-sheet
|
||||||
// FIX ME: why LAYER_DRAWINGSHEET must be set, although LAYER_GERBVIEW_DRAWINGSHEET
|
// FIX ME: why LAYER_DRAWINGSHEET must be set, although LAYER_GERBVIEW_DRAWINGSHEET
|
||||||
// is used to initialize the drawing-sheet color layer.
|
// is used to initialize the drawing-sheet color layer.
|
||||||
|
@ -806,7 +807,7 @@ COLOR4D GERBVIEW_FRAME::GetLayerColor( int aLayer ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBVIEW_FRAME::SetLayerColor( int aLayer, COLOR4D aColor )
|
void GERBVIEW_FRAME::SetLayerColor( int aLayer, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
Pgm().GetSettingsManager().GetColorSettings()->SetColor( aLayer, aColor );
|
Pgm().GetSettingsManager().GetColorSettings()->SetColor( aLayer, aColor );
|
||||||
applyDisplaySettingsToGAL();
|
applyDisplaySettingsToGAL();
|
||||||
|
@ -891,7 +892,7 @@ COLOR4D GERBVIEW_FRAME::GetGridColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBVIEW_FRAME::SetGridColor( COLOR4D aColor )
|
void GERBVIEW_FRAME::SetGridColor( const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
Pgm().GetSettingsManager().GetColorSettings()->SetColor( LAYER_GRID, aColor );
|
Pgm().GetSettingsManager().GetColorSettings()->SetColor( LAYER_GRID, aColor );
|
||||||
GetCanvas()->GetGAL()->SetGridColor( aColor );
|
GetCanvas()->GetGAL()->SetGridColor( aColor );
|
||||||
|
|
|
@ -155,10 +155,10 @@ public:
|
||||||
*/
|
*/
|
||||||
COLOR4D GetVisibleElementColor( int aLayerID );
|
COLOR4D GetVisibleElementColor( int aLayerID );
|
||||||
|
|
||||||
void SetVisibleElementColor( int aLayerID, COLOR4D aColor );
|
void SetVisibleElementColor( int aLayerID, const COLOR4D& aColor );
|
||||||
|
|
||||||
COLOR4D GetLayerColor( int aLayer ) const;
|
COLOR4D GetLayerColor( int aLayer ) const;
|
||||||
void SetLayerColor( int aLayer, COLOR4D aColor );
|
void SetLayerColor( int aLayer, const COLOR4D& aColor );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is usually the background color, but can be another color in order to see
|
* This is usually the background color, but can be another color in order to see
|
||||||
|
@ -456,7 +456,7 @@ public:
|
||||||
COLOR4D GetGridColor() override;
|
COLOR4D GetGridColor() override;
|
||||||
|
|
||||||
///< @copydoc EDA_DRAW_FRAME::SetGridColor()
|
///< @copydoc EDA_DRAW_FRAME::SetGridColor()
|
||||||
virtual void SetGridColor( COLOR4D aColor ) override;
|
virtual void SetGridColor( const COLOR4D& aColor ) override;
|
||||||
|
|
||||||
const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override
|
const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override
|
||||||
{
|
{
|
||||||
|
|
|
@ -242,7 +242,7 @@ void GERBER_LAYER_WIDGET::OnLayerRightClick( wxMenu& aMenu )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor )
|
void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
// NOTE: Active layer in GerbView is stored as 0-indexed, but layer color is
|
// NOTE: Active layer in GerbView is stored as 0-indexed, but layer color is
|
||||||
// stored according to the GERBER_DRAW_LAYER() offset.
|
// stored according to the GERBER_DRAW_LAYER() offset.
|
||||||
|
@ -297,7 +297,7 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
|
void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
m_frame->SetVisibleElementColor( aId, aColor );
|
m_frame->SetVisibleElementColor( aId, aColor );
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,10 @@ public:
|
||||||
|
|
||||||
//-----<implement LAYER_WIDGET abstract callback functions>-----------
|
//-----<implement LAYER_WIDGET abstract callback functions>-----------
|
||||||
void OnLayerRightClick( wxMenu& aMenu ) override;
|
void OnLayerRightClick( wxMenu& aMenu ) override;
|
||||||
void OnLayerColorChange( int aLayer, COLOR4D aColor ) override;
|
void OnLayerColorChange( int aLayer, const COLOR4D& aColor ) override;
|
||||||
bool OnLayerSelect( int aLayer ) override;
|
bool OnLayerSelect( int aLayer ) override;
|
||||||
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ) override;
|
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ) override;
|
||||||
void OnRenderColorChange( int aId, COLOR4D aColor ) override;
|
void OnRenderColorChange( int aId, const COLOR4D& aColor ) override;
|
||||||
void OnRenderEnable( int aId, bool isEnabled ) override;
|
void OnRenderEnable( int aId, bool isEnabled ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -91,6 +91,7 @@ void LAYER_WIDGET::OnLeftDownLayers( wxMouseEvent& event )
|
||||||
int height = 0;
|
int height = 0;
|
||||||
|
|
||||||
int rowCount = GetLayerRowCount();
|
int rowCount = GetLayerRowCount();
|
||||||
|
|
||||||
for( row = 0; row<rowCount; ++row )
|
for( row = 0; row<rowCount; ++row )
|
||||||
{
|
{
|
||||||
if( y < height + heights[row] )
|
if( y < height + heights[row] )
|
||||||
|
@ -120,7 +121,8 @@ void LAYER_WIDGET::OnLeftDownLayers( wxMouseEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LAYER_WIDGET::OnRightDownLayer( wxMouseEvent& aEvent, COLOR_SWATCH* aColorSwatch, const wxString& aLayerName )
|
void LAYER_WIDGET::OnRightDownLayer( wxMouseEvent& aEvent, COLOR_SWATCH* aColorSwatch,
|
||||||
|
const wxString& aLayerName )
|
||||||
{
|
{
|
||||||
wxMenu menu;
|
wxMenu menu;
|
||||||
|
|
||||||
|
@ -131,13 +133,17 @@ void LAYER_WIDGET::OnRightDownLayer( wxMouseEvent& aEvent, COLOR_SWATCH* aColorS
|
||||||
|
|
||||||
OnLayerRightClick( menu );
|
OnLayerRightClick( menu );
|
||||||
|
|
||||||
menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [aColorSwatch]( wxCommandEvent& event ) {
|
menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [aColorSwatch]( wxCommandEvent& event )
|
||||||
if ( event.GetId() == ID_CHANGE_LAYER_COLOR ) {
|
{
|
||||||
aColorSwatch->GetNewSwatchColor();
|
if( event.GetId() == ID_CHANGE_LAYER_COLOR )
|
||||||
} else {
|
{
|
||||||
event.Skip();
|
aColorSwatch->GetNewSwatchColor();
|
||||||
}
|
}
|
||||||
} );
|
else
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
PopupMenu( &menu );
|
PopupMenu( &menu );
|
||||||
passOnFocus();
|
passOnFocus();
|
||||||
|
@ -170,7 +176,8 @@ void LAYER_WIDGET::OnLayerCheckBox( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LAYER_WIDGET::OnRightDownRender( wxMouseEvent& aEvent, COLOR_SWATCH* aColorSwatch, const wxString& aRenderName )
|
void LAYER_WIDGET::OnRightDownRender( wxMouseEvent& aEvent, COLOR_SWATCH* aColorSwatch,
|
||||||
|
const wxString& aRenderName )
|
||||||
{
|
{
|
||||||
wxMenu menu;
|
wxMenu menu;
|
||||||
|
|
||||||
|
@ -424,7 +431,7 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec )
|
||||||
{
|
{
|
||||||
col = 1;
|
col = 1;
|
||||||
cb = new wxCheckBox( m_RenderScrolledWindow, encodeId( col, aSpec.id ),
|
cb = new wxCheckBox( m_RenderScrolledWindow, encodeId( col, aSpec.id ),
|
||||||
aSpec.rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
|
aSpec.rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
|
||||||
shrinkFont( cb, m_PointSize );
|
shrinkFont( cb, m_PointSize );
|
||||||
cb->SetValue( aSpec.state );
|
cb->SetValue( aSpec.state );
|
||||||
cb->Enable( aSpec.changeable );
|
cb->Enable( aSpec.changeable );
|
||||||
|
@ -434,6 +441,7 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec )
|
||||||
|
|
||||||
// column 0
|
// column 0
|
||||||
col = 0;
|
col = 0;
|
||||||
|
|
||||||
if( aSpec.color != COLOR4D::UNSPECIFIED )
|
if( aSpec.color != COLOR4D::UNSPECIFIED )
|
||||||
{
|
{
|
||||||
auto bmb = new COLOR_SWATCH( m_RenderScrolledWindow, aSpec.color, encodeId( col, aSpec.id ),
|
auto bmb = new COLOR_SWATCH( m_RenderScrolledWindow, aSpec.color, encodeId( col, aSpec.id ),
|
||||||
|
@ -759,7 +767,7 @@ bool LAYER_WIDGET::IsLayerVisible( LAYER_NUM aLayer )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LAYER_WIDGET::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor )
|
void LAYER_WIDGET::SetLayerColor( LAYER_NUM aLayer, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
int row = findLayerRow( aLayer );
|
int row = findLayerRow( aLayer );
|
||||||
|
|
||||||
|
@ -881,7 +889,7 @@ class MYFRAME : public wxFrame
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnLayerColorChange( int aLayer, COLOR4D aColor )
|
void OnLayerColorChange( int aLayer, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
/* a test trigger only
|
/* a test trigger only
|
||||||
if( aLayer == 2 )
|
if( aLayer == 2 )
|
||||||
|
@ -900,7 +908,7 @@ class MYFRAME : public wxFrame
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnRenderColorChange( int aId, COLOR4D aColor )
|
void OnRenderColorChange( int aId, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,9 +92,9 @@ public:
|
||||||
bool spacer; ///< if true, this row is a spacer
|
bool spacer; ///< if true, this row is a spacer
|
||||||
COLOR4D defaultColor; ///< The default color for the row
|
COLOR4D defaultColor; ///< The default color for the row
|
||||||
|
|
||||||
ROW( const wxString& aRowName, int aId, COLOR4D aColor = COLOR4D::UNSPECIFIED,
|
ROW( const wxString& aRowName, int aId, const COLOR4D& aColor = COLOR4D::UNSPECIFIED,
|
||||||
const wxString& aTooltip = wxEmptyString, bool aState = true,
|
const wxString& aTooltip = wxEmptyString, bool aState = true,
|
||||||
bool aChangeable = true, COLOR4D aDefaultColor = COLOR4D::UNSPECIFIED )
|
bool aChangeable = true, const COLOR4D& aDefaultColor = COLOR4D::UNSPECIFIED )
|
||||||
{
|
{
|
||||||
rowName = aRowName;
|
rowName = aRowName;
|
||||||
id = aId;
|
id = aId;
|
||||||
|
@ -238,7 +238,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Change the color of \a aLayer
|
* Change the color of \a aLayer
|
||||||
*/
|
*/
|
||||||
void SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor );
|
void SetLayerColor( LAYER_NUM aLayer, const COLOR4D& aColor );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the color of the layer ROW associated with \a aLayer id.
|
* Return the color of the layer ROW associated with \a aLayer id.
|
||||||
|
@ -299,7 +299,7 @@ public:
|
||||||
* @param aLayer is the board layer to change.
|
* @param aLayer is the board layer to change.
|
||||||
* @param aColor is the new color.
|
* @param aColor is the new color.
|
||||||
*/
|
*/
|
||||||
virtual void OnLayerColorChange( int aLayer, COLOR4D aColor ) = 0;
|
virtual void OnLayerColorChange( int aLayer, const COLOR4D& aColor ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify client code whenever the user selects a different layer.
|
* Notify client code whenever the user selects a different layer.
|
||||||
|
@ -335,7 +335,7 @@ public:
|
||||||
* function.
|
* function.
|
||||||
* @param aColor is the new color.
|
* @param aColor is the new color.
|
||||||
*/
|
*/
|
||||||
virtual void OnRenderColorChange( int aId, COLOR4D aColor ) = 0;
|
virtual void OnRenderColorChange( int aId, const COLOR4D& aColor ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify client code whenever the user changes an rendering enable in one of the rendering
|
* Notify client code whenever the user changes an rendering enable in one of the rendering
|
||||||
|
|
|
@ -231,7 +231,7 @@ public:
|
||||||
* @param aDefaultPensize the pen size used to plot the rectangle when bitmap is not supported.
|
* @param aDefaultPensize the pen size used to plot the rectangle when bitmap is not supported.
|
||||||
*/
|
*/
|
||||||
void PlotImage( PLOTTER* aPlotter, const wxPoint& aPos,
|
void PlotImage( PLOTTER* aPlotter, const wxPoint& aPos,
|
||||||
KIGFX::COLOR4D aDefaultColor, int aDefaultPensize ) const;
|
const KIGFX::COLOR4D& aDefaultColor, int aDefaultPensize ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_scale; // The scaling factor of the bitmap
|
double m_scale; // The scaling factor of the bitmap
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -171,7 +171,7 @@ public:
|
||||||
// the background color of the draw canvas:
|
// the background color of the draw canvas:
|
||||||
// Virtual because some frames can have a specific way to get/set the bg color
|
// Virtual because some frames can have a specific way to get/set the bg color
|
||||||
virtual COLOR4D GetDrawBgColor() const { return m_drawBgColor; }
|
virtual COLOR4D GetDrawBgColor() const { return m_drawBgColor; }
|
||||||
virtual void SetDrawBgColor( COLOR4D aColor) { m_drawBgColor= aColor ; }
|
virtual void SetDrawBgColor( const COLOR4D& aColor) { m_drawBgColor= aColor ; }
|
||||||
|
|
||||||
/// Returns a pointer to the active color theme settings
|
/// Returns a pointer to the active color theme settings
|
||||||
virtual COLOR_SETTINGS* GetColorSettings() const;
|
virtual COLOR_SETTINGS* GetColorSettings() const;
|
||||||
|
@ -225,7 +225,7 @@ public:
|
||||||
virtual void SetGridVisibility( bool aVisible );
|
virtual void SetGridVisibility( bool aVisible );
|
||||||
|
|
||||||
virtual COLOR4D GetGridColor() { return m_gridColor; }
|
virtual COLOR4D GetGridColor() { return m_gridColor; }
|
||||||
virtual void SetGridColor( COLOR4D aColor ) { m_gridColor = aColor; }
|
virtual void SetGridColor( const COLOR4D& aColor ) { m_gridColor = aColor; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command event handler for selecting grid sizes.
|
* Command event handler for selecting grid sizes.
|
||||||
|
|
|
@ -266,7 +266,7 @@ public:
|
||||||
* @param aDisplay_mode #FILLED or #SKETCH.
|
* @param aDisplay_mode #FILLED or #SKETCH.
|
||||||
*/
|
*/
|
||||||
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||||
COLOR4D aColor, OUTLINE_MODE aDisplay_mode = FILLED );
|
const COLOR4D& aColor, OUTLINE_MODE aDisplay_mode = FILLED );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the text shape to a list of segment.
|
* Convert the text shape to a list of segment.
|
||||||
|
|
|
@ -165,7 +165,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param aColor The color to mix with this one
|
* @param aColor The color to mix with this one
|
||||||
*/
|
*/
|
||||||
COLOR4D LegacyMix( COLOR4D aColor ) const;
|
COLOR4D LegacyMix( const COLOR4D& aColor ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packs the color into an unsigned int for compatibility with legacy canvas.
|
* Packs the color into an unsigned int for compatibility with legacy canvas.
|
||||||
|
|
|
@ -90,8 +90,9 @@ typedef enum {
|
||||||
|
|
||||||
|
|
||||||
void GRResetPenAndBrush( wxDC* DC );
|
void GRResetPenAndBrush( wxDC* DC );
|
||||||
void GRSetColorPen( wxDC* DC, COLOR4D Color, int width = 1, wxPenStyle stype = wxPENSTYLE_SOLID );
|
void GRSetColorPen( wxDC* DC, const COLOR4D& Color, int width = 1,
|
||||||
void GRSetBrush( wxDC* DC, COLOR4D Color, bool fill = false );
|
wxPenStyle stype = wxPENSTYLE_SOLID );
|
||||||
|
void GRSetBrush( wxDC* DC, const COLOR4D& Color, bool fill = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param flagforce True to force a black pen whenever the asked color.
|
* @param flagforce True to force a black pen whenever the asked color.
|
||||||
|
@ -104,20 +105,20 @@ void GRForceBlackPen( bool flagforce );
|
||||||
bool GetGRForceBlackPenState( void );
|
bool GetGRForceBlackPenState( void );
|
||||||
|
|
||||||
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth,
|
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth,
|
||||||
COLOR4D aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID );
|
const COLOR4D& aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID );
|
||||||
void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width,
|
void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width,
|
||||||
COLOR4D Color, wxPenStyle aStyle = wxPENSTYLE_SOLID );
|
const COLOR4D& Color, wxPenStyle aStyle = wxPENSTYLE_SOLID );
|
||||||
void GRMoveTo( int x, int y );
|
void GRMoveTo( int x, int y );
|
||||||
void GRLineTo( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int width, COLOR4D Color );
|
void GRLineTo( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int width, const COLOR4D& Color );
|
||||||
|
|
||||||
void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width,
|
void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width,
|
||||||
COLOR4D Color, COLOR4D BgColor );
|
const COLOR4D& Color, const COLOR4D& BgColor );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw cubic (4 points: start control1, control2, end) bezier curve.
|
* Draw cubic (4 points: start control1, control2, end) bezier curve.
|
||||||
*/
|
*/
|
||||||
void GRBezier( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aPoints,
|
void GRBezier( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aPoints,
|
||||||
int aWidth, COLOR4D aColor );
|
int aWidth, const COLOR4D& aColor );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw a closed polygon onto the drawing context \a aDC and optionally fills and/or draws
|
* Draw a closed polygon onto the drawing context \a aDC and optionally fills and/or draws
|
||||||
|
@ -132,7 +133,7 @@ void GRBezier( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aPoints,
|
||||||
* @param aFillColor the fill color of the polygon's interior.
|
* @param aFillColor the fill color of the polygon's interior.
|
||||||
*/
|
*/
|
||||||
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* aDC, int aPointCount, const wxPoint* aPoints,
|
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* aDC, int aPointCount, const wxPoint* aPoints,
|
||||||
bool doFill, COLOR4D aPenColor, COLOR4D aFillColor );
|
bool doFill, const COLOR4D& aPenColor, const COLOR4D& aFillColor );
|
||||||
|
|
||||||
// @todo could make these 2 closed polygons calls a single function and default
|
// @todo could make these 2 closed polygons calls a single function and default
|
||||||
// the aPenWidth argument
|
// the aPenWidth argument
|
||||||
|
@ -151,7 +152,8 @@ void GRClosedPoly( EDA_RECT* ClipBox, wxDC* aDC, int aPointCount, const wxPoint*
|
||||||
* @param aFillColor the fill color of the polygon's interior.
|
* @param aFillColor the fill color of the polygon's interior.
|
||||||
*/
|
*/
|
||||||
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* aDC, int aPointCount, const wxPoint* aPoints,
|
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* aDC, int aPointCount, const wxPoint* aPoints,
|
||||||
bool doFill, int aPenWidth, COLOR4D aPenColor, COLOR4D aFillColor );
|
bool doFill, int aPenWidth, const COLOR4D& aPenColor,
|
||||||
|
const COLOR4D& aFillColor );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -165,58 +167,59 @@ void GRClosedPoly( EDA_RECT* ClipBox, wxDC* aDC, int aPointCount, const wxPoint*
|
||||||
* @param aColor is the color to draw.
|
* @param aColor is the color to draw.
|
||||||
* @see COLOR4D
|
* @see COLOR4D
|
||||||
*/
|
*/
|
||||||
void GRCircle( EDA_RECT* ClipBox, wxDC* aDC, int x, int y, int aRadius, COLOR4D aColor );
|
void GRCircle( EDA_RECT* ClipBox, wxDC* aDC, int x, int y, int aRadius, const COLOR4D& aColor );
|
||||||
void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, COLOR4D Color );
|
void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, const COLOR4D& Color );
|
||||||
void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width,
|
void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width,
|
||||||
COLOR4D Color, COLOR4D BgColor );
|
const COLOR4D& Color, const COLOR4D& BgColor );
|
||||||
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, COLOR4D aColor );
|
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius,
|
||||||
|
const COLOR4D& aColor );
|
||||||
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth,
|
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth,
|
||||||
COLOR4D aColor );
|
const COLOR4D& aColor );
|
||||||
|
|
||||||
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
|
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
|
||||||
double EndAngle, int r, COLOR4D Color );
|
double EndAngle, int r, const COLOR4D& Color );
|
||||||
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
|
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
|
||||||
double EndAngle, int r, int width, COLOR4D Color );
|
double EndAngle, int r, int width, const COLOR4D& Color );
|
||||||
void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
int xc, int yc, COLOR4D Color );
|
int xc, int yc, const COLOR4D& Color );
|
||||||
void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
int xc, int yc, int width, COLOR4D Color );
|
int xc, int yc, int width, const COLOR4D& Color );
|
||||||
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
|
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
|
||||||
wxPoint aCenter, int aWidth, COLOR4D aColor );
|
wxPoint aCenter, int aWidth, const COLOR4D& aColor );
|
||||||
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y,
|
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, double EndAngle,
|
||||||
double StAngle, double EndAngle, int r, COLOR4D Color, COLOR4D BgColor );
|
int r, const COLOR4D& Color, const COLOR4D& BgColor );
|
||||||
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
|
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
|
||||||
double EndAngle, int r, int width, COLOR4D Color, COLOR4D BgColor );
|
double EndAngle, int r, int width, const COLOR4D& Color, const COLOR4D& BgColor );
|
||||||
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width,
|
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width,
|
||||||
COLOR4D Color );
|
const COLOR4D& Color );
|
||||||
|
|
||||||
void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
int width, COLOR4D Color );
|
int width, const COLOR4D& Color );
|
||||||
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
|
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
|
||||||
int aWidth, COLOR4D aColor );
|
int aWidth, const COLOR4D& aColor );
|
||||||
|
|
||||||
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
int width, int aPenSize, COLOR4D Color );
|
int width, int aPenSize, const COLOR4D& Color );
|
||||||
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
|
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
|
||||||
int aWidth, COLOR4D aColor );
|
int aWidth, const COLOR4D& aColor );
|
||||||
|
|
||||||
void GRSetColor( COLOR4D Color );
|
void GRSetColor( const COLOR4D& Color );
|
||||||
void GRSetDefaultPalette();
|
void GRSetDefaultPalette();
|
||||||
COLOR4D GRGetColor();
|
COLOR4D GRGetColor();
|
||||||
void GRPutPixel( EDA_RECT* ClipBox, wxDC* DC, int x, int y, COLOR4D color );
|
void GRPutPixel( EDA_RECT* ClipBox, wxDC* DC, int x, int y, const COLOR4D& color );
|
||||||
void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
|
void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
|
||||||
int x2, int y2, COLOR4D Color, COLOR4D BgColor );
|
int x2, int y2, const COLOR4D& Color, const COLOR4D& BgColor );
|
||||||
void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
|
void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
|
||||||
int x2, int y2, int width, COLOR4D Color, COLOR4D BgColor );
|
int x2, int y2, int width, const COLOR4D& Color, const COLOR4D& BgColor );
|
||||||
void GRRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, COLOR4D Color );
|
void GRRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, const COLOR4D& Color );
|
||||||
void GRRect( EDA_RECT* ClipBox, wxDC* DC,const EDA_RECT& aRect, int aWidth, COLOR4D Color );
|
void GRRect( EDA_RECT* ClipBox, wxDC* DC,const EDA_RECT& aRect, int aWidth, const COLOR4D& Color );
|
||||||
void GRRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
|
void GRRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
|
||||||
int x2, int y2, int width, COLOR4D Color );
|
int x2, int y2, int width, const COLOR4D& Color );
|
||||||
void GRRectPs( EDA_RECT* aClipBox, wxDC* aDC,const EDA_RECT& aRect,
|
void GRRectPs( EDA_RECT* aClipBox, wxDC* aDC,const EDA_RECT& aRect,
|
||||||
int aWidth, COLOR4D aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID );
|
int aWidth, const COLOR4D& aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID );
|
||||||
|
|
||||||
void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
|
void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
|
||||||
int x2, int y2, int width, COLOR4D Color, COLOR4D BgColor );
|
int x2, int y2, int width, const COLOR4D& Color, const COLOR4D& BgColor );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw an array of lines (not a polygon).
|
* Draw an array of lines (not a polygon).
|
||||||
|
@ -229,9 +232,9 @@ void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
|
||||||
* @see COLOR4D
|
* @see COLOR4D
|
||||||
*/
|
*/
|
||||||
void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC,std::vector<wxPoint>& aLines,
|
void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC,std::vector<wxPoint>& aLines,
|
||||||
int aWidth, COLOR4D aColor );
|
int aWidth, const COLOR4D& aColor );
|
||||||
|
|
||||||
void GRDrawAnchor( EDA_RECT* aClipBox, wxDC* aDC, int x, int y, int aSize, COLOR4D aColor );
|
void GRDrawAnchor( EDA_RECT* aClipBox, wxDC* aDC, int x, int y, int aSize, const COLOR4D& aColor );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw text centered on a wxDC with wrapping.
|
* Draw text centered on a wxDC with wrapping.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009-2014 Jerry Jacobs
|
* Copyright (C) 2009-2014 Jerry Jacobs
|
||||||
* Copyright (C) 1992-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -110,7 +110,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, b
|
||||||
* @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot
|
* @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot
|
||||||
* the text. NULL to draw this text.
|
* the text. NULL to draw this text.
|
||||||
*/
|
*/
|
||||||
void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aText,
|
void GRText( wxDC* aDC, const wxPoint& aPos, const COLOR4D& aColor, const wxString& aText,
|
||||||
double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
|
||||||
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
|
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
|
||||||
|
@ -123,8 +123,8 @@ void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aTe
|
||||||
* See GRText for most of the parameters. If \a aBgColor is a dark color text is drawn
|
* See GRText for most of the parameters. If \a aBgColor is a dark color text is drawn
|
||||||
* in \a aColor2 with \a aColor1 border. Otherwise colors are swapped.
|
* in \a aColor2 with \a aColor1 border. Otherwise colors are swapped.
|
||||||
*/
|
*/
|
||||||
void GRHaloText( wxDC* aDC, const wxPoint& aPos, COLOR4D aBgColor, COLOR4D aColor1,
|
void GRHaloText( wxDC* aDC, const wxPoint& aPos, const COLOR4D& aBgColor, const COLOR4D& aColor1,
|
||||||
COLOR4D aColor2, const wxString& aText, double aOrient, const wxSize &aSize,
|
const COLOR4D& aColor2, const wxString& aText, double aOrient, const wxSize &aSize,
|
||||||
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth, bool aItalic, bool aBold,
|
int aWidth, bool aItalic, bool aBold,
|
||||||
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
|
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -170,7 +170,7 @@ public:
|
||||||
|
|
||||||
PCBNEW_SETTINGS& Settings() { return *m_settings; }
|
PCBNEW_SETTINGS& Settings() { return *m_settings; }
|
||||||
|
|
||||||
void SetDrawBgColor( COLOR4D aColor ) override;
|
void SetDrawBgColor( const COLOR4D& aColor ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display options control the way tracks, vias, outlines and other things are shown
|
* Display options control the way tracks, vias, outlines and other things are shown
|
||||||
|
@ -332,7 +332,8 @@ public:
|
||||||
* @param aItemsList is the list of items modified by the command to undo.
|
* @param aItemsList is the list of items modified by the command to undo.
|
||||||
* @param aTypeCommand is the command type (see enum #UNDO_REDO)
|
* @param aTypeCommand is the command type (see enum #UNDO_REDO)
|
||||||
*/
|
*/
|
||||||
virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand ) = 0;
|
virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
||||||
|
UNDO_REDO aTypeCommand ) = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Kicad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2017-2021 Kicad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -44,40 +44,37 @@ struct TEXT_DIMS
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default alpha of "de-emphasised" features (like previously locked-in
|
* Default alpha of "de-emphasised" features (like previously locked-in lines.
|
||||||
* lines
|
|
||||||
*/
|
*/
|
||||||
double PreviewOverlayDeemphAlpha( bool aDeemph = true );
|
double PreviewOverlayDeemphAlpha( bool aDeemph = true );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a formatted string showing a dimension to a sane precision
|
* Get a formatted string showing a dimension to a sane precision with an optional prefix and
|
||||||
* with an optional prefix and unit suffix.
|
* unit suffix.
|
||||||
*/
|
*/
|
||||||
wxString DimensionLabel( const wxString& prefix, double aVal, EDA_UNITS aUnits,
|
wxString DimensionLabel( const wxString& prefix, double aVal, EDA_UNITS aUnits,
|
||||||
bool aIncludeUnits = true );
|
bool aIncludeUnits = true );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the GAL glyph height to a constant scaled value, so that it
|
* Set the GAL glyph height to a constant scaled value, so that it always looks the same on screen.
|
||||||
* always looks the same on screen
|
|
||||||
*
|
*
|
||||||
* @param aGal the GAL to draw on
|
* @param aGal the GAL to draw on.
|
||||||
* @param aRelativeSize similar to HTML font sizes; 0 will give a standard size while +1 etc.
|
* @param aRelativeSize similar to HTML font sizes; 0 will give a standard size while +1 etc.
|
||||||
* will give larger and -1 etc. will give smaller.
|
* will give larger and -1 etc. will give smaller.
|
||||||
* @returns the text widths for the resulting glyph size.
|
* @returns the text widths for the resulting glyph size.
|
||||||
*/
|
*/
|
||||||
TEXT_DIMS SetConstantGlyphHeight( KIGFX::GAL* aGal, int aRelativeSize = 0 );
|
TEXT_DIMS SetConstantGlyphHeight( KIGFX::GAL* aGal, int aRelativeSize = 0 );
|
||||||
|
|
||||||
COLOR4D GetShadowColor( COLOR4D aColor );
|
COLOR4D GetShadowColor( const COLOR4D& aColor );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw strings next to the cursor
|
* Draw strings next to the cursor.
|
||||||
*
|
*
|
||||||
* @param aGal the GAL to draw on
|
* @param aGal the GAL to draw on.
|
||||||
* @param aCursorPos the position of the cursor to draw next to
|
* @param aCursorPos the position of the cursor to draw next to.
|
||||||
* @param aTextQuadrant a vector pointing to the quadrant to draw the
|
* @param aTextQuadrant a vector pointing to the quadrant to draw the text in.
|
||||||
* text in
|
* @param aStrings list of strings to draw, top to bottom.
|
||||||
* @param aStrings list of strings to draw, top to bottom
|
|
||||||
*/
|
*/
|
||||||
void DrawTextNextToCursor( KIGFX::VIEW* aView, const VECTOR2D& aCursorPos,
|
void DrawTextNextToCursor( KIGFX::VIEW* aView, const VECTOR2D& aCursorPos,
|
||||||
const VECTOR2D& aTextQuadrant, const std::vector<wxString>& aStrings,
|
const VECTOR2D& aTextQuadrant, const std::vector<wxString>& aStrings,
|
||||||
|
|
|
@ -76,7 +76,7 @@ public:
|
||||||
|
|
||||||
COLOR4D GetDefaultColor( int aLayer );
|
COLOR4D GetDefaultColor( int aLayer );
|
||||||
|
|
||||||
void SetColor( int aLayer, COLOR4D aColor );
|
void SetColor( int aLayer, const COLOR4D& aColor );
|
||||||
|
|
||||||
const wxString& GetName() const { return m_displayName; }
|
const wxString& GetName() const { return m_displayName; }
|
||||||
void SetName( const wxString& aName ) { m_displayName = aName; }
|
void SetName( const wxString& aName ) { m_displayName = aName; }
|
||||||
|
|
|
@ -46,7 +46,8 @@ public:
|
||||||
bool SetLayersHotkeys( bool value );
|
bool SetLayersHotkeys( bool value );
|
||||||
|
|
||||||
// Fill the layer bitmap aLayerbmp with the layer color
|
// Fill the layer bitmap aLayerbmp with the layer color
|
||||||
static void DrawColorSwatch( wxBitmap& aLayerbmp, COLOR4D aBackground, COLOR4D aColor );
|
static void DrawColorSwatch( wxBitmap& aLayerbmp, const COLOR4D& aBackground,
|
||||||
|
const COLOR4D& aColor );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Return a color index from the layer id
|
// Return a color index from the layer id
|
||||||
|
|
|
@ -359,7 +359,7 @@ BOARD_DESIGN_SETTINGS& PCB_BASE_FRAME::GetDesignSettings() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_FRAME::SetDrawBgColor( COLOR4D aColor )
|
void PCB_BASE_FRAME::SetDrawBgColor( const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
m_drawBgColor= aColor;
|
m_drawBgColor= aColor;
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
|
@ -994,7 +994,7 @@ COLOR4D PCB_EDIT_FRAME::GetGridColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::SetGridColor( COLOR4D aColor )
|
void PCB_EDIT_FRAME::SetGridColor( const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
|
|
||||||
GetColorSettings()->SetColor( LAYER_GRID, aColor );
|
GetColorSettings()->SetColor( LAYER_GRID, aColor );
|
||||||
|
|
|
@ -148,9 +148,9 @@ public:
|
||||||
COLOR4D GetGridColor() override;
|
COLOR4D GetGridColor() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param aColor the new color of the grid.
|
* @param[in] aColor the new color of the grid.
|
||||||
*/
|
*/
|
||||||
void SetGridColor( COLOR4D aColor ) override;
|
void SetGridColor( const COLOR4D& aColor ) override;
|
||||||
|
|
||||||
// Configurations:
|
// Configurations:
|
||||||
void Process_Config( wxCommandEvent& event );
|
void Process_Config( wxCommandEvent& event );
|
||||||
|
|
|
@ -84,7 +84,7 @@ public:
|
||||||
void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
|
void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
|
||||||
void PlotFootprintGraphicItems( const FOOTPRINT* aFootprint );
|
void PlotFootprintGraphicItems( const FOOTPRINT* aFootprint );
|
||||||
void PlotFootprintGraphicItem( const FP_SHAPE* aShape );
|
void PlotFootprintGraphicItem( const FP_SHAPE* aShape );
|
||||||
void PlotFootprintTextItem( const FP_TEXT* aText, COLOR4D aColor );
|
void PlotFootprintTextItem( const FP_TEXT* aText, const COLOR4D& aColor );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reference, Value, and other fields are plotted only if the corresponding option is enabled.
|
* Reference, Value, and other fields are plotted only if the corresponding option is enabled.
|
||||||
|
@ -104,7 +104,7 @@ public:
|
||||||
* Unlike other items, a pad had not a specific color and be drawn as a non filled item
|
* Unlike other items, a pad had not a specific color and be drawn as a non filled item
|
||||||
* although the plot mode is filled color and plot mode are needed by this function.
|
* although the plot mode is filled color and plot mode are needed by this function.
|
||||||
*/
|
*/
|
||||||
void PlotPad( const PAD* aPad, COLOR4D aColor, OUTLINE_MODE aPlotMode );
|
void PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_MODE aPlotMode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot items like text and graphics but not tracks and footprints.
|
* Plot items like text and graphics but not tracks and footprints.
|
||||||
|
|
|
@ -82,7 +82,7 @@ COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, COLOR4D aColor, OUTLINE_MODE aPlotMode )
|
void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_MODE aPlotMode )
|
||||||
{
|
{
|
||||||
wxPoint shape_pos = aPad->ShapePos();
|
wxPoint shape_pos = aPad->ShapePos();
|
||||||
GBR_METADATA gbr_metadata;
|
GBR_METADATA gbr_metadata;
|
||||||
|
@ -364,12 +364,14 @@ void BRDITEMS_PLOTTER::PlotBoardGraphicItems()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aTextMod, COLOR4D aColor )
|
void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aTextMod, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
if( aColor == COLOR4D::WHITE )
|
COLOR4D color = aColor;
|
||||||
aColor = COLOR4D( LIGHTGRAY );
|
|
||||||
|
|
||||||
m_plotter->SetColor( aColor );
|
if( aColor == COLOR4D::WHITE )
|
||||||
|
color = COLOR4D( LIGHTGRAY );
|
||||||
|
|
||||||
|
m_plotter->SetColor( color );
|
||||||
|
|
||||||
// calculate some text parameters :
|
// calculate some text parameters :
|
||||||
wxSize size = aTextMod->GetTextSize();
|
wxSize size = aTextMod->GetTextSize();
|
||||||
|
|
Loading…
Reference in New Issue