本文整理汇总了C++中SetBrush函数的典型用法代码示例。如果您正苦于以下问题:C++ SetBrush函数的具体用法?C++ SetBrush怎么用?C++ SetBrush使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetBrush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTextExtent
void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush& backgroundBrush )
{
wxGraphicsBrush formerBrush = m_brush;
wxGraphicsPen formerPen = m_pen;
wxDouble width;
wxDouble height;
wxDouble descent;
wxDouble externalLeading;
GetTextExtent( str , &width, &height, &descent, &externalLeading );
SetBrush( backgroundBrush );
// to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape
SetPen( wxNullGraphicsPen );
wxGraphicsPath path = CreatePath();
path.MoveToPoint( x , y );
path.AddLineToPoint( (int) (x + sin(angle) * height) , (int) (y + cos(angle) * height) );
path.AddLineToPoint(
(int) (x + sin(angle) * height + cos(angle) * width) ,
(int) (y + cos(angle) * height - sin(angle) * width));
path.AddLineToPoint((int) (x + cos(angle) * width) , (int) (y - sin(angle) * width) );
FillPath( path );
DrawText( str, x ,y, angle);
SetBrush( formerBrush );
SetPen( formerPen );
}
示例2: GetTextExtent
void
wxGraphicsContext::DoDrawFilledText(const wxString &str,
wxDouble x,
wxDouble y,
const wxGraphicsBrush& backgroundBrush)
{
wxGraphicsBrush formerBrush = m_brush;
wxGraphicsPen formerPen = m_pen;
wxDouble width;
wxDouble height;
wxDouble descent;
wxDouble externalLeading;
GetTextExtent( str , &width, &height, &descent, &externalLeading );
SetBrush( backgroundBrush );
// to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape
SetPen( wxNullGraphicsPen );
wxGraphicsPath path = CreatePath();
path.AddRectangle( x , y, width, height );
FillPath( path );
DrawText( str, x ,y);
SetBrush( formerBrush );
SetPen( formerPen );
}
示例3: SetBrush
void wxGraphicsContext::SetBrush( const wxBrush& brush )
{
if ( !brush.Ok() || brush.GetStyle() == wxTRANSPARENT )
SetBrush( wxNullGraphicsBrush );
else
SetBrush( CreateBrush( brush ) );
}
示例4: SetBrush
void ocpnDC::Clear()
{
if( dc ) dc->Clear();
else {
wxBrush tmpBrush = m_brush;
int w, h;
SetBrush( wxBrush( glcanvas->GetBackgroundColour() ) );
glcanvas->GetSize( &w, &h );
DrawRectangle( 0, 0, w, h );
SetBrush( tmpBrush );
}
}
示例5: SetBrush
void ODDC::Clear()
{
if( dc ) dc->Clear();
else {
#ifdef ocpnUSE_GL
wxBrush tmpBrush = m_brush;
int w, h;
SetBrush( wxBrush( glcanvas->GetBackgroundColour() ) );
glcanvas->GetSize( &w, &h );
DrawRectangle( 0, 0, w, h );
SetBrush( tmpBrush );
#endif
}
}
示例6: Pattern
void Painter::Init () {
if (solid == nil) {
solid = new Pattern(0xffff);
clear = new Pattern(0);
lightgray = new Pattern(0x8020);
gray = new Pattern(0xa5a5);
darkgray = new Pattern(0xfafa);
single = new Brush(0xffff, 0);
}
foreground = nil;
background = nil;
pattern = nil;
br = nil;
font = nil;
style = 0;
matrix = nil;
SetColors(black, white);
SetPattern(solid);
FillBg(true);
SetBrush(single);
SetFont(stdfont);
SetStyle(Plain);
SetOrigin(0, 0);
MoveTo(0, 0);
}
示例7: XFreeGC
void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
{
m_bitmap = bitmap;
if (m_gc)
XFreeGC((Display*) m_display, (GC) m_gc);
m_gc = (WXGC) NULL;
if (m_bitmap.Ok() && (bitmap.GetDisplay() == m_display))
{
m_pixmap = m_bitmap.GetDrawable();
Display* display = (Display*) m_display;
XGCValues gcvalues;
gcvalues.foreground = BlackPixel (display, DefaultScreen (display));
gcvalues.background = WhitePixel (display, DefaultScreen (display));
gcvalues.graphics_exposures = False;
gcvalues.subwindow_mode = IncludeInferiors;
gcvalues.line_width = 1;
m_gc = (WXGC) XCreateGC (display, (Drawable)m_pixmap/* RootWindow (display, DefaultScreen (display)) */,
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
&gcvalues);
m_backgroundPixel = gcvalues.background;
m_ok = true;
SetBrush (* wxWHITE_BRUSH);
SetPen (* wxBLACK_PEN);
}
else
{
m_ok = false;
m_pixmap = (WXPixmap) 0;
};
}
示例8: wxWindowDCImpl
wxMemoryDCImpl::wxMemoryDCImpl(wxMemoryDC *owner, wxDC* dc)
: wxWindowDCImpl(owner)
{
m_ok = true;
if (dc && dc->IsKindOf(CLASSINFO(wxWindowDC)))
m_display = ((wxWindowDCImpl *)dc->GetImpl())->GetDisplay();
else
m_display = wxGetDisplay();
Display* display = (Display*) m_display;
XGCValues gcvalues;
gcvalues.foreground = BlackPixel (display, DefaultScreen (display));
gcvalues.background = WhitePixel (display, DefaultScreen (display));
gcvalues.graphics_exposures = False;
gcvalues.subwindow_mode = IncludeInferiors;
gcvalues.line_width = 1;
m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)),
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
&gcvalues);
m_backgroundPixel = gcvalues.background;
SetBrush (* wxWHITE_BRUSH);
SetPen (* wxBLACK_PEN);
}
示例9: GetTextExtent
void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, const wxGraphicsBrush& backgroundBrush )
{
wxGraphicsBrush formerBrush = m_brush;
wxDouble width;
wxDouble height;
wxDouble descent;
wxDouble externalLeading;
GetTextExtent( str , &width, &height, &descent, &externalLeading );
SetBrush( backgroundBrush );
wxGraphicsPath path = CreatePath();
path.AddRectangle( x , y, width, height );
FillPath( path );
DrawText( str, x ,y);
SetBrush( formerBrush );
}
示例10: lg
void OCPiano::DrawWhiteKey(const int Pos, const bool Down)
{
QLinearGradient lg(0,0,0,WhiteKeyHeight);
if (Down)
{
lg.setColorAt(0,"#999");
lg.setColorAt(0.6,"#ddd");
}
else
{
lg.setColorAt(0,"#ccc");
lg.setColorAt(0.8,"#fff");
}
SetPen(QPen(Qt::NoPen));
SetBrush(lg);
Rectangle(Pos+1,0,WhiteKeyWidth-1,WhiteKeyHeight-1);
//Scene.addRect(Pos+1,0,WhiteKeyWidth-1,WhiteKeyHeight-1,QPen(Qt::NoPen),QBrush(lg));
SetPen("#666");
Line(Pos,0,Pos+WhiteKeyWidth,0);
//Scene.addLine(Pos,0,Pos+WhiteKeyWidth,0,QPen("#666"));
if (Down)
{
SetPen("#888");
Line(Pos,1,Pos+WhiteKeyWidth,1);
//Scene.addLine(Pos,1,Pos+WhiteKeyWidth,1,QPen("#888"));
}
SetPen("#555");
Line(Pos,0,Pos,WhiteKeyHeight-1);
//Scene.addLine(Pos,0,Pos,WhiteKeyHeight-1,QPen("#555"));
SetPen(Qt::black);
Line(Pos+WhiteKeyWidth,0,Pos+WhiteKeyWidth,WhiteKeyHeight-1);
//Scene.addLine(Pos+WhiteKeyWidth,0,Pos+WhiteKeyWidth,WhiteKeyHeight-1,QPen(Qt::black));
SetPenBrush(Qt::gray);
Rectangle(Pos+WhiteKeyWidth-1,1,1,WhiteKeyHeight-2);
//Scene.addRect(Pos+WhiteKeyWidth-1,1,1,WhiteKeyHeight-2,QPen(Qt::gray),QBrush(Qt::gray));
if (Down)
{
SetBrush("#666");
Rectangle(Pos+1,1,1,WhiteKeyHeight-2);
//Scene.addRect(Pos+1,1,1,WhiteKeyHeight-2,QPen(Qt::gray),QBrush("#666"));
}
SetPen("#555");
Line(Pos+1,WhiteKeyHeight,Pos+WhiteKeyWidth-1,WhiteKeyHeight);
//Scene.addLine(Pos+1,WhiteKeyHeight,Pos+WhiteKeyWidth-1,WhiteKeyHeight,QPen("#555"));
}
示例11: m_selected
wxMemoryDC::wxMemoryDC(void)
: m_selected()
{
m_ok = TRUE;
SetBackground(*wxWHITE_BRUSH);
SetBrush(*wxWHITE_BRUSH);
SetPen(*wxBLACK_PEN);
m_ok = FALSE;
};
示例12: SetBackground
void wxMemoryDCImpl::Init()
{
m_ok = true;
SetBackground(*wxWHITE_BRUSH);
SetBrush(*wxWHITE_BRUSH);
SetPen(*wxBLACK_PEN);
SetFont(*wxNORMAL_FONT);
m_ok = false;
}
示例13: SetMapMode
void wxPrinterDCImpl::Init()
{
if (m_hDC)
{
SetMapMode(wxMM_TEXT);
SetBrush(*wxBLACK_BRUSH);
SetPen(*wxBLACK_PEN);
}
} // end of wxPrinterDC::Init
示例14: SetPen
CBufView::~CBufView()
{
SetPen(NULL);
SetBrush(NULL);
SetFont(NULL);
SelectObject(m_buffer.hDC, m_buffer.hOldBmp);
DeleteObject(m_buffer.hBmp);
DeleteDC(m_buffer.hDC);
ReleaseDC(GetDesktopWindow(), m_buffer.hDCDesktop);
}
示例15: SetBrush
void wxMemoryDCImpl::Init()
{
if ( m_ok )
{
SetBrush(*wxWHITE_BRUSH);
SetPen(*wxBLACK_PEN);
// the background mode is only used for text background and is set in
// DrawText() to OPAQUE as required, otherwise always TRANSPARENT
::SetBkMode( GetHdc(), TRANSPARENT );
}
}