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


C++ wxMemoryDC类代码示例

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


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

示例1: DrawMouseoverMarker

void LineChart::DrawMouseoverMarker(wxMemoryDC &dc){

	dc.SetPen(*wxThePenList->FindOrCreatePen(*wxWHITE, 1, wxSOLID));
	dc.DrawLine(m_mouseX, 0, m_mouseX, _currentHeight);

	size_t dataIndex = (size_t)(((double)GetMaxSeriesBufferSize()) * m_viewOffsetFactor) + m_mouseX - m_leftEdge;
	DrawCurrentValues(dc, dataIndex, m_mouseX, m_mouseY);
}
开发者ID:BMWPower,项目名称:RaceAnalyzer,代码行数:8,代码来源:lineChart.cpp

示例2: wxMemoryDC

void
TstLayer_t::_updateDC(void)
{
    if (mDC) delete mDC;
    mDC = new wxMemoryDC(*mSurface);
    mDC->SetBackground(*wxBLACK_BRUSH);
    mDC->SetPen(*_pen);
}
开发者ID:charlesw1234,项目名称:learning,代码行数:8,代码来源:tst-wx.cpp

示例3: DrawCurrentValues

void StripChart::DrawCurrentValues(wxMemoryDC &dc){
	
	//see if data was logged for the mouse location
	int dataBufferSize = _dataBuffer.size();
	float zoomFactor = (float)_zoomPercentage / 100.0;
	int dataBufferIndex = dataBufferSize - (int)(((float)(_currentWidth - _mouseX)) / zoomFactor) - 1;
	//adjust for uboundoffset
	dataBufferIndex-=((dataBufferSize - 1) -_currentDataBufferUBound);
	if (dataBufferIndex < 0 || dataBufferIndex >= dataBufferSize) return;
	
	
	dc.SetPen(*wxThePenList->FindOrCreatePen(*wxWHITE, 1, wxSOLID));
	dc.DrawLine(_mouseX, 0, _mouseX, _currentHeight);

	int currentOffset = 0;
	StripChartLogItem logItem = _dataBuffer[dataBufferIndex];
	
	wxDateTime timestamp = logItem.GetTimestamp();
	
	wxDateTime fromTime;
	switch(_timespanMode){
		case TIMESPAN_FROM_LAST_LOG_ENTRY:
		{
			StripChartLogItem lastLogItem = _dataBuffer[dataBufferSize - 1];
			fromTime = lastLogItem.GetTimestamp();
			break;
		}
		case TIMESPAN_FROM_NOW:
			fromTime = wxDateTime::UNow();
			break;
	}
	wxTimeSpan span =  (fromTime - timestamp);
	wxString timeString = wxString::Format("%d seconds back",(int)span.GetSeconds().ToLong());
	
	
	wxFont labelFont = GetFont();
	int labelWidth,labelHeight,descent,externalLeading;
	dc.GetTextExtent(timeString, &labelHeight, &labelWidth, &descent, &externalLeading, &labelFont);
	dc.SetTextForeground(*wxWHITE);
	
	dc.DrawRotatedText(timeString, _mouseX - labelWidth, _mouseY,90);
	
	for (LogItemTypes::iterator it = _logItemTypes.begin(); it != _logItemTypes.end(); ++it){

		wxString key = it->first;		
		LogItemType *logItemType = it->second;
		ChartScale *scale = &_chartScales[logItemType->scaleId];
		
		dc.SetTextForeground(logItemType->lineColor);

		int value = logItem[logItemType->typeKey];
		wxString valueString = logItemType->typeLabel + ": " + wxString::Format("%d",value) + " " +scale->scaleLabel;

		dc.GetTextExtent(valueString, &labelHeight, &labelWidth, &descent, &externalLeading, &labelFont);
		
		currentOffset += labelWidth;
		dc.DrawRotatedText(valueString,_mouseX - labelHeight - 15, _mouseY - currentOffset,0);
	}
}
开发者ID:BMWPower,项目名称:gaugeWorks,代码行数:59,代码来源:StripChart.cpp

示例4: DrawHighlightedShapes

void ConnectivityHistCanvas::DrawHighlightedShapes(wxMemoryDC &dc)
{
    dc.SetPen(wxPen(highlight_color));
    dc.SetBrush(wxBrush(highlight_color, wxBRUSHSTYLE_CROSSDIAG_HATCH));

    for (int i=0, iend=selectable_shps.size(); i<iend; i++) {
        if (ival_obs_sel_cnt[i] == 0) continue;
        double s = (((double) ival_obs_sel_cnt[i]) /
                    ((double) ival_obs_cnt[i]));
        GdaRectangle* rec = (GdaRectangle*) selectable_shps[i];
        dc.DrawRectangle(rec->lower_left.x, rec->lower_left.y,
                         rec->upper_right.x - rec->lower_left.x,
                         (rec->upper_right.y - rec->lower_left.y)*s);
    }
}
开发者ID:ndon-ndon,项目名称:geoda,代码行数:15,代码来源:ConnectivityHistView.cpp

