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


C++ wxDC::DrawBitmap方法代码示例

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


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

示例1: DrawPrint

void wxPDFViewPage::DrawPrint(wxDC& dc, const wxRect& rect, bool forceBitmap)
{
	FPDF_PAGE page = GetPage();

	int renderFlags = FPDF_ANNOT | FPDF_PRINTING;
#ifdef wxPDFVIEW_USE_RENDER_TO_DC
	if (!forceBitmap)
	{
		FPDF_RenderPage(dc.GetHDC(), page, rect.x, rect.y, rect.width, rect.height, 0, renderFlags);
	} else
#endif
	{
		wxBitmap bmp = CreateBitmap(page, m_pages->form(), rect.GetSize(), renderFlags);
		dc.DrawBitmap(bmp, wxPoint(0, 0));
	}
}
开发者ID:amitdo,项目名称:wxPDFView,代码行数:16,代码来源:PDFViewPages.cpp

示例2: DrawCornerLabel

void CustomGrid::DrawCornerLabel( wxDC& dc )
{
    dc.SetPen(GetDefaultGridLinePen());
	dc.SetBrush( wxBrush( m_labelBackgroundColour, wxBRUSHSTYLE_SOLID ) );
    wxRect rect( 0, 0, m_rowLabelWidth, m_colLabelHeight );
    dc.DrawRectangle(rect);
    ////scale bitmap to near col label height
    double hc = m_colLabelHeight;
    double hb = wxBitmap(now).GetHeight();
    double scfac = ((hc / hb) *4) /4;
    wxBitmap bmp = m_gParent->GetScaledBitmap(wxBitmap(now), _T("now"), scfac );
    //center bitmap
    int x = (m_rowLabelWidth - bmp.GetWidth()) / 2;
    int y = (m_colLabelHeight == bmp.GetHeight())? 0: wxMax( 0, (m_colLabelHeight - bmp.GetHeight()) / 2 );
    dc.DrawBitmap( bmp, x, y );
}
开发者ID:OpenCPN,项目名称:OpenCPN,代码行数:16,代码来源:CustomGrid.cpp

示例3: Draw

bool wxGenericImageList::Draw( int index, wxDC &dc, int x, int y,
                        int flags, bool WXUNUSED(solidBackground) )
{
    wxObjectList::compatibility_iterator node = m_images.Item( index );

    wxCHECK_MSG( node, false, wxT("wrong index in image list") );

    wxBitmap *bm = (wxBitmap*)node->GetData();

    if (bm->IsKindOf(wxCLASSINFO(wxIcon)))
        dc.DrawIcon( * ((wxIcon*) bm), x, y);
    else
        dc.DrawBitmap( *bm, x, y, (flags & wxIMAGELIST_DRAW_TRANSPARENT) > 0 );

    return true;
}
开发者ID:iokto,项目名称:newton-dynamics,代码行数:16,代码来源:imaglist.cpp

示例4: OnDrawItem

