• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ wxGCDC类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中wxGCDC的典型用法代码示例。如果您正苦于以下问题:C++ wxGCDC类的具体用法?C++ wxGCDC怎么用?C++ wxGCDC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了wxGCDC类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: DoDrawInactiveTabSeparator

void clAuiGlossyTabArt::DoDrawInactiveTabSeparator(wxGCDC& gdc, const wxRect& tabRect)
{
    wxRect rr = tabRect;
    rr.SetWidth(1);
    rr.SetHeight(tabRect.GetHeight()+2);
    rr.x = tabRect.GetTopRight().x - 1;
    rr.y = tabRect.GetTopRight().y - 2;
    
    wxColour sideColour;
    if ( DrawingUtils::IsThemeDark() ) {
        sideColour = m_bgColour.ChangeLightness(110);
    } else {
        sideColour = *wxWHITE;
    }
    // Draw 2 lines on the sides of the "main" line
    wxRect rectLeft, rectRight, rectCenter;
    wxPoint topPt = rr.GetTopLeft();
    topPt.x -= 1;
    rectLeft = wxRect(topPt, wxSize(1, rr.GetHeight()) );
    gdc.GradientFillLinear(rectLeft, sideColour, m_bgColour, wxNORTH);
    
    topPt.x += 1;
    rectCenter = wxRect(topPt, wxSize(1, rr.GetHeight()) );
    gdc.GradientFillLinear(rectCenter, m_penColour.ChangeLightness(80), m_bgColour, wxNORTH);
    
    topPt.x += 1;
    rectRight = wxRect(topPt, wxSize(1, rr.GetHeight()) );
    gdc.GradientFillLinear(rectRight, sideColour, m_bgColour, wxNORTH);
}
开发者ID:HTshandou,项目名称:codelite,代码行数:29,代码来源:cl_aui_notebook_art.cpp


示例2: BenchmarkDCAndGC

 void BenchmarkDCAndGC(const char* dckind, wxDC& dc, wxGCDC& gcdc)
 {
     if ( opts.useDC )
     {
         BenchmarkAll(wxString::Format("%6s DC", dckind), dc);
     }
     else if ( opts.useGC && gcdc.IsOk() )
     {
         wxString rendName = gcdc.GetGraphicsContext()->GetRenderer()->GetName();
         BenchmarkAll(wxString::Format("%6s GC (%s)", dckind, rendName.c_str()), gcdc);
     }
 }
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:12,代码来源:graphics.cpp


示例3: DrawGrid

void MorphanView::DrawGrid(wxGCDC& gcdc)
{
    int w, h;
    gcdc.GetSize(&w, &h);

    float gridw = grid_width;// * zoom;
    float gridh = grid_height;// * zoom;

    for (float i = gridh; i < h; i += gridh)
        gcdc.DrawLine(0, i, w, i);

    for (float j = gridw; j < w; j += gridw)
        gcdc.DrawLine(j, 0, j, h);
}
开发者ID:TricksterGuy,项目名称:Morphan,代码行数:14,代码来源:MorphanView.cpp


示例4: GetGCDC

bool DrawingUtils::GetGCDC(wxDC& dc, wxGCDC& gdc)
{
    wxGraphicsRenderer* const renderer = wxGraphicsRenderer::GetDefaultRenderer();
    wxGraphicsContext* context;
    
    if ( wxPaintDC *paintdc = wxDynamicCast(&dc, wxPaintDC) ) {
        context = renderer->CreateContext(*paintdc);

    } else if ( wxMemoryDC *memdc = wxDynamicCast(&dc, wxMemoryDC) ) {
        context = renderer->CreateContext(*memdc);

    } else {
        wxFAIL_MSG( "Unknown wxDC kind" );
        return false;
    }
    
    gdc.SetGraphicsContext(context);
    return true;
}
开发者ID:Hmaal,项目名称:codelite,代码行数:19,代码来源:drawingutils.cpp


示例5: GetGCDC

void wxFlatButton::GetGCDC(wxAutoBufferedPaintDC& dc, wxGCDC& gdc)
{
    wxGraphicsRenderer* const renderer = wxGraphicsRenderer::GetDefaultRenderer();
    wxGraphicsContext* context = renderer->CreateContext(dc);
    gdc.SetGraphicsContext(context);
}
开发者ID:05storm26,项目名称:codelite,代码行数:6,代码来源:wxFlatButton.cpp


示例6: drawNode