示例5: wxDCImpl

wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ) :
   wxDCImpl( owner )
{
#if defined(__WXMSW__) && wxUSE_WXDIB
    // It seems that GDI+ sets invalid values for alpha channel when used with
    // a compatible bitmap (DDB). So we need to convert the currently selected
    // bitmap to a DIB before using it with any GDI+ functions to ensure that
    // we get the correct alpha channel values in it at the end.

    wxBitmap bmp = dc.GetSelectedBitmap();
    wxASSERT_MSG( bmp.IsOk(), "Should select a bitmap before creating wxGCDC" );

    // We don't need to convert it if it can't have alpha at all (any depth but
    // 32) or is already a DIB with alpha.
    if ( bmp.GetDepth() == 32 && (!bmp.IsDIB() || !bmp.HasAlpha()) )
    {
        // We need to temporarily deselect this bitmap from the memory DC
        // before modifying it.
        const_cast<wxMemoryDC&>(dc).SelectObject(wxNullBitmap);

        bmp.ConvertToDIB(); // Does nothing if already a DIB.

        if( !bmp.HasAlpha() )
        {
            // Initialize alpha channel, even if we don't have any alpha yet,
            // we should have correct (opaque) alpha values in it for GDI+
            // functions to work correctly.
            {
                wxAlphaPixelData data(bmp);
                if ( data )
                {
                    wxAlphaPixelData::Iterator p(data);
                    for ( int y = 0; y < data.GetHeight(); y++ )
                    {
                        wxAlphaPixelData::Iterator rowStart = p;

                        for ( int x = 0; x < data.GetWidth(); x++ )
                        {
                            p.Alpha() = wxALPHA_OPAQUE;
                            ++p;
                        }

                        p = rowStart;
                        p.OffsetY(data, 1);
                    }
                }
            } // End of block modifying the bitmap.

            // Using wxAlphaPixelData sets the internal "has alpha" flag but we
            // don't really have any alpha yet, so reset it back for now.
            bmp.ResetAlpha();
        }

        // Undo SelectObject() at the beginning of this block.
        const_cast<wxMemoryDC&>(dc).SelectObjectAsSource(bmp);
    }
#endif // wxUSE_WXDIB

    Init(wxGraphicsContext::Create(dc));
}
开发者ID:emutavchi,项目名称:pxCore,代码行数:60,代码来源:dcgraph.cpp

示例6: DrawSolvePath

void DrawSolvePath(wxMemoryDC &mem)
{
  unsigned int route_count=0;
  unsigned int x=0,y=0;

  wxBrush yellowback(wxColour(255,255,0),wxSOLID);
  wxPen yellow(wxColour(255,255,0),1,wxSOLID);


  while ( GetRouteWaypoint(GetWorldHandler(),0,route_count,&x,&y) == 1 )
    {
      mem.SetPen(yellow);
      mem.SetBrush(yellowback);

      mem.DrawRectangle(x*map_box_size,y*map_box_size,map_box_size,map_box_size);
      ++route_count;
    }

  //printf("Drawing Level 1 Lines \n");
  wxPen redfat(wxColour(255,0,0),3,wxSOLID);
  unsigned int oldx=0,oldy=0;
  if ( GetStraightRouteWaypoint(GetWorldHandler(),OURROBOT,0,&oldx,&oldy)==1 ) { mem.DrawCircle(oldx*10+5,oldy*10+5,3); }
  route_count=1;
  while ( GetStraightRouteWaypoint(GetWorldHandler(),OURROBOT,route_count,&x,&y)==1 )
    {
      mem.SetPen(redfat);
      mem.DrawCircle(x*map_box_size+map_box_size_half,y*map_box_size+map_box_size_half,3);
      mem.DrawLine(oldx*map_box_size+map_box_size_half,oldy*map_box_size+map_box_size_half,x*map_box_size+map_box_size_half,y*map_box_size+map_box_size_half);
      ++route_count;
      oldx = x , oldy = y ;
    }
  return;
}
开发者ID:AmmarkoV,项目名称:RoboVision,代码行数:33,代码来源:MapOverview.cpp

示例7: DrawBackground

