当前位置: 首页>>代码示例>>C++>>正文


C++ SetBrush函数代码示例

本文整理汇总了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 );
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:26,代码来源:graphcmn.cpp

示例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 );
}
开发者ID:DumaGit,项目名称:winsparkle,代码行数:25,代码来源:graphcmn.cpp

示例3: SetBrush

void wxGraphicsContext::SetBrush( const wxBrush& brush )
{
    if ( !brush.Ok() || brush.GetStyle() == wxTRANSPARENT )
        SetBrush( wxNullGraphicsBrush );
    else
        SetBrush( CreateBrush( brush ) );
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:7,代码来源:graphcmn.cpp

示例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 );
    }
}
开发者ID:JesperWe,项目名称:OpenCPN,代码行数:12,代码来源:ocpndc.cpp

示例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        
    }
}
开发者ID:Hakansv,项目名称:ocpn_draw_pi,代码行数:14,代码来源:ODdc.cpp

示例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);
}
开发者ID:axelmuhr,项目名称:Helios-NG,代码行数:25,代码来源:painter.c

示例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;
    };
}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:35,代码来源:dcmemory.cpp

示例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);
}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:26,代码来源:dcmemory.cpp

示例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 );
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:17,代码来源:graphcmn.cpp

示例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"));
}
开发者ID:vemod-,项目名称:ObjectComposerXML,代码行数:45,代码来源:ocpiano.cpp

示例11: m_selected

wxMemoryDC::wxMemoryDC(void)
: m_selected()
{
    m_ok = TRUE;
    SetBackground(*wxWHITE_BRUSH);
    SetBrush(*wxWHITE_BRUSH);
    SetPen(*wxBLACK_PEN);
    m_ok = FALSE;
};
开发者ID:gitrider,项目名称:wxsj2,代码行数:9,代码来源:dcmemory.cpp

示例12: SetBackground

void wxMemoryDCImpl::Init()
{
    m_ok = true;
    SetBackground(*wxWHITE_BRUSH);
    SetBrush(*wxWHITE_BRUSH);
    SetPen(*wxBLACK_PEN);
    SetFont(*wxNORMAL_FONT);
    m_ok = false;
}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:9,代码来源:dcmemory.cpp

示例13: SetMapMode

void wxPrinterDCImpl::Init()
{
    if (m_hDC)
    {
        SetMapMode(wxMM_TEXT);

        SetBrush(*wxBLACK_BRUSH);
        SetPen(*wxBLACK_PEN);
    }
} // end of wxPrinterDC::Init
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:10,代码来源:dcprint.cpp

示例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);
}
开发者ID:loginsinex,项目名称:smb2,代码行数:10,代码来源:cbufview.cpp

示例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 );
    }
}
开发者ID:ahlekoofe,项目名称:gamekit,代码行数:12,代码来源:dcmemory.cpp


注:本文中的SetBrush函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。