void MaterialWindow::drawNode(wxGCDC& gdc, Node* node)
{
    // Background
    gdc.SetBrush(wxBrush(Theme::lightBackgroundColor, wxBRUSHSTYLE_SOLID));
    gdc.DrawRoundedRectangle(mWindowX + node->x, mWindowY + node->y, node->width, node->height, 10);

    // Title Bar Background
    if ( node->mouseOver || mSelectedNode == node )
        gdc.SetBrush(wxBrush(wxColour(50, 50, 50), wxBRUSHSTYLE_SOLID));
    else
        gdc.SetBrush(wxBrush(Theme::darkBackgroundColor, wxBRUSHSTYLE_SOLID));
    gdc.DrawRoundedRectangle(mWindowX + node->x + 5, mWindowY + node->y + 5, node->width - 10, 30, 10);

    // Title Bar Text
    wxFont font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false);
    gdc.SetFont(font);
    gdc.SetTextForeground(wxColour(200, 200, 190));
    wxSize textSize = gdc.GetTextExtent(node->name);
    gdc.DrawText(node->name, mWindowX + node->x + (node->width / 2) - (textSize.GetWidth() / 2), mWindowY + node->y + 18 - (textSize.GetHeight() / 2));

    // Input Points
    for(S32 n = 0; n < node->inputs.size(); ++n )
    {
        InputPoint* input = &node->inputs[n];
        input->lastPosition = wxPoint(mWindowX + node->x + 12.0f, mWindowY + node->y + 49.0f + (n * 20.0f));

        U8 alpha_val = input->mouseOver ? 255 : 175;

        gdc.SetBrush(wxBrush(wxColour(255, 255, 255, alpha_val), wxBRUSHSTYLE_SOLID));
        gdc.DrawCircle(mWindowX + node->x + 12.0f, mWindowY + node->y + 49.0f + (n * 20.0f), 5);

        wxSize inputTextSize = gdc.GetTextExtent(input->name);
        wxFont inputfont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false);
        gdc.SetFont(inputfont);
        gdc.SetTextForeground(wxColour(255, 255, 255, alpha_val));
        gdc.DrawText(input->name, mWindowX + node->x + 22, mWindowY + node->y + 41 + (n * 20));
    }

    // Output Points
    for(S32 n = 0; n < node->outputs.size(); ++n )
    {
        OutputPoint* output = &node->outputs[n];
        output->lastPosition = wxPoint(mWindowX + node->x + node->width - 12.0f, mWindowY + node->y + 49.0f + (n * 20.0f));

        U8 alpha_val = output->mouseOver ? 255 : 175;

        gdc.SetBrush(wxBrush(wxColour(output->color.red, output->color.green, output->color.blue, alpha_val), wxBRUSHSTYLE_SOLID));
        gdc.DrawCircle(mWindowX + node->x + node->width - 12.0f, mWindowY + node->y + 49.0f + (n * 20.0f), 5);
    }

    // Float can be shown in a single line of text.
    if (node->type == "Float")
    {
        wxString floatValue = wxString::Format("%f", node->color.red);
        wxFont inputfont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false);
        gdc.SetFont(inputfont);
        gdc.SetTextForeground(wxColour(255, 255, 255, 255));
        gdc.DrawText(floatValue, mWindowX + node->x + 12.0f, mWindowY + node->y + 41);
    }

    // Vec3 and Vec4 draw a color preview.
    if (node->type == "Vec3" || node->type == "Vec4")
    {
        gdc.SetBrush(wxBrush(wxColour(node->color.red * 255, node->color.green * 255, node->color.blue * 255, node->color.alpha * 255), wxBRUSHSTYLE_SOLID));
        gdc.DrawRectangle(mWindowX + node->x + 12.0f, mWindowY + node->y + 16.0f + (node->height / 2.0f) - 32.0f, 64.0f, 64.0f);
    }
}
开发者ID:andr3wmac,项目名称:Torque6Editor,代码行数:67,代码来源:materialWindow.cpp


示例7: DrawRectsOnTransformedDC