void FreqWindow::DrawBackground(wxMemoryDC & dc)
{
   Layout();

   if (mBitmap)
   {
      delete mBitmap;
      mBitmap = NULL;
   }

   mPlotRect = mFreqPlot->GetClientRect();

   mBitmap = new wxBitmap(mPlotRect.width, mPlotRect.height);

   dc.SelectObject(*mBitmap);

   dc.SetBackground(wxBrush(wxColour(254, 254, 254)));// DONT-THEME Mask colour.
   dc.Clear();

   dc.SetPen(*wxBLACK_PEN);
   dc.SetBrush(*wxWHITE_BRUSH);
   dc.DrawRectangle(mPlotRect);

   dc.SetFont(mFreqFont);
}
开发者ID:LarryPAC,项目名称:audacity,代码行数:25,代码来源:FreqWindow.cpp

示例8: DrawSelectableShapes

void BoxNewPlotCanvas::DrawSelectableShapes(wxMemoryDC &dc)
{
	LOG_MSG("In BoxNewPlotCanvas::DrawSelectableShapes");
	int radius = TemplateCanvas::markers_size;
	for (int t=cur_first_ind; t<=cur_last_ind; t++) {
		int min_IQR = hinge_stats[t].min_IQR_ind;
		int max_IQR = hinge_stats[t].max_IQR_ind;
		int ind_base = (t-cur_first_ind)*num_obs;
		dc.SetPen(GdaConst::boxplot_point_color);
		dc.SetBrush(*wxWHITE_BRUSH);
		for (int i=0; i<min_IQR; i++) {
			int ind = ind_base + data_sorted[t][i].second;
			dc.DrawCircle(selectable_shps[ind]->center, radius);
		}
		for (int i=max_IQR+1; i<num_obs; i++) {
			int ind = ind_base + data_sorted[t][i].second;
			dc.DrawCircle(selectable_shps[ind]->center, radius);
		}
		int iqr_s = GenUtils::max<double>(min_IQR, 0);
		int iqr_t = GenUtils::min<double>(max_IQR, num_obs-1);
		dc.SetPen(GdaConst::boxplot_q1q2q3_color);
		dc.SetBrush(GdaConst::boxplot_q1q2q3_color);
		for (int i=iqr_s; i<=iqr_t; i++) {
			int ind = ind_base + data_sorted[t][i].second;
			GdaRectangle* rec = (GdaRectangle*) selectable_shps[ind];
			dc.DrawRectangle(rec->lower_left.x, rec->lower_left.y,
							 rec->upper_right.x - rec->lower_left.x,
							 rec->upper_right.y - rec->lower_left.y);
		}
	}	
}
开发者ID:grzegorz-m-dziedzic,项目名称:geoda,代码行数:31,代码来源:BoxNewPlotView.cpp

示例9: DrawEndPoint

void DrawEndPoint(wxMemoryDC &mem,unsigned int endx,unsigned int endy)
{
  wxBrush blueback(wxColour(0,0,255),wxSOLID);
  wxPen black(wxColour(0,0,0),1,wxSOLID);
  wxPen red(wxColour(255,0,0),1,wxSOLID);

  if ( (endx!=0) || (endy!=0) )
    {
      int parent=0;//Get_Object_PathPlanning(endx,endy,1);

      mem.SetBrush(blueback);
      if ( parent!=0 ) mem.SetPen(red);
      else
        mem.SetPen(black);

      mem.DrawRectangle(endx*map_box_size-map_box_size_half,endy*map_box_size-map_box_size_half,map_box_size,map_box_size);
    }
}
开发者ID:AmmarkoV,项目名称:RoboVision,代码行数:18,代码来源:MapOverview.cpp

示例10: DrawCurrentValues

void LineChart::DrawCurrentValues(wxMemoryDC &dc, size_t dataIndex, int x, int y){
	int currentOffset = 0;
	wxFont labelFont = GetFont();
	int labelWidth,labelHeight,descent,externalLeading;

	for (SeriesMap::iterator it = m_seriesMap.begin(); it != m_seriesMap.end(); ++it){

		Series *series = it->second;
		double dataValue = series->GetValueAtOrNear(dataIndex);
		wxString numberFormat = "% 2." + wxString::Format("%df", series->GetPrecision());
		wxString valueString = (DatalogValue::NULL_VALUE == dataValue ? "---" : wxString::Format(numberFormat.ToAscii(), dataValue)) + " " + series->GetLabel();
		dc.SetTextForeground(series->GetColor());
		dc.GetTextExtent(valueString, &labelHeight, &labelWidth, &descent, &externalLeading, &labelFont);

		dc.DrawRotatedText(valueString, x + CURRENT_VALUES_RIGHT_OFFSET, y + currentOffset,0);
		currentOffset += labelWidth;
	}
}
开发者ID:BMWPower,项目名称:RaceAnalyzer,代码行数:18,代码来源:lineChart.cpp

示例11: SetFont

