本文整理汇总了C++中wxDC::GradientFillLinear方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::GradientFillLinear方法的具体用法?C++ wxDC::GradientFillLinear怎么用?C++ wxDC::GradientFillLinear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDC
的用法示例。
在下文中一共展示了wxDC::GradientFillLinear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawBackground
void FlatAuiTabArt::DrawBackground(wxDC& dc,
wxWindow* WXUNUSED(wnd),
const wxRect& rect)
{
// draw background
//Game Develop use a less visible gradient
wxColor top_color = noBgGradient ? *wxWHITE : gdAuiStepColour(m_base_colour, 120);
//Game Develop use a white background
wxColor bottom_color = *wxWHITE;
wxRect r;
if (m_flags &wxAUI_NB_BOTTOM)
r = wxRect(rect.x, rect.y, rect.width+2, rect.height);
// else if (m_flags &wxAUI_NB_LEFT) {}
// else if (m_flags &wxAUI_NB_RIGHT) {}
else //for wxAUI_NB_TOP
r = wxRect(rect.x, rect.y, rect.width+2, rect.height-3);
//Game Develop invert gradient for bottom
if (m_flags &wxAUI_NB_BOTTOM)
dc.GradientFillLinear(r, top_color, bottom_color, wxNORTH);
else //for wxAUI_NB_TOP
dc.GradientFillLinear(r, top_color, bottom_color, wxSOUTH);
// draw base lines
//Game Develop use a white background
dc.SetPen(m_base_colour);
int y = rect.GetHeight();
int w = rect.GetWidth();
if (m_flags &wxAUI_NB_BOTTOM)
{
//Game Develop use a white background
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRectangle(-1, 0, w+2, 4);
}
// else if (m_flags &wxAUI_NB_LEFT) {}
// else if (m_flags &wxAUI_NB_RIGHT) {}
else //for wxAUI_NB_TOP
{
//Game Develop use a white background
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRectangle(-1, y-4, w+2, 4);
}
}
示例2: DoEraseBackground
void VdkPanel::DoEraseBackground(wxDC &dc, const wxRect &rc) {
if (!m_gbi) {
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(m_bgBrush);
if (m_bi) {
if (m_bi->borderPen.IsOk()) {
dc.SetPen(m_bi->borderPen);
}
if (m_bi->bgColor.IsOk()) {
wxBrush bgBrush(m_bi->bgColor);
dc.SetBrush(bgBrush);
}
}
dc.DrawRectangle(rc);
} else {
VdkDcClippingRegionDestroyer destroyer(dc, rc);
m_Window->ResetDcOrigin(dc);
TranslateDC(dc);
dc.GradientFillLinear(m_Rect, m_gbi->beg, m_gbi->end, m_gbi->direction);
}
}
示例3: DrawBackground
void clAuiTabArt::DrawBackground(wxDC& dc,
wxWindow* WXUNUSED(wnd),
const wxRect& rect)
{
// draw background
wxColor top_color = m_base_colour;
wxColor bottom_color = m_base_colour;
wxRect r;
if (m_flags &wxAUI_NB_BOTTOM)
r = wxRect(rect.x, rect.y, rect.width+2, rect.height);
// TODO: else if (m_flags &wxAUI_NB_LEFT) {}
// TODO: else if (m_flags &wxAUI_NB_RIGHT) {}
else //for wxAUI_NB_TOP
r = wxRect(rect.x, rect.y, rect.width+2, rect.height-3);
dc.GradientFillLinear(r, top_color, bottom_color, wxSOUTH);
// draw base lines
dc.SetPen(m_border_pen);
int y = rect.GetHeight();
int w = rect.GetWidth();
if (m_flags &wxAUI_NB_BOTTOM) {
dc.SetBrush(m_bottom_rect_colour);
dc.DrawRectangle(-1, 0, w+2, 4);
}
// TODO: else if (m_flags &wxAUI_NB_LEFT) {}
// TODO: else if (m_flags &wxAUI_NB_RIGHT) {}
else { //for wxAUI_NB_TOP
dc.SetBrush(m_bottom_rect_colour);
dc.DrawRectangle(-1, y-4, w+2, 4);
}
}
示例4: Draw
void GradientAreaDraw::Draw(wxDC &dc, wxRect rc)
{
dc.GradientFillLinear(rc, m_colour1, m_colour2, m_dir);
dc.SetPen(m_borderPen);
dc.SetBrush(wxNoBrush);
dc.DrawRectangle(rc);
}
示例5: wxColour
void wxGD::Draw::GlossyGradient( wxDC &dc, wxRect &rect, wxColour &topStart,
wxColour &bottomStart, wxColour &bottomEnd,
wxColour &colour, bool hover )
{
wxColour topEnd = colour;
int r = colour.Red() + 45;
if( r > 255 ) r = 225;
int g = colour.Green() + 45;
if( g > 255 ) g = 225;
int b = colour.Blue() + 45;
if( b > 255) b = 225;
topStart = wxColour( (unsigned char)r, (unsigned char)g, (unsigned char)b );
r = colour.Red() - 75;
if( r < 0 ) r = 15;
g = colour.Green() - 75;
if( g < 0 ) g = 15;
b = colour.Blue() - 75;
if( b < 0 ) b = 15;
bottomStart = wxColour( (unsigned char)r, (unsigned char)g, (unsigned char)b );
r = colour.Red() - 15;
if( r < 0 ) r = 30;
g = colour.Green() - 15;
if( g < 0 ) g = 30;
b = colour.Blue() - 15;
if( b < 0 ) b = 30;
bottomEnd = wxColour( (unsigned char)r, (unsigned char)g, (unsigned char)b );
rect.SetHeight( rect.GetHeight() / 2 );
dc.GradientFillLinear( rect, topStart, topEnd, wxSOUTH );
rect.Offset( 0, rect.GetHeight() );
if( hover )
dc.GradientFillLinear( rect, bottomStart, topStart, wxSOUTH );
else
dc.GradientFillLinear( rect, bottomStart, topEnd, wxSOUTH );
}
示例6: DrawToolGroupBackground
void wxRibbonMetroArtProvider::DrawToolGroupBackground(wxDC& dc, wxWindow* WXUNUSED(wnd), const wxRect& rect)
{
// TODO: there is no DrawToolGroupSeparator method currently
wxRect line;
line.x = rect.GetRight() + 4;
line.y = rect.GetY() + 5;
line.width = 1;
line.height = rect.GetHeight() - 10;
dc.GradientFillLinear(line, wxColour(232, 234, 237), wxColour(178, 183, 189), wxSOUTH);
}
示例7: DrawTabCtrlBackground
void wxRibbonAUIArtProvider::DrawTabCtrlBackground(
wxDC& dc,
wxWindow* WXUNUSED(wnd),
const wxRect& rect)
{
wxRect gradient_rect(rect);
gradient_rect.height--;
dc.GradientFillLinear(gradient_rect, m_tab_ctrl_background_colour,
m_tab_ctrl_background_gradient_colour, wxSOUTH);
dc.SetPen(m_tab_border_pen);
dc.DrawLine(rect.x, rect.GetBottom(), rect.GetRight()+1, rect.GetBottom());
}
示例8: DrawGalleryButton
void wxRibbonAUIArtProvider::DrawGalleryButton(wxDC& dc, wxRect rect,
wxRibbonGalleryButtonState state, wxBitmap* bitmaps)
{
int extra_height = 0;
int extra_width = 0;
wxRect reduced_rect(rect);
reduced_rect.Deflate(1);
if(m_flags & wxRIBBON_BAR_FLOW_VERTICAL)
{
reduced_rect.width++;
extra_width = 1;
}
else
{
reduced_rect.height++;
extra_height = 1;
}
wxBitmap btn_bitmap;
switch(state)
{
case wxRIBBON_GALLERY_BUTTON_NORMAL:
dc.GradientFillLinear(reduced_rect,
m_gallery_button_background_colour,
m_gallery_button_background_gradient_colour, wxSOUTH);
btn_bitmap = bitmaps[0];
break;
case wxRIBBON_GALLERY_BUTTON_HOVERED:
dc.SetPen(m_gallery_item_border_pen);
dc.SetBrush(m_gallery_button_hover_background_brush);
dc.DrawRectangle(rect.x, rect.y, rect.width + extra_width,
rect.height + extra_height);
btn_bitmap = bitmaps[1];
break;
case wxRIBBON_GALLERY_BUTTON_ACTIVE:
dc.SetPen(m_gallery_item_border_pen);
dc.SetBrush(m_gallery_button_active_background_brush);
dc.DrawRectangle(rect.x, rect.y, rect.width + extra_width,
rect.height + extra_height);
btn_bitmap = bitmaps[2];
break;
case wxRIBBON_GALLERY_BUTTON_DISABLED:
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(m_gallery_button_disabled_background_brush);
dc.DrawRectangle(reduced_rect.x, reduced_rect.y, reduced_rect.width,
reduced_rect.height);
btn_bitmap = bitmaps[3];
break;
}
dc.DrawBitmap(btn_bitmap, reduced_rect.x + reduced_rect.width / 2 - 2,
(rect.y + rect.height / 2) - 2, true);
}
示例9: DrawToolGroupBackground
void wxRibbonAUIArtProvider::DrawToolGroupBackground(
wxDC& dc,
wxWindow* WXUNUSED(wnd),
const wxRect& rect)
{
dc.SetPen(m_toolbar_border_pen);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
wxRect bg_rect(rect);
bg_rect.Deflate(1);
dc.GradientFillLinear(bg_rect, m_tool_background_colour,
m_tool_background_gradient_colour, wxSOUTH);
}
示例10: Render
/**
* Render the event
*/
void CommentEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform &)
{
#if !defined(GD_NO_WX_GUI)
x += 1; //Small border
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
renderingHelper->GetHTMLRenderer().SetDC(&dc);
renderingHelper->GetHTMLRenderer().SetStandardFonts(renderingHelper->GetNiceFont().GetPointSize());
//Prepare HTML texts
gd::String str1 = "<FONT color="+wxColour(textR, textG, textB).GetAsString(wxC2S_HTML_SYNTAX)+">"+renderingHelper->GetHTMLText(com1)+"</FONT>";
gd::String str2 = "<FONT color="+wxColour(textR, textG, textB).GetAsString(wxC2S_HTML_SYNTAX)+">"+renderingHelper->GetHTMLText(com2)+"</FONT>";
//Calculate space constraints
const int sideSeparation = 3; //Spacing between text and borders
unsigned int textWidth = com2.empty() ? width-sideSeparation*2 : width/2-sideSeparation*2;
renderingHelper->GetHTMLRenderer().SetSize(textWidth, 9999);
renderingHelper->GetHTMLRenderer().SetHtmlText(str1);
unsigned int text1Height = renderingHelper->GetHTMLRenderer().GetTotalHeight();
renderingHelper->GetHTMLRenderer().SetHtmlText(str2);
unsigned int text2Height = renderingHelper->GetHTMLRenderer().GetTotalHeight();
//Prepare background
dc.SetBrush(wxBrush(wxColour(r, v, b), wxBRUSHSTYLE_TRANSPARENT));
dc.SetPen(wxPen(wxColour(r/2, v/2, b/2), 1));
//Draw the background
unsigned int height = std::max(text1Height, text2Height)+sideSeparation*2;
height = std::max(height, (unsigned int)15);
wxRect rectangle(x, y, width-2, height);
dc.GradientFillLinear(rectangle, wxColour(r+20 > 255 ? 255 : r+20, v+20 > 255 ? 255 : v+20, b+20 > 255 ? 255 : b+20), wxColour(r, v, b), wxSOUTH);
dc.DrawRectangle(rectangle);
//Draw text
{
renderingHelper->GetHTMLRenderer().SetHtmlText(str1);
wxArrayInt neededArray;
renderingHelper->GetHTMLRenderer().Render(x + sideSeparation, y+sideSeparation, neededArray);
}
if ( !com2.empty() ) //Optional text
{
renderingHelper->GetHTMLRenderer().SetHtmlText(str2);
wxArrayInt neededArray;
renderingHelper->GetHTMLRenderer().Render(x + sideSeparation + textWidth + sideSeparation, y+sideSeparation, neededArray);
}
#endif
}
示例11: drawSash
void TripleSplitter::drawSash(wxDC& dc)
{
const int centerPosX = getCenterPosX();
const int centerWidth = getCenterWidth();
auto draw = [&](wxRect rect)
{
const int sash2ndHalf = 3;
rect.width -= sash2ndHalf;
dc.GradientFillLinear(rect, COLOR_SASH_GRADIENT_FROM, COLOR_SASH_GRADIENT_TO, wxEAST);
rect.x += rect.width;
rect.width = sash2ndHalf;
dc.GradientFillLinear(rect, COLOR_SASH_GRADIENT_FROM, COLOR_SASH_GRADIENT_TO, wxWEST);
static_assert(SASH_SIZE > sash2ndHalf, "");
};
const wxRect rectSashL(centerPosX, 0, SASH_SIZE, GetClientRect().height);
const wxRect rectSashR(centerPosX + centerWidth - SASH_SIZE, 0, SASH_SIZE, GetClientRect().height);
draw(rectSashL);
draw(rectSashR);
}
示例12: render
void UICalculateDistance::render(wxDC& dc)
{
int client_h = 0;
int client_w = 0;
GetClientSize (&client_w, &client_h);
if (!(ApplicationConfiguration::GetInstance()->IsThemed()))
{
wxString str(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient2Colour().c_str(),wxConvUTF8);
wxColour c_pen = (wxColour)str;
wxString str2(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient1Colour().c_str(),wxConvUTF8);
wxColour c_backg = (wxColour)str2;
wxString str3(ApplicationConfiguration::GetInstance()->GetBackgroundColour().c_str(),wxConvUTF8);
wxColour c_brush = (wxColour)str3;
wxString str4(cpw::ApplicationConfiguration::GetInstance()->GetFontLightColour().c_str(),wxConvUTF8);
dc.SetTextForeground((wxColour)str4);
dc.SetPen(wxPen(c_pen));
dc.SetBrush(wxBrush(c_brush));
dc.GradientFillLinear( wxRect(0,0,client_w,client_h), c_backg, c_pen, wxSOUTH);
}
std::ostringstream wop,wop2,wop3,wop4;
wop << std::fixed << std::setprecision(3) << (distance*factor);
double aux = 0.000;
Position_x_Edit->GetValue().Trim().ToDouble(&aux);
wop2 << std::fixed << std::setprecision (3) << aux;
Position_y_Edit->GetValue().Trim().ToDouble(&aux);
wop3 << std::fixed << std::setprecision (3) << aux;
Position_z_Edit->GetValue().Trim().ToDouble(&aux);
wop4 << std::fixed << std::setprecision (3) << aux;
wxPoint box1_first(20-2,45-9);
wxPoint box1_last(368,45+22);
dc.DrawRoundedRectangle(box1_first.x, box1_first.y, box1_last.x-box1_first.x, box1_last.y-box1_first.y,3.1f);
dc.DrawRotatedText(wxString(wop2.str().c_str(),wxConvUTF8),89+10-30-5,45, 0);
dc.DrawRotatedText(wxString(wop3.str().c_str(),wxConvUTF8),89+10-30-5+92+10+15-3,45, 0);
dc.DrawRotatedText(wxString(wop4.str().c_str(),wxConvUTF8),89+10-30-5+184+20+15+10-2,45, 0);
wxFont font(10, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma"));
wxFont font_ = dc.GetFont();
dc.SetFont(font);
dc.DrawRotatedText(_T("Distance:"),20,12, 0);
dc.DrawRotatedText(wxString(wop.str().c_str(),wxConvUTF8),20+65,12, 0);
dc.SetFont(font_);
}
示例13: DrawBackground
void DefaultTabArt::DrawBackground(wxDC& dc,
wxWindow* WXUNUSED(wnd),
const wxRect& rect)
{
// draw background
m_baseColour = wxColour(75,75,75);
wxColor top_color = m_baseColour.ChangeLightness(90);
wxColor bottom_color = m_baseColour.ChangeLightness(110);
wxRect r;
if (m_flags &wxAUI_NB_BOTTOM)
r = wxRect(rect.x, rect.y, rect.width+2, rect.height);
// TODO: else if (m_flags &wxAUI_NB_LEFT) {}
// TODO: else if (m_flags &wxAUI_NB_RIGHT) {}
else //for wxAUI_NB_TOP
r = wxRect(rect.x, rect.y, rect.width+2, rect.height-3);
dc.GradientFillLinear(r, top_color, bottom_color, wxSOUTH);
// draw base lines
m_borderPen = top_color;
dc.SetPen(m_borderPen);
int y = rect.GetHeight();
int w = rect.GetWidth();
if (m_flags &wxAUI_NB_BOTTOM)
{
dc.SetBrush(wxBrush(bottom_color));
dc.DrawRectangle(-1, 0, w+2, 4);
}
// TODO: else if (m_flags &wxAUI_NB_LEFT) {}
// TODO: else if (m_flags &wxAUI_NB_RIGHT) {}
else //for wxAUI_NB_TOP
{
dc.SetBrush(m_baseColourBrush);
dc.SetBrush(m_baseColour);
dc.DrawRectangle(-1, y-4, w+2, 4);
}
}
示例14: render
void UIEAttributes::render(wxDC& dc)
{
int client_h = 0;
int client_w = 0;
GetClientSize (&client_w, &client_h);
if (!(cpw::ApplicationConfiguration::GetInstance()->IsThemed()))
{
wxColour c_pen = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient2Colour().c_str(),wxConvUTF8);
wxColour c_backg = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient1Colour().c_str(),wxConvUTF8);
wxColour c_brush = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundColour().c_str(),wxConvUTF8);
dc.SetTextForeground(wxColour(wxString(cpw::ApplicationConfiguration::GetInstance()->GetFontLightColour().c_str(),wxConvUTF8)));
dc.SetPen(wxPen(c_pen));
dc.SetBrush(wxBrush(c_brush));
dc.GradientFillLinear( wxRect(0,0,client_w,client_h), c_backg, c_pen, wxSOUTH);
}
dc.DrawRotatedText(_T("Name: "),20,163, 0);
dc.DrawRotatedText(_T("Type: "),20,188, 0);
dc.DrawRotatedText(_T("Value:"),20,213, 0);
}
示例15: render
void UIElementPrimitive::render(wxDC& dc)
{
int client_h = 0;
int client_w = 0;
GetClientSize (&client_w, &client_h);
if (!(cpw::ApplicationConfiguration::GetInstance()->IsThemed()))
{
wxColour c_pen = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient2Colour().c_str(),wxConvUTF8);
wxColour c_backg = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient1Colour().c_str(),wxConvUTF8);
wxColour c_brush = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundColour().c_str(),wxConvUTF8);
dc.SetTextForeground(wxColour(wxString(cpw::ApplicationConfiguration::GetInstance()->GetFontLightColour().c_str(),wxConvUTF8)));
dc.SetPen(wxPen(c_pen));
dc.SetBrush(wxBrush(c_brush));
dc.GradientFillLinear( wxRect(0,0,client_w,client_h), c_backg, c_pen, wxSOUTH);
}
dc.DrawRotatedText(_T("Name: "),20,20, 0);
dc.DrawRotatedText(_T("Model: "),20,40, 0);
dc.DrawRotatedText(_T("Icon:"),20,60, 0);
dc.DrawRotatedText(_T("Font:"),20,80, 0);
dc.DrawRotatedText(_T("Description"),20,100, 0);
}