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


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

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


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

示例1: CalculateDCRect

void Route::CalculateDCRect( wxDC& dc_route, wxRect *prect, ViewPort &VP )
{
    dc_route.ResetBoundingBox();
    dc_route.DestroyClippingRegion();

    // Draw the route in skeleton form on the dc
    // That is, draw only the route points, assuming that the segements will
    // always be fully contained within the resulting rectangle.
    // Can we prove this?
    if( m_bVisible ) {
        wxRoutePointListNode *node = pRoutePointList->GetFirst();
        while( node ) {

            RoutePoint *prp2 = node->GetData();
            bool blink_save = prp2->m_bBlink;
            prp2->m_bBlink = false;
            ocpnDC odc_route( dc_route );
            prp2->Draw( odc_route, NULL );
            prp2->m_bBlink = blink_save;

            node = node->GetNext();
        }
    }

    //  Retrieve the drawing extents
    prect->x = dc_route.MinX() - 1;
    prect->y = dc_route.MinY() - 1;
    prect->width = dc_route.MaxX() - dc_route.MinX() + 2;
    prect->height = dc_route.MaxY() - dc_route.MinY() + 2;
}
开发者ID:kheyse,项目名称:OpenCPN,代码行数:30,代码来源:Route.cpp

示例2: CalculateDCRect

void Route::CalculateDCRect( wxDC& dc_route, wxRect *prect )
{
    dc_route.ResetBoundingBox();
    dc_route.DestroyClippingRegion();

    wxRect update_rect;

    // Draw the route in skeleton form on the dc
    // That is, draw only the route points, assuming that the segements will
    // always be fully contained within the resulting rectangle.
    // Can we prove this?
    if( m_bVisible ) {
        wxRoutePointListNode *node = pRoutePointList->GetFirst();
        while( node ) {

            RoutePoint *prp2 = node->GetData();
            bool blink_save = prp2->m_bBlink;
            prp2->m_bBlink = false;
            ocpnDC odc_route( dc_route );
            prp2->Draw( odc_route, NULL );
            prp2->m_bBlink = blink_save;

            wxRect r =  prp2->CurrentRect_in_DC ;
            r.Inflate(m_hiliteWidth, m_hiliteWidth);        // allow for large hilite circles at segment ends

            update_rect.Union( r );
            node = node->GetNext();
        }
    }

    *prect = update_rect;
}
开发者ID:CarCode,项目名称:Cocoa-OCPN,代码行数:32,代码来源:Route.cpp

示例3: DrawItem

void TLView::DrawItem(wxDC& dc, TLItem* item, long left, long delta_left, long top, long width, long height)
{
/* - Item itself - */
	Draw3dRect( &dc, left, top, width, height, item->GetSample()->GetColour() );
/* - Selection - */
	if ( item->IsSelected() ) {
		dc.SetPen( wxPen( *wxWHITE, 3, wxSHORT_DASH ) );
		dc.SetBrush( *wxTRANSPARENT_BRUSH );
		dc.DrawRectangle( left, top, width, height );
	}
/* - Label (Filename) - */
	if ( width > 1 ) {
		dc.SetPen( *wxBLACK_PEN );
		dc.SetClippingRegion( left, top, width, height );
		dc.SetFont( *wxSMALL_FONT );
		wxFileName fn( item->GetSample()->GetFilename() );
		long v3 = left + delta_left;
			dc.DrawText( fn.GetName(), v3, top + 1 );
/* - Extras ;) -*/ 
		dc.SetPen( *wxBLACK_PEN );
		dc.SetBrush( *wxWHITE_BRUSH );
		if ( item->m_toggleEnvelope ) {
			item->DrawEnvelope( dc, left + delta_left, top );
		}
		dc.DrawIcon(*dropDownIcon, left+delta_left+(item->GetLen()/GetRealZoom())-7,top+height-7);
		dc.DestroyClippingRegion();
	}
//	dc.DrawRectangle( left + item->m_x_test, top+item->m_y_test, 10, 10);
}
开发者ID:oracle2025,项目名称:ggseq,代码行数:29,代码来源:TLView.cpp

示例4: DrawCaption