void wxBitmapComboBox::OnDrawItem(wxDC& dc,
                                 const wxRect& rect,
                                 int item,
                                 int flags) const
{
    wxString text;
    int imgAreaWidth = m_imgAreaWidth;
    bool drawText;

    if ( imgAreaWidth == 0 )
    {
        wxOwnerDrawnComboBox::OnDrawItem(dc, rect, item, flags);
        return;
    }

    if ( flags & wxODCB_PAINTING_CONTROL )
    {
        text = GetValue();
        if ( HasFlag(wxCB_READONLY) )
            drawText = true;
        else
            drawText = false;
    }
    else
    {
        text = GetString(item);
        drawText = true;
    }

    const wxBitmap& bmp = *GetBitmapPtr(item);
    if ( bmp.Ok() )
    {
        wxCoord w = bmp.GetWidth();
        wxCoord h = bmp.GetHeight();

        // Draw the image centered
        dc.DrawBitmap(bmp,
                      rect.x + (m_usedImgSize.x-w)/2 + IMAGE_SPACING_LEFT,
                      rect.y + (rect.height-h)/2,
                      true);
    }

    if ( drawText )
        dc.DrawText(GetString(item),
                    rect.x + imgAreaWidth + 1,
                    rect.y + (rect.height-dc.GetCharHeight())/2);
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:47,代码来源:bmpcboxg.cpp

示例5: BenchmarkRawBitmaps

    void BenchmarkRawBitmaps(const wxString& msg, wxDC& dc)
    {
        if ( !opts.testRawBitmaps )
            return;

        if ( opts.mapMode != 0 )
            dc.SetMapMode((wxMappingMode)opts.mapMode);

        wxPrintf("Benchmarking %s: ", msg);
        fflush(stdout);

        wxBitmap bitmap(opts.width, opts.height, 24);
        wxNativePixelData data(bitmap);

        wxStopWatch sw;
        for ( int n = 0; n < opts.numIters; n++ )
        {
            unsigned char c = n % 256;
            {
                wxNativePixelData::Iterator p(data);
                for ( int y = 0; y < opts.height; ++y )
                {
                    wxNativePixelData::Iterator rowStart = p;

                    for ( int x = 0; x < opts.width; ++x )
                    {
                        p.Red() =
                        p.Green() =
                        p.Blue() = c;
                        ++p;
                    }

                    p = rowStart;
                    p.OffsetY(data, 1);
                    c++;
                }
            }

            dc.DrawBitmap(bitmap, 0, 0);
        }

        const long t = sw.Time();

        wxPrintf("%ld raw bitmaps done in %ldms = %gus/bitmap or %ld FPS\n",
                 opts.numIters, t, (1000. * t)/opts.numIters,
                 (1000*opts.numIters + t - 1)/t);
    }
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:47,代码来源:graphics.cpp

示例6: Render

/**
 * Render the event in the bitmap
 */
void WhileEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
{
#if !defined(GD_NO_WX_GUI)
    gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
    int border = renderingHelper->instructionsListBorder;
    const int repeatHeight = 20;

    //Draw header rectangle
    int whileConditionsHeight = renderingHelper->GetRenderedConditionsListHeight(whileConditions, width-80-border*2, platform)+border*2;
    if (!infiniteLoopWarning && whileConditionsHeight < 32 ) whileConditionsHeight = 32;
    wxRect headerRect(x, y, width, whileConditionsHeight+repeatHeight);
    renderingHelper->DrawNiceRectangle(dc, headerRect);

    //While text
    dc.SetFont( renderingHelper->GetNiceFont().Bold()  );
    dc.SetTextForeground(wxColour(0,0,0));
    dc.DrawText( _("While :"), x+5, y+5 );

    //Draw icon if infinite loop warning is deactivated.
    if (!infiniteLoopWarning)
    {
        if ( gd::CommonBitmapManager::Get()->noProtection.IsOk() )
            dc.DrawBitmap(gd::CommonBitmapManager::Get()->noProtection, wxPoint(x+5,y+5+18), /*useMask=*/true);
    }

    //Draw "while conditions"
    renderingHelper->DrawConditionsList(whileConditions, dc, x+80+border, y+border, width-80-border*2, this, areas, selection, platform);

    dc.SetFont( renderingHelper->GetNiceFont().Bold()  );
    dc.SetTextForeground(wxColour(0,0,0));
    dc.DrawText( _("Repeat :"), x+4, y+whileConditionsHeight+3);
    whileConditionsHeight += repeatHeight;

    //Draw conditions rectangle
    wxRect rect(x, y+whileConditionsHeight, renderingHelper->GetConditionsColumnWidth()+border, GetRenderedHeight(width, platform)-whileConditionsHeight);
    renderingHelper->DrawNiceRectangle(dc, rect);

    renderingHelper->DrawConditionsList(conditions, dc,
                                        x+border,
                                        y+whileConditionsHeight+border,
                                        renderingHelper->GetConditionsColumnWidth()-border, this, areas, selection, platform);
    renderingHelper->DrawActionsList(actions, dc,
                                     x+renderingHelper->GetConditionsColumnWidth()+border,
                                     y+whileConditionsHeight+border,
                                     width-renderingHelper->GetConditionsColumnWidth()-border*2, this, areas, selection, platform);
#endif
}
开发者ID:Slulego,项目名称:GD,代码行数:50,代码来源:WhileEvent.cpp

示例7: DrawShapes

// Draws any shapes in the model to the provided DC (draw context)
void PaintModel::DrawShapes(wxDC& dc, bool showSelection) {
	// Draw background
	if (mBitmap.IsOk()) {
		// The image's top left corner should be asigned with the canvas' top left corner, (0,0)
		dc.DrawBitmap(mBitmap, 0, 0);
	}
	
	// Draw all shapes
	for (auto it = mShapes.begin(); it != mShapes.end(); ++it) {
		(*it)->Draw(dc);
	}
	
	// Draw a box around the selected shape, if present
	if (showSelection && mSelectedShape) {
		mSelectedShape->DrawSelection(dc);
	}
}
开发者ID:connor-k,项目名称:ProPaint,代码行数:18,代码来源:PaintModel.cpp

示例8: Render

void wxCustomStatusBarBitmapField::Render(wxDC& dc, const wxRect& rect, wxCustomStatusBarArt::Ptr_t art)
{
    m_rect = rect;

    // draw border line
    art->DrawFieldSeparator(dc, rect);

    // Center bitmap
    if(m_bitmap.IsOk()) {
        int bmpHeight = m_bitmap.GetScaledHeight();
        int bmpWidth = m_bitmap.GetScaledWidth();
        wxCoord bmpY = (rect.GetHeight() - bmpHeight) / 2 + rect.y;
        wxCoord bmpX = (rect.GetWidth() - bmpWidth) / 2 + rect.x;
        // Draw the bitmap
        dc.DrawBitmap(m_bitmap, bmpX, bmpY + 1);
    }
}
开发者ID:lpc1996,项目名称:codelite,代码行数:17,代码来源:wxCustomStatusBar.cpp

示例9: render

void PDFPanel::render(wxDC& dc)
{
    it = selectedItems.begin();
    if(bitmap->IsOk() && bitmap!=NULL)
    {
        dc.DrawBitmap( *bitmap,0 ,0, false );
        grid.DrawGrid(dc);
        while(it!=selectedItems.end())
        {
            wxRect rect = (it->rect);
            dc.SetPen(pen);
            dc.SetBrush(*wxTRANSPARENT_BRUSH);
            dc.DrawRectangle(rect);
            it++;
        }
    }

}
开发者ID:robinskumar73,项目名称:tarun_zimmerman-,代码行数:18,代码来源:ImgPanel.cpp

示例10: DrawRowLabel

void wxGridCtrl::DrawRowLabel(wxDC& dc, int row)
{
    if (GetRowHeight(row) <= 0 || m_rowLabelWidth <= 0)
        return;
    wxRect rect;
    int rowTop = GetRowTop(row), rowBottom = GetRowBottom(row) - 1;
    dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID));
    dc.DrawLine(m_rowLabelWidth - 1, rowTop, m_rowLabelWidth - 1, rowBottom);
    dc.DrawLine(0, rowTop, 0, rowBottom);
    dc.DrawLine(0, rowBottom, m_rowLabelWidth, rowBottom);
    dc.SetPen(*wxWHITE_PEN);
    dc.DrawLine(1, rowTop, 1, rowBottom);
    dc.DrawLine(1, rowTop, m_rowLabelWidth - 1, rowTop);
    if (row == GetGridCursorRow())
	{
		dc.DrawBitmap(wxBitmap(small_arrow_xpm), 0, GetRowTop(row), true);
    }
}
开发者ID:Mileslee,项目名称:wxgis,代码行数:18,代码来源:tableview.cpp

示例11: OnDraw

virtual void OnDraw(wxDC& dc)
{
	if (m_bitmap.IsOk())
	{
		dc.DrawBitmap(m_bitmap, 0, 0);
	}
	else if (!m_imageError.IsNull())
	{
		dc.SetPen(wxPen(wxColor(255, 255, 255)));
		dc.SetBrush(*wxWHITE_BRUSH);
		dc.DrawRectangle(0, 0, m_w, m_h);
		
		dc.SetPen(*wxRED_PEN);
		dc.DrawLine(0, 0, m_w - 1, m_h - 1);
		dc.DrawLine(0, m_h - 1, m_w - 1, m_h - 1);
		dc.SetPen(*wxBLACK_PEN);
		dc.DrawText(m_imageError.GetMessage(), 0 , 0);
	}
}
开发者ID:aeadara,项目名称:fingerprint-android,代码行数:19,代码来源:wxFIView.hpp

示例12: DrawColLabel

/* not virtual in wxGrid, so code copied and modified her for painting sorting icons */
void CBOINCGridCtrl::DrawColLabel( wxDC& dc, int col )
{
    if ( GetColWidth(col) <= 0 || m_colLabelHeight <= 0 )
        return;

    int colLeft = GetColLeft(col);

    wxRect rect;
    int colRight = GetColRight(col) - 1;

    dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW),1, wxSOLID) );
    dc.DrawLine( colRight, 0,
                 colRight, m_colLabelHeight-1 );

    dc.DrawLine( colLeft, 0, colRight, 0 );

    dc.DrawLine( colLeft, m_colLabelHeight-1,
                 colRight+1, m_colLabelHeight-1 );

    dc.SetPen( *wxWHITE_PEN );
    dc.DrawLine( colLeft, 1, colLeft, m_colLabelHeight-1 );
    dc.DrawLine( colLeft, 1, colRight, 1 );
    dc.SetBackgroundMode( wxTRANSPARENT );
    dc.SetTextForeground( GetLabelTextColour() );
    dc.SetFont( GetLabelFont() );

    int hAlign, vAlign, orient;
    GetColLabelAlignment( &hAlign, &vAlign );
    orient = GetColLabelTextOrientation();

    rect.SetX( colLeft + 2 );
    rect.SetY( 2 );
    rect.SetWidth( GetColWidth(col) - 4 );
    rect.SetHeight( m_colLabelHeight - 4 );
    DrawTextRectangle( dc, GetColLabelValue( col ), rect, hAlign, vAlign, orient );
	//paint sorting indicators, if needed
	if(col == sortColumn) {
		int x = rect.GetRight() - ascBitmap.GetWidth() - 2;
		int y = rect.GetY();
		dc.DrawBitmap(this->sortAscending ? descBitmap : ascBitmap,x,y,true);
	}
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:43,代码来源:BOINCGridCtrl.cpp

