27#include <wx/dcmemory.h>
42 bmpDC.SelectObject( aLayerbmp );
44 brush.SetStyle( wxBRUSHSTYLE_SOLID );
49 bmpDC.SetBrush( brush );
50 bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
53 brush.SetColour( aColor.
ToColour() );
54 bmpDC.SetBrush( brush );
55 bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
57 bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
58 bmpDC.SetPen( *wxBLACK_PEN );
59 bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
78 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3 },
79 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3 },
80 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3 },
81 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3 },
82 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3 },
83 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3 },
84 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3 },
85 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3 },
86 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3,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 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
101 { 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
109 const COLOR4D& aBottomColor,
int aScale )
115 iconDC.SelectObject( *layerPairBitmap );
118 int buttonColor = -1;
120 brush.SetStyle( wxBRUSHSTYLE_SOLID );
122 iconDC.SetBrush( brush );
136 case 2: pen.SetColour( aTopColor.
ToColour() );
break;
137 case 3: pen.SetColour( aBottomColor.
ToColour() );
break;
141 iconDC.SetPen( pen );
144 iconDC.DrawPoint( jj, ii );
150 iconDC.SelectObject( wxNullBitmap );
153 wxImage
image = layerPairBitmap->ConvertToImage();
156 image.Rescale( aScale *
image.GetWidth() / 4, aScale *
image.GetHeight() / 4,
157 wxIMAGE_QUALITY_NEAREST );
159 return std::make_unique<wxBitmap>(
image );
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
wxColour ToColour() const
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
static std::unique_ptr< wxBitmap > CreateLayerPairIcon(const KIGFX::COLOR4D &aBgColor, const KIGFX::COLOR4D &aTopColor, const KIGFX::COLOR4D &aBottomColor, int aScale)
Create a layer pair "side-by-side swatch" icon.
static void DrawColorSwatch(wxBitmap &aLayerbmp, const COLOR4D &aBackground, const COLOR4D &aColor)
virtual COLOR4D getLayerColor(int aLayer) const =0
@ LAYER_PCB_BACKGROUND
PCB background color.
static const char s_BitmapLayerIcon[BM_LAYERICON_SIZE][BM_LAYERICON_SIZE]
static COLOR4D ICON_WHITE
static constexpr unsigned BM_LAYERICON_SIZE
static COLOR4D ICON_BLACK
The Cairo implementation of the graphics abstraction layer.