void GCDCBoundingBoxTestCase::DrawRectsOnTransformedDC()
{
    m_gcdc->DrawRectangle(10, 15, 50, 30);
    m_gcdc->SetDeviceOrigin(15, 20);
    m_gcdc->DrawRectangle(15, 20, 45, 35);
    m_gcdc->SetDeviceOrigin(5, 10);
    AssertBox(5, 5, 65, 60);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:8,代码来源:boundingbox.cpp


示例8: CrossHair

void GCDCBoundingBoxTestCase::CrossHair()
{
    int w, h;
    m_gcdc->GetSize(&w, &h);

    m_gcdc->CrossHair(33, 33);
    AssertBox(0, 0, w, h);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:8,代码来源:boundingbox.cpp


示例9: DrawText

void GCDCBoundingBoxTestCase::DrawText()
{
    wxString text("H");
    wxCoord w, h;
    m_gcdc->GetTextExtent(text, &w, &h);

    m_gcdc->DrawText(text, 3, 3);
    AssertBox(3, 3, w, h, 3);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:9,代码来源:boundingbox.cpp


示例10: DrawRotatedText

void GCDCBoundingBoxTestCase::DrawRotatedText()
{
    wxString text("vertical");
    wxCoord w, h;
    m_gcdc->GetTextExtent(text, &w, &h);

    m_gcdc->DrawRotatedText(text, 43, 22, -90);
    AssertBox(43 - h, 22, h, w, 3);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:9,代码来源:boundingbox.cpp


示例11: AssertBox

    void AssertBox(int minX, int minY, int width, int height, int margin = 0)
    {
        int maxX = minX + width;
        int maxY = minY + height;

        // Allow for a margin of error due to different implementation
        // specificities regarding drawing paths.
        if ( margin )
        {
            #define WX_ASSERT_CLOSE(expected, actual, delta) \
                WX_ASSERT_MESSAGE(("%d != %d", actual, expected), \
                                  abs(actual - expected) <= delta)

            WX_ASSERT_CLOSE(minX, m_gcdc->MinX(), margin);
            WX_ASSERT_CLOSE(minY, m_gcdc->MinY(), margin);
            WX_ASSERT_CLOSE(maxX, m_gcdc->MaxX(), margin);
            WX_ASSERT_CLOSE(maxY, m_gcdc->MaxY(), margin);

            #undef WX_ASSERT_CLOSE
        }
        else
        {
            CPPUNIT_ASSERT_EQUAL(minX, m_gcdc->MinX());
            CPPUNIT_ASSERT_EQUAL(minY, m_gcdc->MinY());
            CPPUNIT_ASSERT_EQUAL(maxX, m_gcdc->MaxX());
            CPPUNIT_ASSERT_EQUAL(maxY, m_gcdc->MaxY());
        }
    }
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:28,代码来源:boundingbox.cpp


示例12: DrawBitmap

void GCDCBoundingBoxTestCase::DrawBitmap()
{
    wxBitmap bitmap;
    bitmap.Create(12, 12);

    m_gcdc->DrawBitmap(bitmap, 5, 5);
    AssertBox(5, 5, 12, 12);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:8,代码来源:boundingbox.cpp


示例13: DrawPolygon

void GCDCBoundingBoxTestCase::DrawPolygon()
{
    wxPoint points[3];
    points[0] = wxPoint(10, 30);
    points[1] = wxPoint(20, 10);
    points[2] = wxPoint(30, 30);

    m_gcdc->DrawPolygon(3, points, -5, -7);
    AssertBox(5, 3, 20, 20);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:10,代码来源:boundingbox.cpp


示例14: DrawSpline

void GCDCBoundingBoxTestCase::DrawSpline()
{
    wxPoint points[3];
    points[0] = wxPoint(10, 30);
    points[1] = wxPoint(20, 20);
    points[2] = wxPoint(40, 50);

    m_gcdc->DrawSpline(3, points);
    AssertBox(10, 20, 30, 30, 5);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:10,代码来源:boundingbox.cpp


示例15: DrawIcon

void GCDCBoundingBoxTestCase::DrawIcon()
{
    wxBitmap bitmap;
    bitmap.Create(16, 16);
    wxIcon icon;
    icon.CopyFromBitmap(bitmap);

    m_gcdc->DrawIcon(icon, 42, 42);
    AssertBox(42, 42, 16, 16);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:10,代码来源:boundingbox.cpp


示例16: DrawLines

void GCDCBoundingBoxTestCase::DrawLines()
{
    wxPoint points[4];
    points[0] = wxPoint(10, 20);
    points[1] = wxPoint(20, 10);
    points[2] = wxPoint(30, 20);
    points[3] = wxPoint(20, 30);

    m_gcdc->DrawLines(4, points, 7, 8);
    AssertBox(17, 18, 20, 20);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:11,代码来源:boundingbox.cpp


示例17: Blit

void GCDCBoundingBoxTestCase::Blit()
{
    wxBitmap bitmap;
    bitmap.Create(20, 20);
    wxMemoryDC dc(bitmap);

    m_gcdc->Blit(20, 10, 12, 7, &dc, 0, 0);
    AssertBox(20, 10, 12, 7);

    dc.SelectObject(wxNullBitmap);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:11,代码来源:boundingbox.cpp


示例18: StretchBlit

void GCDCBoundingBoxTestCase::StretchBlit()
{
    wxBitmap bitmap;
    bitmap.Create(20, 20);
    wxMemoryDC dc(bitmap);

    m_gcdc->StretchBlit(30, 50, 5, 5, &dc, 0, 0, 12, 4);
    AssertBox(30, 50, 5, 5);

    dc.SelectObject(wxNullBitmap);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:11,代码来源:boundingbox.cpp


示例19: DrawPolyPolygon

void GCDCBoundingBoxTestCase::DrawPolyPolygon()
{
    int lenghts[2];
    lenghts[0] = 3;
    lenghts[1] = 3;
    wxPoint points[6];
    points[0] = wxPoint(10, 30);
    points[1] = wxPoint(20, 10);
    points[2] = wxPoint(30, 30);
    points[3] = wxPoint(20, 60);
    points[4] = wxPoint(30, 40);
    points[5] = wxPoint(40, 60);

    m_gcdc->DrawPolyPolygon(2, lenghts, points, 12, 5);
    AssertBox(22, 15, 30, 50, 4);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:16,代码来源:boundingbox.cpp


示例20: DrawLine

void GCDCBoundingBoxTestCase::DrawLine()
{
    m_gcdc->DrawLine(10, 10, 20, 15);
    AssertBox(10, 10, 10, 5);
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:5,代码来源:boundingbox.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxGraphicsContext类代码示例发布时间:2022-05-31
下一篇:
C++ wxFrame类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap