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


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

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


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

示例1: OnPaint

void LWSlider::OnPaint(wxDC &dc, bool selected)
{
   //thumbPos should be in pixels
   int thumbPos = ValueToPosition(mCurrentValue);
   int thumbY = mCenterY - (mThumbHeight/2);
   wxBitmap *bitmap;
   wxBitmap *thumbBitmap;

   if (selected) {
      bitmap = mSelBitmap;
      thumbBitmap = mSelThumbBitmap;
   }
   else {
      bitmap = mBitmap;
      thumbBitmap = mThumbBitmap;
   }

#if defined(__WXMAC__) || defined(__WXMSW__)
   dc.DrawBitmap(*bitmap, mLeft, mTop);
   dc.DrawBitmap(*thumbBitmap, mLeft+thumbPos, mTop+thumbY);
#else
   wxMemoryDC memDC;
   memDC.SelectObject(*bitmap);
   dc.Blit(mLeft, mTop, mWidth, mHeight, &memDC, 0, 0, wxCOPY, FALSE);
   memDC.SelectObject(*thumbBitmap);
   dc.Blit(mLeft+thumbPos, mTop+thumbY, mThumbWidth, mThumbHeight,
           &memDC, 0, 0, wxCOPY, FALSE);
#endif

   if (mPopWin)
      mPopWin->Refresh();
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:32,代码来源:ASlider.cpp

示例2: wxDrawSplashBitmap

static void wxDrawSplashBitmap(wxDC& dc, const wxBitmap& bitmap, int WXUNUSED(x), int WXUNUSED(y))
{
    wxMemoryDC dcMem;

#ifdef USE_PALETTE_IN_SPLASH
    bool hiColour = (wxDisplayDepth() >= 16) ;

    if (bitmap.GetPalette() && !hiColour)
    {
        dcMem.SetPalette(* bitmap.GetPalette());
    }
#endif // USE_PALETTE_IN_SPLASH

    dcMem.SelectObjectAsSource(bitmap);
    dc.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), &dcMem, 0, 0, wxCOPY,
            true /* use mask */);
    dcMem.SelectObject(wxNullBitmap);

#ifdef USE_PALETTE_IN_SPLASH
    if (bitmap.GetPalette() && !hiColour)
    {
        dcMem.SetPalette(wxNullPalette);
    }
#endif // USE_PALETTE_IN_SPLASH
}
开发者ID:BauerBox,项目名称:wxWidgets,代码行数:25,代码来源:splash.cpp

示例3: DrawBackground

/// This draws the background of a toolbar
void ToolBar::DrawBackground(wxDC &dc, int width, int height)
{

#if defined(__WXMAC__)

   if (mBackgroundWidth < width) {
      if (mBackgroundBitmap)
         delete mBackgroundBitmap;
      
      wxImage *aquaImage = CreateAquaBackground(width, height, 0);
      mBackgroundBitmap = new wxBitmap(aquaImage);
      delete aquaImage;
   }

   wxMemoryDC memDC;
   memDC.SelectObject(*mBackgroundBitmap);

   dc.Blit(0, 0, width, height, &memDC, 0, 0, wxCOPY, FALSE);

#if 0
   height = mIdealSize.GetHeight();

   dc.SetPen(*wxBLACK_PEN);
   dc.DrawLine(27, 0, 27, height - 1);
   dc.DrawLine(55, 0, 55, height - 1);
   dc.DrawLine(83, 0, 83, 27);
   dc.DrawLine(0, 27, 83, 27);
#endif
#else

   dc.SetBrush(mBackgroundBrush);
   dc.SetPen(mBackgroundPen);

   height = mIdealSize.GetHeight();
   dc.DrawRectangle(0, 0, width, height);


#if 0
   // JKC: This code draws a grid of lines around the first few
   // buttons on the toolbar.
   // TODO: Do we want this at all?  
   // If so this should be moved to ControlToolbar.
   // Having it here means that it is also drawn in EditToolBar,
   // which we probably don't want.  (same for the Mac 
   // version in other half of #ifdef).

   dc.SetPen(*wxBLACK_PEN);
   dc.DrawLine(27, 0, 27, height - 1);
   dc.DrawLine(55, 0, 55, height - 1);
   dc.DrawLine(83, 0, 83, height - 1);
   dc.DrawLine(0, 27, 83, 27);
#endif
#endif


}
开发者ID:Kirushanr,项目名称:audacity,代码行数:57,代码来源:ToolBar.cpp

示例4: Flush

void VdkDC::Flush(wxDC &dc) {
    SetDeviceOrigin(0, 0);

    dc.Blit(m_Rect.x, m_Rect.y, m_Rect.width, m_Rect.height,
            this, m_Rect.x, m_Rect.y);

    if (m_Window->GetCachedDC() == this) {
        m_Window->ResetCachedDC(dc);
    }
}
开发者ID:vanxining,项目名称:M4Player,代码行数:10,代码来源:VdkDC.cpp

示例5: DrawTimeline

void Timeline::DrawTimeline(wxDC& dc) {
	const wxSize size = GetClientSize();
	const wxRect rect(0, m_scrollPos, size.x, size.y);

	DrawTimeline(rect);

	// Copy MemoryDC to Display
	dc.Blit(0, 0, size.x, size.y, &m_mdc, 0, 0);

	m_needRedrawing = false;
}
开发者ID:baguatuzi,项目名称:e,代码行数:11,代码来源:Timeline.cpp

示例6: DrawPaperBar

//---------------------------------------------------------------------------
void wxPagedWindow::DrawPaperBar( twTabInfo& tab, int x, int y,
                                  wxBrush& brush, wxPen& pen, wxDC& dc )
{
    wxPoint poly[4];

    // draw organizer-style paper outlet

    poly[0].x = x - mTabTrianGap;
    poly[0].y = y;

    poly[1].x = x + mTabTrianGap;
    poly[1].y = y + tab.mDims.y-1;

    poly[2].x = x + tab.mDims.x - mTabTrianGap;
    poly[2].y = y + tab.mDims.y-1;

    poly[3].x = x + tab.mDims.x + mTabTrianGap;
    poly[3].y = y;

    dc.SetPen( pen );
    dc.SetBrush( brush );

    dc.DrawPolygon( 4, poly );

    long w,h;

    // set select default font of the window into it's device context
    //dc.SetFont( GetLabelingFont() );

    dc.SetTextBackground( brush.GetColour() );

    dc.GetTextExtent(tab.mText, &w, &h );

    if ( tab.HasImg() )
    {
        wxMemoryDC tmpDc;
        tmpDc.SelectObject( tab.GetImg() );

        dc.Blit( x + mTitleHorizGap,
            y + ( tab.mDims.y - tab.ImgHeight() ) / 2,
            tab.ImgWidth(),
            tab.ImgHeight(),
            &tmpDc, 0, 0, wxCOPY
            );
    }

    if ( tab.HasText() )
    {
        int tx = x + mTitleHorizGap +
            tab.ImgWidth() + tab.ImageToTxtGap(mImageTextGap);

        dc.DrawText( tab.GetText(), tx, y + ( tab.mDims.y - h ) / 2 );
    }
}  // wxPagedWindow::DrawPaperBar()
开发者ID:BackupTheBerlios,项目名称:wxbeos-svn,代码行数:55,代码来源:tabpgwin.cpp

示例7: DrawField

/** this draws the data on the Control */
void wxLEDPanel::DrawField(wxDC& dc, bool backgroundMode)
{
	wxPoint point;
	int w=m_ledsize.GetWidth()+m_padding;
	int h=m_ledsize.GetHeight()+m_padding;
	char data;

	// Zähler für Zeile und Spalte
    int x=0,y=0;

    // Pointer to avoid unnesecerie if blocks in the for block
    wxMemoryDC* p_mdc_data=((m_invert)?((m_show_inactivs)?(&m_mdc_led_off):(&m_mdc_led_none)):(&m_mdc_led_on));
    wxMemoryDC* p_mdc_nodata=((m_invert)?(&m_mdc_led_on):((m_show_inactivs)?(&m_mdc_led_off):(&m_mdc_led_none)));

    int l = m_field.GetLength();
    int fw = m_field.GetWidth();
    const char* field = m_field.GetData();
    for(int i=0;i<l;++i)
    {
    	// Daten des Feldes
    	data=field[i];

		// Koordinaten
    	point.x=x*w+m_padding;
    	point.y=y*h+m_padding;

    	// zeichnen
    	if(field[i] && !backgroundMode)
    	{
    	    dc.Blit(point.x,point.y,w,h,p_mdc_data,0,0);
    	}
    	else if(backgroundMode)
    	{
            dc.Blit(point.x,point.y,w,h,p_mdc_nodata,0,0);
    	}

    	// hochzählen
        ++x;
        if(x==fw) {++y; x=0;}
    }
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:42,代码来源:wxledpanel.cpp

示例8: DrawBitmap

void ImageRoll::DrawBitmap(wxDC &dc, wxBitmap &bitmap,
                           int x, int y, int logicalFunc)
{
   if (logicalFunc == wxCOPY)
      dc.DrawBitmap(bitmap, x, y);
   else {
      wxMemoryDC memDC;
      memDC.SelectObject(bitmap);
      dc.Blit(x, y, bitmap.GetWidth(), bitmap.GetHeight(),
              &memDC, 0, 0, logicalFunc);
   }
}
开发者ID:andreipaga,项目名称:audacity,代码行数:12,代码来源:ImageRoll.cpp

示例9: DrawBackground

void ToolBar::DrawBackground(wxDC &dc, int width, int height)
{
   #if defined(__WXMAC__)

   if (mBackgroundWidth < width) {
      if (mBackgroundBitmap)
         delete mBackgroundBitmap;

      mBackgroundBitmap = new wxBitmap(width, height);

      wxMemoryDC memDC;
      memDC.SelectObject(*mBackgroundBitmap);

      int y;
      memDC.SetPen(wxPen(wxColour(231, 231, 231), 1, wxSOLID));
      for (y = 0; y < height; y += 4)
         memDC.DrawLine(0, y, width, y);
      memDC.SetPen(wxPen(wxColour(239, 239, 239), 1, wxSOLID));
      for (y = 1; y < height; y += 2)
         memDC.DrawLine(0, y, width, y);
      memDC.SetPen(wxPen(wxColour(255, 255, 255), 1, wxSOLID));
      for (y = 2; y < height; y += 4)
         memDC.DrawLine(0, y, width, y);
   }

   wxMemoryDC memDC;
   memDC.SelectObject(*mBackgroundBitmap);

   dc.Blit(0, 0, width, height, &memDC, 0, 0, wxCOPY, FALSE);

   dc.SetPen(*wxBLACK_PEN);

   dc.DrawLine(27, 0, 27, height - 1);
   dc.DrawLine(55, 0, 55, height - 1);
   dc.DrawLine(83, 0, 83, 27);
   dc.DrawLine(0, 27, 83, 27);

#else

   dc.SetBrush(mBackgroundBrush);
   dc.SetPen(mBackgroundPen);
   dc.DrawRectangle(0, 0, width, height);

   dc.SetPen(*wxBLACK_PEN);

   dc.DrawLine(27, 0, 27, height - 1);
   dc.DrawLine(55, 0, 55, height - 1);
   dc.DrawLine(83, 0, 83, height - 1);
   dc.DrawLine(0, 27, 83, 27);

#endif
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:52,代码来源:ToolBar.cpp

示例10: memDC

void
hoxUtil::DrawBitmapOnDC( wxDC&         dc,
                         wxBitmap&     bitmap,
                         const wxCoord x,
                         const wxCoord y )
{
#ifdef __WXMAC__
	dc.DrawBitmap( bitmap, x, y, true );
#else
    wxMemoryDC memDC( bitmap );
    dc.Blit( x, y, bitmap.GetWidth(), bitmap.GetHeight(),
             &memDC, 0, 0, wxCOPY, true );
#endif
}
开发者ID:DoBuiThao,项目名称:hoxchess,代码行数:14,代码来源:hoxUtil.cpp

示例11: Draw

bool DragShape::Draw(wxDC& dc, int op)
{
    if (m_bitmap.Ok())
    {
        wxMemoryDC memDC;
        memDC.SelectObject(m_bitmap);

        dc.Blit(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight(),
            & memDC, 0, 0, op, true);

        return true;
    }
    else
        return false;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:15,代码来源:dragimag.cpp

示例12: PaintStage

void Stage::PaintStage(wxDC &inDC, const wxRegion &inDirtyRegion) {
    // Make sure we don't overdraw any heavyweight elements.
    ClipElementsThatDrawThemselves(inDC);

    // Blit our offscreen pixmap to the screen.
    {
        wxMemoryDC srcDC;
        srcDC.SelectObjectAsSource(GetCompositingPixmap());
        wxRegionIterator i(inDirtyRegion);
        while (i) {
            inDC.Blit(i.GetX(), i.GetY(), i.GetW(), i.GetH(),
                      &srcDC, i.GetX(), i.GetY());
            i++;
        }
    }

    // If necessary, draw the grid.
    if (mIsDisplayingGrid) {
        int width = mStageSize.GetWidth();
        int height = mStageSize.GetHeight();
        int small_spacing = 10;
        int large_spacing = small_spacing * 10;

        // Draw the minor divisions of the grid.
        inDC.SetPen(*wxLIGHT_GREY_PEN);
        for (int x = 0; x < width; x += small_spacing)
            if (x % large_spacing)
                inDC.DrawLine(x, 0, x, height);
        for (int y = 0; y < width; y += small_spacing)
            if (y % large_spacing)
                inDC.DrawLine(0, y, width, y);

        // Draw the major divisions of the grid.
        inDC.SetPen(*wxGREEN_PEN);
        for (int x2 = 0; x2 < width; x2 += large_spacing)
            inDC.DrawLine(x2, 0, x2, height);
        for (int y2 = 0; y2 < width; y2 += large_spacing)
            inDC.DrawLine(0, y2, width, y2);
    }

    // If necessary, draw the borders.
    if (mIsDisplayingBorders) {
        ElementCollection::iterator i = mElements.begin();
        for (; i != mElements.end(); i++)
            if ((*i)->IsShown())
                DrawElementBorder(inDC, *i);
    }
}
开发者ID:colonelqubit,项目名称:halyard,代码行数:48,代码来源:Stage.cpp

示例13: draw

bool TileBitmap::draw(wxDC& dc, size_t tilenum, size_t x, size_t y, const TileAttributes& attrs)
{
    if(drawn_)
    {
        tilenum %= N_TILES;
        if( attrs.getAttribute(TileAttributes::ATTR_VFLIP))
        {
            tilenum += N_TILES * 2;
        }
        if(attrs.getAttribute(TileAttributes::ATTR_HFLIP))
        {
            tilenum += N_TILES;
        }
        //dc.StretchBlit(left, top, width, height, &memDC, 0, 0, WIDTH, HEIGHT, wxCOPY, true, 0, 0);
        dc.Blit(x*WIDTH, y*HEIGHT, WIDTH, HEIGHT, &memDC, 0, tilenum*HEIGHT, wxCOPY, true);
    }
    return drawn_;
}
开发者ID:thomasamendt,项目名称:landstalker_gfx,代码行数:18,代码来源:TileBitmap.cpp

示例14: TileBitmap

bool wxWizard::TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap)
{
    int w = bitmap.GetWidth();
    int h = bitmap.GetHeight();

    wxMemoryDC dcMem;

    dcMem.SelectObjectAsSource(bitmap);

    int i, j;
    for (i = rect.x; i < rect.x + rect.width; i += w)
    {
        for (j = rect.y; j < rect.y + rect.height; j+= h)
            dc.Blit(i, j, bitmap.GetWidth(), bitmap.GetHeight(), & dcMem, 0, 0);
    }
    dcMem.SelectObject(wxNullBitmap);

    return true;
}
开发者ID:jonntd,项目名称:dynamica,代码行数:19,代码来源:wizard.cpp

示例15: Draw

bool DragShape::Draw(wxDC& dc, bool highlight)
{
    if (m_bitmap.IsOk())
    {
        wxMemoryDC memDC;
        memDC.SelectObject(m_bitmap);

        dc.Blit(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight(),
            & memDC, 0, 0, wxCOPY, true);

        if (highlight)
        {
            dc.SetPen(*wxWHITE_PEN);
            dc.SetBrush(*wxTRANSPARENT_BRUSH);
            dc.DrawRectangle(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight());
        }

        return true;
    }
    else
        return false;
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:22,代码来源:dragimag.cpp


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