mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Render transparent layer colors over the correct background.
This fixes the layer comboboxes, the copper zones properties dialog, and the differental-pair icon in the htoolbar. Fixes: lp:1741049 * https://bugs.launchpad.net/kicad/+bug/1741049
This commit is contained in:
parent
6014307d06
commit
e1c01e1e7f
@ -54,11 +54,20 @@ void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer )
|
|||||||
|
|
||||||
// Prepare Bitmap
|
// Prepare Bitmap
|
||||||
bmpDC.SelectObject( aLayerbmp );
|
bmpDC.SelectObject( aLayerbmp );
|
||||||
brush.SetColour( GetLayerColor( aLayer ).ToColour() );
|
|
||||||
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
|
||||||
|
|
||||||
|
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
||||||
|
COLOR4D backgroundColor = GetLayerColor( LAYER_PCB_BACKGROUND );
|
||||||
|
if( backgroundColor != COLOR4D::UNSPECIFIED )
|
||||||
|
{
|
||||||
|
brush.SetColour( backgroundColor.WithAlpha(1.0).ToColour() );
|
||||||
|
bmpDC.SetBrush( brush );
|
||||||
|
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
|
||||||
|
}
|
||||||
|
|
||||||
|
brush.SetColour( GetLayerColor( aLayer ).ToColour() );
|
||||||
bmpDC.SetBrush( brush );
|
bmpDC.SetBrush( brush );
|
||||||
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
|
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
|
||||||
|
|
||||||
bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
|
bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
|
||||||
bmpDC.SetPen( *wxBLACK_PEN );
|
bmpDC.SetPen( *wxBLACK_PEN );
|
||||||
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
|
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
|
||||||
|
@ -795,7 +795,7 @@ LSEQ LSET::UIOrder() const
|
|||||||
|
|
||||||
PCB_LAYER_ID ToLAYER_ID( int aLayer )
|
PCB_LAYER_ID ToLAYER_ID( int aLayer )
|
||||||
{
|
{
|
||||||
wxASSERT( unsigned( aLayer ) < PCB_LAYER_ID_COUNT );
|
wxASSERT( unsigned( aLayer ) < GAL_LAYER_ID_END );
|
||||||
return PCB_LAYER_ID( aLayer );
|
return PCB_LAYER_ID( aLayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,6 +555,8 @@ void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor )
|
|||||||
view->UpdateLayerColor( GetNetnameLayer( aLayer ) );
|
view->UpdateLayerColor( GetNetnameLayer( aLayer ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myframe->ReCreateHToolbar();
|
||||||
|
|
||||||
myframe->GetCanvas()->Refresh();
|
myframe->GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,6 +650,8 @@ void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
|
|||||||
galCanvas->ForceRefresh();
|
galCanvas->ForceRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myframe->ReCreateHToolbar();
|
||||||
|
|
||||||
myframe->GetCanvas()->Refresh();
|
myframe->GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,8 +115,9 @@ private:
|
|||||||
* Function makeLayerBitmap
|
* Function makeLayerBitmap
|
||||||
* creates the colored rectangle bitmaps used in the layer selection widget.
|
* creates the colored rectangle bitmaps used in the layer selection widget.
|
||||||
* @param aColor is the color to fill the rectangle with.
|
* @param aColor is the color to fill the rectangle with.
|
||||||
|
* @param aBackground is the background color in case aColor is transparent.
|
||||||
*/
|
*/
|
||||||
wxBitmap makeLayerBitmap( COLOR4D aColor );
|
wxBitmap makeLayerBitmap( COLOR4D aColor, COLOR4D aBackground );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -244,6 +245,7 @@ void DIALOG_COPPER_ZONE::initDialog()
|
|||||||
|
|
||||||
LSET cu_set = LSET::AllCuMask( board->GetCopperLayerCount() );
|
LSET cu_set = LSET::AllCuMask( board->GetCopperLayerCount() );
|
||||||
|
|
||||||
|
COLOR4D backgroundColor = m_Parent->Settings().Colors().GetLayerColor( LAYER_PCB_BACKGROUND );
|
||||||
for( LSEQ cu_stack = cu_set.UIOrder(); cu_stack; ++cu_stack, imgIdx++ )
|
for( LSEQ cu_stack = cu_set.UIOrder(); cu_stack; ++cu_stack, imgIdx++ )
|
||||||
{
|
{
|
||||||
PCB_LAYER_ID layer = *cu_stack;
|
PCB_LAYER_ID layer = *cu_stack;
|
||||||
@ -256,7 +258,7 @@ void DIALOG_COPPER_ZONE::initDialog()
|
|||||||
|
|
||||||
COLOR4D layerColor = m_Parent->Settings().Colors().GetLayerColor( layer );
|
COLOR4D layerColor = m_Parent->Settings().Colors().GetLayerColor( layer );
|
||||||
|
|
||||||
imageList->Add( makeLayerBitmap( layerColor ) );
|
imageList->Add( makeLayerBitmap( layerColor, backgroundColor ) );
|
||||||
|
|
||||||
int itemIndex = m_LayerSelectionCtrl->InsertItem(
|
int itemIndex = m_LayerSelectionCtrl->InsertItem(
|
||||||
m_LayerSelectionCtrl->GetItemCount(), msg, imgIdx );
|
m_LayerSelectionCtrl->GetItemCount(), msg, imgIdx );
|
||||||
@ -682,15 +684,20 @@ void DIALOG_COPPER_ZONE::buildAvailableListOfNets()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxBitmap DIALOG_COPPER_ZONE::makeLayerBitmap( COLOR4D aColor )
|
wxBitmap DIALOG_COPPER_ZONE::makeLayerBitmap( COLOR4D aColor, COLOR4D aBackground )
|
||||||
{
|
{
|
||||||
wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
|
wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
|
||||||
wxBrush brush;
|
wxBrush brush;
|
||||||
wxMemoryDC iconDC;
|
wxMemoryDC iconDC;
|
||||||
|
|
||||||
iconDC.SelectObject( bitmap );
|
iconDC.SelectObject( bitmap );
|
||||||
brush.SetColour( aColor.ToColour() );
|
|
||||||
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
||||||
|
brush.SetColour( aBackground.WithAlpha(1.0).ToColour() );
|
||||||
|
iconDC.SetBrush( brush );
|
||||||
|
iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
|
||||||
|
|
||||||
|
brush.SetColour( aColor.ToColour() );
|
||||||
iconDC.SetBrush( brush );
|
iconDC.SetBrush( brush );
|
||||||
iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
|
iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
|
||||||
|
|
||||||
|
@ -94,12 +94,13 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
|
|||||||
{
|
{
|
||||||
int ii, jj;
|
int ii, jj;
|
||||||
COLOR4D active_layer_color, Route_Layer_TOP_color,
|
COLOR4D active_layer_color, Route_Layer_TOP_color,
|
||||||
Route_Layer_BOTTOM_color, via_color;
|
Route_Layer_BOTTOM_color, via_color, background_color;
|
||||||
bool change = false;
|
bool change = false;
|
||||||
|
|
||||||
static int previous_requested_scale;
|
static int previous_requested_scale;
|
||||||
static COLOR4D previous_active_layer_color, previous_Route_Layer_TOP_color,
|
static COLOR4D previous_active_layer_color, previous_Route_Layer_TOP_color,
|
||||||
previous_Route_Layer_BOTTOM_color, previous_via_color;
|
previous_Route_Layer_BOTTOM_color, previous_via_color,
|
||||||
|
previous_background_color;
|
||||||
|
|
||||||
const int requested_scale = GetIconScale();
|
const int requested_scale = GetIconScale();
|
||||||
|
|
||||||
@ -144,6 +145,14 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
|
|||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
background_color = Settings().Colors().GetItemColor( LAYER_PCB_BACKGROUND );
|
||||||
|
|
||||||
|
if( previous_background_color != background_color )
|
||||||
|
{
|
||||||
|
previous_background_color = background_color;
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
|
||||||
if( !change && LayerPairBitmap )
|
if( !change && LayerPairBitmap )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -154,9 +163,15 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
|
|||||||
*/
|
*/
|
||||||
wxMemoryDC iconDC;
|
wxMemoryDC iconDC;
|
||||||
iconDC.SelectObject( *LayerPairBitmap );
|
iconDC.SelectObject( *LayerPairBitmap );
|
||||||
|
wxBrush brush;
|
||||||
wxPen pen;
|
wxPen pen;
|
||||||
int buttonColor = -1;
|
int buttonColor = -1;
|
||||||
|
|
||||||
|
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
||||||
|
brush.SetColour( background_color.WithAlpha(1.0).ToColour() );
|
||||||
|
iconDC.SetBrush( brush );
|
||||||
|
iconDC.DrawRectangle( 0, 0, BM_LAYERICON_SIZE, BM_LAYERICON_SIZE );
|
||||||
|
|
||||||
for( ii = 0; ii < BM_LAYERICON_SIZE; ii++ )
|
for( ii = 0; ii < BM_LAYERICON_SIZE; ii++ )
|
||||||
{
|
{
|
||||||
for( jj = 0; jj < BM_LAYERICON_SIZE; jj++ )
|
for( jj = 0; jj < BM_LAYERICON_SIZE; jj++ )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user