示例13: Render

void AudioRenderer::Render(wxDC &dc, wxPoint origin, const int start, const int length, const AudioRenderingStyle style)
{
	assert(start >= 0);

	if (!provider) return;
	if (!renderer) return;
	if (length <= 0) return;

	// One past last absolute pixel strip to render
	const int end = start + length;
	// One past last X coordinate to render on
	const int lastx = origin.x + length;
	// Figure out which range of bitmaps are required
	const int firstbitmap = start / cache_bitmap_width;
	// And the offset in it to start its use at
	const int firstbitmapoffset = start % cache_bitmap_width;
	// The last bitmap required
	const int lastbitmap = std::min<int>(end / cache_bitmap_width, NumBlocks(provider->GetDecodedSamples()) - 1);

	// Set a clipping region so that the first and last bitmaps don't draw
	// outside the requested range
	const wxDCClipper clipper(dc, wxRect(origin, wxSize(length, pixel_height)));
	origin.x -= firstbitmapoffset;

	for (int i = firstbitmap; i <= lastbitmap; ++i)
	{
		dc.DrawBitmap(GetCachedBitmap(i, style), origin);
		origin.x += cache_bitmap_width;
	}

	// Now render blank audio from origin to end
	if (origin.x < lastx)
		renderer->RenderBlank(dc, wxRect(origin.x-1, origin.y, lastx-origin.x+1, pixel_height), style);

	if (needs_age)
	{
		bitmaps[style].Age(cache_bitmap_maxsize);
		renderer->AgeCache(cache_renderer_maxsize);
		needs_age = false;
	}
}
开发者ID:Aegisub,项目名称:Aegisub,代码行数:41,代码来源:audio_renderer.cpp

示例14: OnDraw

void ExplainShape::OnDraw(wxDC& dc)
{
    wxBitmap &bmp=GetBitmap();
    if (!bmp.Ok())
        return;

    int x, y;
    x = WXROUND(m_xpos - bmp.GetWidth() / 2.0);
    y = WXROUND(m_ypos - GetHeight() / 2.0);

    dc.DrawBitmap(bmp, x, y, true);

    int w, h;
    dc.SetFont(GetCanvas()->GetFont());
    dc.GetTextExtent(label, &w, &h);

    x = WXROUND(m_xpos - w / 2.0);
    y +=bmp.GetHeight() + BMP_BORDER;

    dc.DrawText(label, x, y);
}
开发者ID:lhcezar,项目名称:pgadmin3,代码行数:21,代码来源:explainShape.cpp

示例15: Draw

void PhotoFrame::Draw(wxDC& dc, wxPoint& origin) {
	dc.SetBrush(BACKGROUND_BRUSH);
	dc.SetPen(BACKGROUND_PEN);
  dc.DrawRoundedRectangle(origin, SMALL_SIZE, CORNER_RADIUS);
  wxRect rect(
      origin.x + (SMALL_SIZE.x - SMALL_BITMAP_SIZE.x) / 2,
      origin.y + (SMALL_SIZE.y - SMALL_BITMAP_SIZE.y) / 2,
      SMALL_BITMAP_SIZE.x,
      SMALL_BITMAP_SIZE.y);
  if (!m_path.IsEmpty()) {
    wxBitmap* bitmap = m_cache.Get(m_path);
    if (bitmap != NULL) {
      rect.SetSize(wxSize(bitmap->GetWidth(), bitmap->GetHeight()));
      rect.x += (SMALL_BITMAP_SIZE.x - rect.width) / 2;
      rect.y += (SMALL_BITMAP_SIZE.y - rect.height) / 2;
      dc.DrawBitmap(*bitmap, rect.GetPosition());
    }
  }
  dc.SetBrush(*wxTRANSPARENT_BRUSH);
  dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
}
开发者ID:nagyist,项目名称:simple-photo,代码行数:21,代码来源:PhotoFrame.cpp


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