本文整理汇总了C++中COLOR4D::ToColour方法的典型用法代码示例。如果您正苦于以下问题:C++ COLOR4D::ToColour方法的具体用法?C++ COLOR4D::ToColour怎么用?C++ COLOR4D::ToColour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COLOR4D
的用法示例。
在下文中一共展示了COLOR4D::ToColour方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildList
void SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList()
{
m_leftGridLayers->SetColSize( COLOR_COLNUM, 20 );
m_rightGridLayers->SetColSize( COLOR_COLNUM, 20 );
// Select a not show cell, to avoid a wrong cell selection for user
int row = 0;
wxString layername;
for( LSEQ ui_seq = m_brd->GetEnabledLayers().UIOrder(); ui_seq; ++ui_seq )
{
LAYER_ID layerid = *ui_seq;
if( !IsCopperLayer( layerid ) )
break;
COLOR4D color = GetLayerColor( layerid );
layername = GetLayerName( layerid );
if( row )
m_leftGridLayers->AppendRows( 1 );
m_leftGridLayers->SetCellBackgroundColour( row, COLOR_COLNUM, color.ToColour() );
m_leftGridLayers->SetCellValue( row, LAYERNAME_COLNUM, layername );
m_layersId.push_back( layerid );
if( m_frontLayer == layerid )
{
SetGridCursor( m_leftGridLayers, row, true );
m_leftRowSelected = row;
}
if( row )
m_rightGridLayers->AppendRows( 1 );
m_rightGridLayers->SetCellBackgroundColour ( row, COLOR_COLNUM,
color.ToColour() );
m_rightGridLayers->SetCellValue( row, LAYERNAME_COLNUM,
layername );
if( m_backLayer == layerid )
{
SetGridCursor( m_rightGridLayers, row, true );
m_rightRowSelected = row;
}
row++;
}
m_leftGridLayers->AutoSizeColumn(LAYERNAME_COLNUM);
m_rightGridLayers->AutoSizeColumn(LAYERNAME_COLNUM);
m_leftGridLayers->AutoSizeColumn(SELECT_COLNUM);
m_rightGridLayers->AutoSizeColumn(SELECT_COLNUM);
}
示例2: SetColor
void WIDGET_EESCHEMA_COLOR_CONFIG::SetColor( wxCommandEvent& event )
{
wxBitmapButton* button = (wxBitmapButton*) event.GetEventObject();
wxCHECK_RET( button != NULL, wxT( "Color button event object is NULL." ) );
COLORBUTTON* colorButton = (COLORBUTTON*) button->GetClientData();
wxCHECK_RET( colorButton != NULL, wxT( "Client data not set for color button." ) );
wxColourData colourData;
colourData.SetColour( currentColors[ colorButton->m_Layer ].ToColour() );
wxColourDialog *dialog = new wxColourDialog( this, &colourData );
COLOR4D newColor = COLOR4D::UNSPECIFIED;
if( dialog->ShowModal() == wxID_OK )
{
newColor = COLOR4D( dialog->GetColourData().GetColour() );
}
if( newColor == COLOR4D::UNSPECIFIED || currentColors[ colorButton->m_Layer ] == newColor )
return;
currentColors[ colorButton->m_Layer ] = newColor;
wxMemoryDC iconDC;
wxBitmap bitmap = button->GetBitmapLabel();
iconDC.SelectObject( bitmap );
iconDC.SetPen( *wxBLACK_PEN );
wxBrush brush;
brush.SetColour( newColor.ToColour() );
brush.SetStyle( wxBRUSHSTYLE_SOLID );
iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
button->SetBitmapLabel( bitmap );
button->Refresh();
Refresh( false );
}
示例3: SetGridCursor
void SELECT_COPPER_LAYERS_PAIR_DIALOG::SetGridCursor( wxGrid* aGrid, int aRow,
bool aEnable )
{
if( aEnable )
{
LAYER_ID layerid = m_layersId[aRow];
COLOR4D color = GetLayerColor( layerid );
aGrid->SetCellValue( aRow, SELECT_COLNUM, wxT("X") );
aGrid->SetCellBackgroundColour( aRow, SELECT_COLNUM, color.ToColour() );
aGrid->SetGridCursor( aRow, LAYERNAME_COLNUM );
}
else
{
aGrid->SetCellValue( aRow, SELECT_COLNUM, wxEmptyString );
aGrid->SetCellBackgroundColour( aRow, SELECT_COLNUM,
aGrid->GetDefaultCellBackgroundColour() );
aGrid->SetGridCursor( aRow, LAYERNAME_COLNUM );
}
}
示例4: ReDraw
void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
{
BASE_SCREEN* Screen = GetScreen();
if( Screen == NULL )
return;
COLOR4D bgColor = GetParent()->GetDrawBgColor();
// TODO(JE): Is this correct?
if( bgColor.GetBrightness() > 0.5 )
{
g_XorMode = GR_NXOR;
g_GhostColor = BLACK;
}
else
{
g_XorMode = GR_XOR;
g_GhostColor = WHITE;
}
GRResetPenAndBrush( DC );
DC->SetBackground( wxBrush( bgColor.ToColour() ) );
DC->SetBackgroundMode( wxSOLID );
if( erasebg )
EraseScreen( DC );
GetParent()->RedrawActiveWindow( DC, erasebg );
// Verfies that the clipping is working correctly. If these two sets of numbers are
// not the same or really close. The clipping algorithms are broken.
wxLogTrace( kicadTraceCoords,
wxT( "Clip box: (%d, %d, %d, %d), Draw extents (%d, %d, %d, %d)" ),
m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
DC->MinX(), DC->MinY(), DC->MaxX(), DC->MaxY() );
}
示例5: CreateControls
void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls()
{
wxStaticText* label;
int buttonId = 1800;
m_mainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
SetSizer( m_mainBoxSizer );
BUTTONINDEX* groups = buttonGroups;
wxBoxSizer* columnBoxSizer = NULL;
while( groups->m_Buttons != NULL )
{
COLORBUTTON* buttons = groups->m_Buttons;
columnBoxSizer = new wxBoxSizer( wxVERTICAL );
m_mainBoxSizer->Add( columnBoxSizer, 1, wxALIGN_TOP | wxLEFT, 5 );
wxBoxSizer* rowBoxSizer = new wxBoxSizer( wxHORIZONTAL );
columnBoxSizer->Add( rowBoxSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
// Add a text string to identify the column of color select buttons.
label = new wxStaticText( this, wxID_ANY, groups->m_Name );
// Make the column label font bold.
wxFont font( label->GetFont() );
font.SetWeight( wxFONTWEIGHT_BOLD );
label->SetFont( font );
rowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
while( buttons->m_Layer >= 0 )
{
rowBoxSizer = new wxBoxSizer( wxHORIZONTAL );
columnBoxSizer->Add( rowBoxSizer, 0, wxGROW | wxALL, 0 );
COLOR4D color = GetLayerColor( SCH_LAYER_ID( buttons->m_Layer ) );
currentColors[ buttons->m_Layer ] = color;
wxMemoryDC iconDC;
wxBitmap bitmap( m_butt_size_pix );
iconDC.SelectObject( bitmap );
iconDC.SetPen( *wxBLACK_PEN );
wxBrush brush;
brush.SetColour( color.ToColour() );
brush.SetStyle( wxBRUSHSTYLE_SOLID );
iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, m_butt_size_pix.x, m_butt_size_pix.y );
wxBitmapButton* bitmapButton = new wxBitmapButton(
this, buttonId, bitmap, wxDefaultPosition,
m_butt_size_pix + m_butt_border_pix + wxSize( 1, 1 ) );
bitmapButton->SetClientData( (void*) buttons );
rowBoxSizer->Add( bitmapButton, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
label = new wxStaticText( this, wxID_ANY, wxGetTranslation( buttons->m_Name ) );
rowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
buttonId += 1;
buttons++;
}
groups++;
}
Connect( 1800, buttonId, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIDGET_EESCHEMA_COLOR_CONFIG::SetColor ) );
// Dialog now needs to be resized, but the associated command is found elsewhere.
}
示例6: CreateControls
void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls()
{
wxStaticText* label;
int buttonId = 1800;
m_mainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
SetSizer( m_mainBoxSizer );
BUTTONINDEX* groups = buttonGroups;
wxBoxSizer* columnBoxSizer = NULL;
while( groups->m_Buttons != NULL )
{
COLORBUTTON* buttons = groups->m_Buttons;
columnBoxSizer = new wxBoxSizer( wxVERTICAL );
m_mainBoxSizer->Add( columnBoxSizer, 1, wxALIGN_TOP | wxLEFT | wxTOP, 5 );
wxBoxSizer* rowBoxSizer = new wxBoxSizer( wxHORIZONTAL );
columnBoxSizer->Add( rowBoxSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
// Add a text string to identify the column of color select buttons.
label = new wxStaticText( this, wxID_ANY, groups->m_Name );
// Make the column label font bold.
wxFont font( label->GetFont() );
font.SetWeight( wxFONTWEIGHT_BOLD );
label->SetFont( font );
rowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
while( buttons->m_Layer >= 0 )
{
rowBoxSizer = new wxBoxSizer( wxHORIZONTAL );
columnBoxSizer->Add( rowBoxSizer, 0, wxGROW | wxALL, 0 );
COLOR4D color = GetLayerColor( LAYERSCH_ID( buttons->m_Layer ) );
currentColors[ buttons->m_Layer ] = color;
wxMemoryDC iconDC;
wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
iconDC.SelectObject( bitmap );
iconDC.SetPen( *wxBLACK_PEN );
wxBrush brush;
brush.SetColour( color.ToColour() );
brush.SetStyle( wxBRUSHSTYLE_SOLID );
iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
wxBitmapButton* bitmapButton = new wxBitmapButton(
this, buttonId, bitmap, wxDefaultPosition,
wxSize( BUTT_SIZE_X+8, BUTT_SIZE_Y+6 ) );
bitmapButton->SetClientData( (void*) buttons );
rowBoxSizer->Add( bitmapButton, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
label = new wxStaticText( this, wxID_ANY, wxGetTranslation( buttons->m_Name ) );
rowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
buttonId += 1;
buttons++;
}
groups++;
}
COLOR4D bgColor = GetDrawFrame()->GetDrawBgColor();
wxMemoryDC iconDC;
wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
iconDC.SelectObject( bitmap );
iconDC.SetPen( *wxBLACK_PEN );
wxBrush brush;
brush.SetColour( bgColor.ToColour() );
brush.SetStyle( wxBRUSHSTYLE_SOLID );
iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
buttonId++;
wxBitmapButton* selBgColorBtn = new wxBitmapButton(
this, buttonId, bitmap, wxDefaultPosition,
wxSize( BUTT_SIZE_X + 8, BUTT_SIZE_Y + 6 ) );
selBgColorBtn->SetClientData( (void*) &bgColorButton );
Connect( 1800, buttonId, wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler( WIDGET_EESCHEMA_COLOR_CONFIG::SetColor ) );
wxStaticText* bgColorLabel = new wxStaticText( this, wxID_ANY, _( "Background Color" ) );
wxFont font( bgColorLabel->GetFont() );
font.SetWeight( wxFONTWEIGHT_BOLD );
bgColorLabel->SetFont( font );
if( columnBoxSizer )
{
// Add a spacer to improve appearance.
columnBoxSizer->AddSpacer( 5 );
columnBoxSizer->Add( bgColorLabel, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
columnBoxSizer->Add( selBgColorBtn, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
}
//.........这里部分代码省略.........