//set the font on memDC such that text can fit in specified width and height
void ExportMixerPanel::SetFont( wxMemoryDC &memDC, wxString text, int width,
                                int height )
{
    int l = 0, u = 13, m, w, h;
    wxFont font = memDC.GetFont();
    while( l < u - 1 )
    {
        m = ( l + u ) / 2;
        font.SetPointSize( m );
        memDC.SetFont( font );
        memDC.GetTextExtent( text, &w, &h );

        if( w < width && h < height )
            l = m;
        else
            u = m;
    }
    font.SetPointSize( l );
    memDC.SetFont( font );
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:21,代码来源:Export.cpp

示例12: WXUNUSED

// On some platforms, notably Mac OS X with Core Graphics, we can't blit from
// a window, so we need to draw the background explicitly.
bool MyDragImage::UpdateBackingFromWindow(wxDC& WXUNUSED(windowDC), wxMemoryDC& destDC, const wxRect& WXUNUSED(sourceRect),
                    const wxRect& destRect) const
{
    destDC.SetClippingRegion(destRect);

    if (wxGetApp().GetBackgroundBitmap().IsOk())
        wxGetApp().TileBitmap(destRect, destDC, wxGetApp().GetBackgroundBitmap());

    m_canvas->DrawShapes(destDC);
    return true;
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:13,代码来源:dragimag.cpp

示例13: RenderRegionViewOnDC

bool ChartPlugInWrapper::RenderRegionViewOnDC(wxMemoryDC& dc, const ViewPort& VPoint,
                                              const wxRegion &Region)
{
      if(m_ppicb)
      {
            PlugIn_ViewPort pivp = CreatePlugInViewport( VPoint);
            dc.SelectObject(m_ppicb->RenderRegionView( pivp, Region));
            return true;
      }
      else
            return false;
}
开发者ID:biiont,项目名称:OpenCPN,代码行数:12,代码来源:pluginmanager.cpp

示例14: DrawHighlightedShapes

void BoxNewPlotCanvas::DrawHighlightedShapes(wxMemoryDC &dc)
{
	int radius = 3;
	std::vector<bool>& hs = highlight_state->GetHighlight();
	
	dc.SetBrush(highlight_color);
	for (int t=cur_first_ind; t<=cur_last_ind; t++) {
		int min_IQR = hinge_stats[t].min_IQR_ind;
		int max_IQR = hinge_stats[t].max_IQR_ind;
		int ind_base = (t-cur_first_ind)*num_obs;
		dc.SetPen(*wxRED_PEN);
		for (int i=0; i<min_IQR; i++) {
			if (!hs[data_sorted[t][i].second]) continue;
			int ind = ind_base + data_sorted[t][i].second;
			dc.DrawCircle(selectable_shps[ind]->center, radius);
		}
		for (int i=max_IQR+1; i<num_obs; i++) {
			if (!hs[data_sorted[t][i].second]) continue;
			int ind = ind_base + data_sorted[t][i].second;
			dc.DrawCircle(selectable_shps[ind]->center, radius);
		}
		int iqr_s = GenUtils::max<double>(min_IQR, 0);
		int iqr_t = GenUtils::min<double>(max_IQR, num_obs-1);
		dc.SetPen(highlight_color);
		for (int i=iqr_s; i<=iqr_t; i++) {
			if (!hs[data_sorted[t][i].second]) continue;
			int ind = ind_base + data_sorted[t][i].second;
			GdaRectangle* rec = (GdaRectangle*) selectable_shps[ind];
			dc.DrawRectangle(rec->lower_left.x, rec->lower_left.y,
							 rec->upper_right.x - rec->lower_left.x,
							 rec->upper_right.y - rec->lower_left.y);
		}
	}
}
开发者ID:grzegorz-m-dziedzic,项目名称:geoda,代码行数:34,代码来源:BoxNewPlotView.cpp

示例15: DrawGrid

void LineChart::DrawGrid(wxMemoryDC &dc){

	dc.SetPen(*wxThePenList->FindOrCreatePen(wxColor(40,40,40), 1, wxSOLID));

	int width = _currentWidth;
	int height = _currentHeight;

	float zoomFactor = (float)_zoomPercentage / 100;

	int gridIncrement = (int)(GRID_SIZE * zoomFactor);

	for (int x = width; x >=0 ; x -= gridIncrement){
		dc.DrawLine(x, 0, x, height);
	}

	float i = 0;
	while (i < 1){
		int y = (int)(((float)height) * i);
		dc.DrawLine(0, y, width, y);
		i = i + 0.1;
	}
}
开发者ID:BMWPower,项目名称:RaceAnalyzer,代码行数:22,代码来源:lineChart.cpp


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