void ModernDockArt::DrawCaption(wxDC& dc,
						   wxWindow* WXUNUSED(window),
                           const wxString& text,
                           const wxRect& rect,
                           wxAuiPaneInfo& pane)
{
    dc.SetPen(*wxTRANSPARENT_PEN);

    DrawCaptionBackground(dc, rect,
                          (pane.state & wxAuiPaneInfo::optionActive)?true:false);

	// Active captions are drawn with bold text
	if (pane.state & wxAuiPaneInfo::optionActive)
        m_caption_font.SetWeight(wxFONTWEIGHT_BOLD);
    else
        m_caption_font.SetWeight(wxFONTWEIGHT_NORMAL);
	dc.SetFont(m_caption_font);
	dc.SetTextForeground(m_inactive_caption_text_colour);

    wxCoord w,h;
    dc.GetTextExtent(wxT("ABCDEFHXfgkj"), &w, &h);

    dc.SetClippingRegion(rect);
    dc.DrawText(text, rect.x+m_caption_text_indent, rect.y+(rect.height/2)-(h/2)-1);
    dc.DestroyClippingRegion();
}
开发者ID:boulerne,项目名称:e,代码行数:26,代码来源:eDockArt.cpp

示例5: DrawFieldText

void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
{
    int leftMargin = 2;
    
    wxRect rect;
    GetFieldRect(i, rect);
    
    if ( !IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
    {
        dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
    }
    
    wxString text(GetStatusText(i));
    
    long x, y;
    
    dc.GetTextExtent(text, &x, &y);
    
    int xpos = rect.x + leftMargin + 1 ;
    int ypos = 1 ;
    
    dc.SetClippingRegion(rect.x, 0, rect.width, m_height);
    
    dc.DrawText(text, xpos, ypos);
    
    dc.DestroyClippingRegion();
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:27,代码来源:statbrma.cpp

示例6: DrawFieldText

void wxStatusBarGeneric::DrawFieldText(wxDC& dc, int i)
{
    int leftMargin = 2;

    wxRect rect;
    GetFieldRect(i, rect);

    wxString text(GetStatusText(i));

    long x = 0, y = 0;

    dc.GetTextExtent(text, &x, &y);

    int xpos = rect.x + leftMargin;
    int ypos = (int) (((rect.height - y) / 2 ) + rect.y + 0.5) ;

#if defined( __WXGTK__ ) || defined(__WXMAC__)
    xpos++;
    ypos++;
#endif

    dc.SetClippingRegion(rect.x, rect.y, rect.width, rect.height);

    dc.DrawText(text, xpos, ypos);

    dc.DestroyClippingRegion();
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:27,代码来源:statusbr.cpp

示例7: PaintLabels

void AudioDisplay::PaintLabels(wxDC &dc, TimeRange updtime)
{
	std::vector<AudioLabelProvider::AudioLabel> labels;
	controller->GetTimingController()->GetLabels(updtime, labels);
	if (labels.empty()) return;

	wxDCFontChanger fc(dc);
	wxFont font = dc.GetFont();
	font.SetWeight(wxFONTWEIGHT_BOLD);
	dc.SetFont(font);
	dc.SetTextForeground(*wxWHITE);
	for (auto const& label : labels)
	{
		wxSize extent = dc.GetTextExtent(label.text);
		int left = RelativeXFromTime(label.range.begin());
		int width = AbsoluteXFromTime(label.range.length());

		// If it doesn't fit, truncate
		if (width < extent.GetWidth())
		{
			dc.SetClippingRegion(left, audio_top + 4, width, extent.GetHeight());
			dc.DrawText(label.text, left, audio_top + 4);
			dc.DestroyClippingRegion();
		}
		// Otherwise center in the range
		else
		{
			dc.DrawText(label.text, left + (width - extent.GetWidth()) / 2, audio_top + 4);
		}
	}
}
开发者ID:Gpower2,项目名称:Aegisub,代码行数:31,代码来源:audio_display.cpp

示例8: OneRegionAndReset

void ClippingBoxTestCaseBase::OneRegionAndReset()
{
    // Setting one clipping box and next destroy it.
    // Final clipping box should be the same as DC surface.
    m_dc->SetClippingRegion(10, 20, 80, 75);
    m_dc->DestroyClippingRegion();
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight());
}
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:10,代码来源:clippingbox.cpp

示例9: DoProgressDrawing

/* paints the progress bar */
void CBOINCGridCellProgressRenderer::DoProgressDrawing(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, const wxRect& rectCell, int row, int col, bool isSelected) {
    wxRect rect = rectCell;
    rect.Inflate(-1);

    // erase only this cells background, overflow cells should have been erased
	this->DrawBackground(grid, dc, rectCell, row, isSelected);
	// set text attributes
    int hAlign, vAlign;
	attr.GetAlignment(&hAlign, &vAlign);
    SetTextColoursAndFont(grid, attr, dc, isSelected);

	//calculate the two parts of the progress rect
    //
	double dv = 0.0;
	wxString strValue = grid.GetCellValue(row,col);
	if(m_bDoPercentAppending) {
		strValue = strValue + wxT(" %");
	}

    // Project view uses the format:  %0.0f (%0.2f%%)
    // Everyone else uses: %.3f%%
    if (strValue.Find(wxT("(")) != wxNOT_FOUND) {
        strValue.SubString(strValue.Find(wxT("(")) + 1, strValue.Find(wxT(")")) - 1).ToDouble( &dv );
    } else {
    	strValue.ToDouble ( &dv );	 // NOTE: we should do error-checking/reporting here!!
    }


	wxRect p1(rect);
	wxRect p2(rect);
	int r = (int)((rect.GetRight()-rect.GetLeft())*dv / 100.0);
	p1.SetRight(rect.GetLeft()+r);
	p2.SetLeft(rect.GetLeft()+r+1);
	p2.SetRight(rect.GetRight()-1);
	//start drawing
	dc.SetClippingRegion(rect);
	wxBrush old = dc.GetBrush();
	wxColour progressColour = wxTheColourDatabase->Find(wxT("LIGHT BLUE"));
	wxBrush* progressBrush = wxTheBrushList->FindOrCreateBrush(progressColour);
	wxPen* progressPen = wxThePenList->FindOrCreatePen(progressColour,1,wxSOLID);
	//draw the outline rectangle
	dc.SetBrush(*wxTRANSPARENT_BRUSH);
	dc.SetPen(*progressPen);
	dc.DrawRectangle(rect);
	// Draw the left part
	dc.SetBrush(*progressBrush);
	dc.DrawRectangle(p1);
	//draw the right part
	dc.SetBrush(old);
	dc.DrawRectangle(p2);
	//
	dc.DestroyClippingRegion();
	// draw the text
	grid.DrawTextRectangle(dc, strValue, rect, hAlign, vAlign);
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:56,代码来源:BOINCGridCtrl.cpp

示例10: Draw

void wxSheetCellBitmapRendererRefData::Draw(wxSheet& sheet,
        const wxSheetCellAttr& attr,
        wxDC& dc, const wxRect& rect_,
        const wxSheetCoords& coords,
        bool isSelected)
{
    wxSheetCellRendererRefData::Draw(sheet, attr, dc, rect_, coords, isSelected);

    wxRect rect(rect_);

    wxSize bmpSize;
    if (m_bitmap.Ok())
    {
        bmpSize.x = m_bitmap.GetWidth();
        bmpSize.y = m_bitmap.GetHeight();
    }

    wxSize txtSize(wxSheetCellStringRendererRefData::GetBestSize(sheet, attr, dc, coords));

    if ((txtSize.x == 0) && (bmpSize.x == 0))
        return;

    int margin = 2;

    if ((txtSize.x == 0) || (bmpSize.x == 0))
        margin = 0;


    int txt_align = attr.GetAlignment();
    int bmp_align = m_align;
    wxRect bmpRect(wxPoint(0,0), bmpSize);
    wxRect txtRect(wxPoint(0,0), txtSize);
    if (txtSize.x > 0) txtRect.Inflate(1);
    rect.Inflate(-1);
    AlignBmpTextRects(rect, bmp_align, txt_align, margin, bmpRect, txtRect);
    rect.Inflate(1);

    //dc.SetBrush(*wxTRANSPARENT_BRUSH);
    //dc.SetPen(*wxRED_PEN);
    //dc.DrawRectangle(txtRect);
    //dc.SetPen(*wxGREEN_PEN);
    //dc.DrawRectangle(bmpRect);

    if ((txtRect.width > 0) && (txtRect.height > 0))
        wxSheetCellStringRendererRefData::DoDraw(sheet, attr, dc, txtRect, coords, isSelected);

    if (m_bitmap.Ok() && (bmpRect.width > 0) && (bmpRect.height > 0))
    {
        dc.SetClippingRegion(rect);
        bmpRect.SetPosition(wxSheet::AlignInRect(m_align, bmpRect, bmpSize));
        dc.DrawBitmap(m_bitmap, bmpRect.x, bmpRect.y, true);
        dc.DestroyClippingRegion();
    }
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:54,代码来源:sheetren.cpp

示例11: EraseShape

void MyCanvas::EraseShape(DragShape* shape, wxDC& dc)
{
    wxSize sz = GetClientSize();
    wxRect rect(0, 0, sz.x, sz.y);

    wxRect rect2(shape->GetRect());
    dc.SetClippingRegion(rect2.x, rect2.y, rect2.width, rect2.height);

    wxGetApp().TileBitmap(rect, dc, wxGetApp().GetBackgroundBitmap());

    dc.DestroyClippingRegion();
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:12,代码来源:dragimag.cpp

示例12: DrawTextClipped

void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font, int ybase,
                                  const char *s, int len,
                                  ColourAllocated fore, ColourAllocated back) {
    SetFont(font);
    hdc->SetTextForeground(wxColourFromCA(fore));
    hdc->SetTextBackground(wxColourFromCA(back));
    FillRectangle(rc, back);
    hdc->SetClippingRegion(wxRectFromPRectangle(rc));

    // see comments above
    hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent);
    hdc->DestroyClippingRegion();
}
开发者ID:barsnadcat,项目名称:steelandconcrete,代码行数:13,代码来源:PlatWX.cpp

示例13: Draw

void CellRenderer::Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, const wxRect& rect, int row, int col, bool isSelected)
{
  dc.SetClippingRegion(rect);
  wxGridCellStringRenderer::Draw(grid, attr, dc, rect, row, col, false);

  if( m_Renderer != NULL && imageName != NULL && StrOp.len(imageName) > 0 ) {
    int cx = 0;
    int cy = 0;

    if( imageBitmap == NULL ) {
      wxMemoryDC tmpDC;
      m_Renderer->sizeSvgSym( imageName, wItem.west, &cx, &cy );
      if( imageBitmap != NULL )
        delete imageBitmap;
      imageBitmap = new wxBitmap();
      imageBitmap->Create(cx * 32 * m_Scale, cy * 32 * m_Scale , -1);
      tmpDC.SelectObject(*imageBitmap);
      tmpDC.SetBackground(*wxWHITE_BRUSH);
      tmpDC.Clear();
      tmpDC.SetUserScale( m_Scale, m_Scale );
      m_Renderer->drawSvgSym( (wxPaintDC&)tmpDC, 0, 0, imageName, wItem.west, &cx, &cy );
      tmpDC.SelectObject(wxNullBitmap);

      m_RowSize = cy * 32 * m_Scale + 4;

      if( grid.GetColSize(col) <  cx * 32 * m_Scale )
        grid.SetColSize(col, cx * 32 * m_Scale );
      if( grid.GetRowSize(row) <  m_RowSize )
        grid.SetRowSize(row, m_RowSize );
      TraceOp.trc( "cellrenderer", TRCLEVEL_DEBUG, __LINE__, 9999, "image: %s dc=%X row=%d col=%d cx=%d cy=%d rowsize=%d", imageName,
          &dc, row, col, cx, cy, m_RowSize );
    }

    dc.DrawBitmap(*imageBitmap, rect.x, rect.y + 2);

  }
  else if( imageName != NULL && StrOp.len(imageName) > 0 ) {
    if( imageBitmap == NULL )
      updateImage(rect);
    if( imageBitmap != NULL ) {
      dc.DrawBitmap(*imageBitmap, rect.x, rect.y);
      if( !m_bDidResize ) {
        grid.AutoSizeColumn(col);
        m_bDidResize = true;
      }
    }
  }

  dc.DestroyClippingRegion();
}
开发者ID:KlausMerkert,项目名称:FreeRail,代码行数:50,代码来源:cellrenderer.cpp

示例14: CalculateDCRect

void RoutePoint::CalculateDCRect( wxDC& dc, wxRect *prect )
{
    dc.ResetBoundingBox();
    dc.DestroyClippingRegion();

    // Draw the mark on the dc
    ocpnDC odc( dc );
    Draw( odc, NULL );

    //  Retrieve the drawing extents
    prect->x = dc.MinX() - 1;
    prect->y = dc.MinY() - 1;
    prect->width = dc.MaxX() - dc.MinX() + 2; // Mouse Poop?
    prect->height = dc.MaxY() - dc.MinY() + 2;

}
开发者ID:NicolasJourden,项目名称:OpenCPN,代码行数:16,代码来源:RoutePoint.cpp

示例15: DrawFieldText

void wxStatusBarMac::DrawFieldText(wxDC& dc, const wxRect& rect, int i, int textHeight)
{
    int w, h;
    GetSize( &w , &h );

    wxString text(GetStatusText( i ));

    int xpos = rect.x + wxFIELD_TEXT_MARGIN + 1;
    int ypos = 2 + (rect.height - textHeight) / 2;

    if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL )
        ypos++;

    dc.SetClippingRegion(rect.x, 0, rect.width, h);
    dc.DrawText(text, xpos, ypos);
    dc.DestroyClippingRegion();
}
开发者ID:dconnet,项目名称:wxWidgets,代码行数:17,代码来源:statbrma.cpp


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