本文整理汇总了C++中wxPaintDC类的典型用法代码示例。如果您正苦于以下问题:C++ wxPaintDC类的具体用法?C++ wxPaintDC怎么用?C++ wxPaintDC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxPaintDC类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: render
void LaserPanelLayer::render(wxPaintDC &dc, const CoordScale &drawscale) const {
static wxPen pens[] = {
wxPen(*wxBLUE),
wxPen(*wxGREEN),
wxPen(*wxRED)
};
static wxBrush brushes[] = {
wxBrush(*wxBLUE),
wxBrush(*wxGREEN),
wxBrush(*wxRED)
};
for (int laser=0; laser < readings.size(); laser++) {
const LaserSensor::DistAngleVec &distangles = readings[laser];
for (LaserSensor::DistAngleVec::const_iterator i = distangles.begin(); i != distangles.end(); ++i) {
Coord coord = i->toCoord(M_PI/2);
Pos pos = drawscale.coordToPos(coord.x + 50, 100 - coord.y);
int num = min(laser, 3);
dc.SetPen(pens[num]);
dc.SetBrush(brushes[num]);
dc.DrawCircle(pos.x, pos.y, 1);
}
}
}
开发者ID:matthewbot,项目名称:IEEEGumstix,代码行数:27,代码来源:LaserPanelLayer.cpp
示例2: DrawTrigger
void THISCLASS::DrawTrigger(wxPaintDC &dc, const SwisTrackCoreEventRecorder::Timeline *timeline) {
// Prepare
wxSize dcsize = dc.GetSize();
int dw = dcsize.GetWidth();
int dh = dcsize.GetHeight();
dc.SetBrush(wxBrush(wxColour(0xee, 0xee, 0xee)));
dc.SetPen(wxPen(wxColour(0xee, 0xee, 0xee)));
// Draw
double starttime = -1;
bool active = timeline->mBeginState.mTriggerActive;
SwisTrackCoreEventRecorder::Timeline::tEventList::const_iterator it = timeline->mEvents.begin();
while (it != timeline->mEvents.end()) {
if (it->mType == SwisTrackCoreEventRecorder::sType_BeforeTriggerStart) {
starttime = mSwisTrack->mSwisTrackCore->mEventRecorder->CalculateDuration(&(timeline->mBegin), &(*it));;
active = true;
} else if (it->mType == SwisTrackCoreEventRecorder::sType_AfterTriggerStop) {
double time = mSwisTrack->mSwisTrackCore->mEventRecorder->CalculateDuration(&(timeline->mBegin), &(*it));
DrawTrigger(dc, dw, dh, starttime, time);
starttime = time;
active = false;
}
it++;
}
// Draw last event
if (active) {
DrawTrigger(dc, dw, dh, starttime, -1);
}
}
开发者ID:dtbinh,项目名称:swistrackplus,代码行数:31,代码来源:TimelinePanel.cpp
示例3: RenderPreview
void ImageResource::RenderPreview(wxPaintDC & dc, wxPanel & previewPanel, gd::Project & project)
{
wxLogNull noLog; //We take care of errors.
wxSize size = previewPanel.GetSize();
//Checkerboard background
dc.SetBrush(gd::CommonBitmapProvider::Get()->transparentBg);
dc.DrawRectangle(0,0, size.GetWidth(), size.GetHeight());
wxString fullFilename = GetAbsoluteFile(project);
if ( !wxFile::Exists(fullFilename) )
return;
wxBitmap bmp( fullFilename, wxBITMAP_TYPE_ANY);
if ( bmp.GetWidth() != 0 && bmp.GetHeight() != 0 && (bmp.GetWidth() > previewPanel.GetSize().x || bmp.GetHeight() > previewPanel.GetSize().y) )
{
//Rescale to fit in previewPanel
float xFactor = static_cast<float>(previewPanel.GetSize().x)/static_cast<float>(bmp.GetWidth());
float yFactor = static_cast<float>(previewPanel.GetSize().y)/static_cast<float>(bmp.GetHeight());
float factor = std::min(xFactor, yFactor);
wxImage image = bmp.ConvertToImage();
if ( bmp.GetWidth()*factor >= 5 && bmp.GetHeight()*factor >= 5)
bmp = wxBitmap(image.Scale(bmp.GetWidth()*factor, bmp.GetHeight()*factor));
}
//Display image in the center
if ( bmp.IsOk() )
dc.DrawBitmap(bmp,
(size.GetWidth() - bmp.GetWidth()) / 2,
(size.GetHeight() - bmp.GetHeight()) / 2,
true /* use mask */);
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:35,代码来源:ResourcesManager.cpp
示例4: DrawCharts
void TimeLogChart::DrawCharts(wxPaintDC &dc)
{
if (m_chartCollection == NULL && m_chartCollection->GetCount() == 0)
return;
for (int i = 0; i < m_chartCollection->GetCount(); i++)
{
ChartValueList *list = m_chartCollection->Item(i)->GetData();
int nValues = list->GetCount();
if (nValues > 1)
{
ChartValueList::reverse_iterator iter;
dc.SetPen(wxPen(list->GetColour()));
int dx = m_axisBounds.GetRight();
wxPoint points[nValues];
int n = 0;
for (iter = list->rbegin(); iter != list->rend(); ++iter)
{
dx = m_axisBounds.GetRight() - (int)floor(n*m_axisBounds.GetWidth() / (double)(m_logDuration-1));
double *v = *iter;
int yValue = ValueToPixel(*v);
points[n] = wxPoint(dx, m_axisBounds.GetBottom()-yValue);
n++;
}
dc.DrawSpline(list->GetCount(), points);
}
}
}
开发者ID:VinothRajasekar,项目名称:redis-wxui,代码行数:31,代码来源:simplechart.cpp
示例5: DrawTitle
void TimeLogChart::DrawTitle(wxPaintDC &dc)
{
wxRect titleRect = GetClientRect();
titleRect.SetHeight(m_axisBounds.GetTop());
titleRect.Deflate(m_axisBounds.GetLeft(), 5);
dc.SetFont(*m_titleFont);
dc.DrawText(m_title, titleRect.GetTopLeft());
}
开发者ID:VinothRajasekar,项目名称:redis-wxui,代码行数:9,代码来源:simplechart.cpp
示例6: DrawSquare
void Board::DrawSquare (wxPaintDC &dc, int x, int y, Tetrominoes shape)
{
static wxColour colors[] = { wxColour (0, 0, 0), wxColour (204, 102, 102),
wxColour (102, 204, 102), wxColour (102, 102, 204),
wxColour (204, 204, 102), wxColour (204, 102, 204),
wxColour (102, 204, 204), wxColour (218, 170, 0)
};
static wxColour light[] = { wxColour (0, 0, 0), wxColour (248, 159, 171),
wxColour (121, 252, 121), wxColour (121, 121, 252),
wxColour (252, 252, 121), wxColour (252, 121, 252),
wxColour (121, 252, 252), wxColour (252, 198, 0)
};
static wxColour dark[] = { wxColour (0, 0, 0), wxColour (128, 59, 59),
wxColour (59, 128, 59), wxColour (59, 59, 128),
wxColour (128, 128, 59), wxColour (128, 59, 128),
wxColour (59, 128, 128), wxColour (128, 98, 0)
};
wxPen pen (light[int (shape)]);
pen.SetCap (wxCAP_PROJECTING);
dc.SetPen (pen);
dc.DrawLine (x, y + SquareHeight() - 1, x, y);
dc.DrawLine (x, y, x + SquareWidth() - 1, y);
wxPen darkpen (dark[int (shape)]);
darkpen.SetCap (wxCAP_PROJECTING);
dc.SetPen (darkpen);
dc.DrawLine (x + 1, y + SquareHeight() - 1,
x + SquareWidth() - 1, y + SquareHeight() - 1);
dc.DrawLine (x + SquareWidth() - 1,
y + SquareHeight() - 1, x + SquareWidth() - 1, y + 1);
dc.SetPen (*wxTRANSPARENT_PEN);
dc.SetBrush (wxBrush (colors[int (shape)]));
dc.DrawRectangle (x + 1, y + 1, SquareWidth() - 2,
SquareHeight() - 2);
}
开发者ID:gvsurenderreddy,项目名称:MyDesktop-2,代码行数:34,代码来源:Board.cpp
示例7: DrawRectangle
void TimeLine::DrawRectangle(wxPaintDC& dc, int x1, int y1, int x2, int y2)
{
const wxPen* pen_outline = wxMEDIUM_GREY_PEN;
const wxPen* pen_grey = wxLIGHT_GREY_PEN;
dc.SetPen(*pen_grey);
for( int y = y1; y <= y2; y++ )
{
dc.DrawLine(x1, y, x2, y);
}
dc.SetPen(*pen_outline);
dc.DrawLine(x1, y1, x2, y1);
dc.DrawLine(x1, y2, x2, y2);
}
开发者ID:rickcowan,项目名称:xLights,代码行数:13,代码来源:TimeLine.cpp
示例8: DrawText
static int DrawText(wxPaintDC& arDC, const wxString& arString, int aStartPosition, wxFont& arFont)
{
int Width = 0;
int Height = 0;
if (arString.Length() > 0)
{
arDC.SetFont(arFont);
arDC.GetTextExtent(arString, &Width, &Height);
arDC.DrawText(arString, aStartPosition, 0);
}
return aStartPosition+Width;
}
开发者ID:martsbradley,项目名称:sumtree,代码行数:14,代码来源:StaticText.cpp
示例9: DrawButton
void ButtonPanel::DrawButton(wxPaintDC &dc)
{
int totalWidth=0;
int maxHeight = m_playButton->GetSize().GetHeight();
totalWidth+=m_playButton->GetSize().GetWidth();
totalWidth+=m_previousButton->GetSize().GetWidth();
totalWidth+=m_stopButton->GetSize().GetWidth();
totalWidth+=m_nextButton->GetSize().GetWidth();
totalWidth+=m_browseButton->GetSize().GetWidth();
totalWidth+=m_slider->GetSize().GetWidth();
totalWidth+=25;
wxSize size = GetSize();
// draw background
wxBitmap bg = wxGetBitmapFromMemory(panel_background_bmp,
sizeof(panel_background_bmp));
for(int x=0; x<size.GetWidth(); x+=bg.GetWidth())
dc.DrawBitmap(bg, x, 0, true);
// previous
int x = (size.GetWidth()-totalWidth)/2;
wxSize buttonSize = m_previousButton->GetSize();
int y = (maxHeight-buttonSize.GetHeight())/2;
m_previousButton->Move(wxPoint(x,y));
// stop
x = x + buttonSize.GetWidth()+5;
buttonSize = m_stopButton->GetSize();
y = (maxHeight-buttonSize.GetHeight())/2;
m_stopButton->Move(wxPoint(x,y));
// play
x = x + buttonSize.GetWidth()+5;
buttonSize = m_playButton->GetSize();
y = (maxHeight-buttonSize.GetHeight())/2;
m_playButton->Move(wxPoint(x,y));
// next
x = x + buttonSize.GetWidth()+5;
buttonSize = m_nextButton->GetSize();
y = (maxHeight-buttonSize.GetHeight())/2;
m_nextButton->Move(wxPoint(x,y));
// browse
x = x + buttonSize.GetWidth()+10;
buttonSize = m_browseButton->GetSize();
y = (maxHeight-buttonSize.GetHeight())/2;
m_browseButton->Move(wxPoint(x,y));
// volume slider
x = x + buttonSize.GetWidth()+20;
buttonSize = m_slider->GetSize();
y = (maxHeight-buttonSize.GetHeight())/2;
m_slider->Move(wxPoint(x,y));
}
开发者ID:sopepos,项目名称:imsplayer_osx,代码行数:56,代码来源:ActionPanel.cpp
示例10: doImgPaint
void gcProgressBar::doImgPaint(wxPaintDC& dc)
{
int h = GetSize().GetHeight();
int w = GetSize().GetWidth();
#ifdef WIN32 // unused AFAIK
int ih = m_imgProg->GetSize().GetHeight();
#endif
int iw = m_imgProg->GetSize().GetWidth();
uint32 wp = w*m_uiProg/100;
wxImage scaled = m_imgProg->Scale(iw, h);
wxBitmap norm = GetGCThemeManager()->getSprite(scaled, "progressbar", "Norm");
wxBitmap nedge = GetGCThemeManager()->getSprite(scaled, "progressbar", "NormEdge");
wxBitmap empty = GetGCThemeManager()->getSprite(scaled, "progressbar", "Empty");
wxBitmap tmpBmp(w, h);
wxMemoryDC tmpDC(tmpBmp);
tmpDC.SetBrush(wxBrush(wxColor(255,0,255)));
tmpDC.SetPen( wxPen(wxColor(255,0,255),1) );
tmpDC.DrawRectangle(0,0,w,h);
uint32 neWidth = nedge.GetWidth();
wxColor c(255,0,255);
if (wp == 0)
{
//dont do any thing
}
else if (wp <= neWidth)
{
wxBitmap left = nedge.ConvertToImage().GetSubImage(wxRect(neWidth-wp,0,neWidth,h));
tmpDC.DrawBitmap(left, 0, 0, true);
}
else
{
wxBitmap left(wp-neWidth, h);
gcImage::tileImg(left, norm, &c);
tmpDC.DrawBitmap(left, 0, 0, true);
tmpDC.DrawBitmap(nedge, wp-neWidth, 0, true);
}
wxBitmap right(w-wp, h);
gcImage::tileImg(right, empty, &c);
tmpDC.DrawBitmap(right, wp,0,true);
tmpDC.SelectObject(wxNullBitmap);
doExtraImgPaint(tmpBmp, w, h);
dc.DrawBitmap(tmpBmp, 0,0, true);
}
开发者ID:CSRedRat,项目名称:desura-app,代码行数:56,代码来源:gcProgressBar.cpp
示例11: DoPaint
void MyVideoCaptureWindow::DoPaint( wxPaintDC& dc )
{
wxVideoCaptureWindowBase::DoPaint(dc);
if (!IsDeviceConnected())
{
// The window is blank when disconnected so we might as well
// give a hint to people that they need to connect first.
wxBitmap bmp = wxArtProvider::GetBitmap(wxART_MISSING_IMAGE, wxART_OTHER, wxSize(32, 32));
wxSize clientSize(GetClientSize());
wxString txt(wxT("Please select a capture device"));
wxSize txtSize = dc.GetTextExtent(txt);
dc.DrawText(txt, clientSize.GetWidth()/2 - txtSize.GetWidth()/2,
clientSize.GetHeight()/2 - txtSize.GetHeight());
dc.DrawBitmap(bmp, clientSize.GetWidth()/2 - bmp.GetWidth()/2,
clientSize.GetHeight()/2 + 4);
}
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:20,代码来源:wxvidcap.cpp
示例12: DrawSlider
void SliderPanel::DrawSlider(wxPaintDC &dc)
{
wxColour color;
color.Set(wxT("#DDE1E6"));
dc.SetBackground(wxBrush(color));
dc.Clear();
wxSize size = GetSize();
int width = size.GetWidth();
int height = size.GetHeight();
wxSize size2 = m_slider->GetSize();
int width2 = size2.GetWidth();
int height2 = size2.GetHeight();
int x = (width-width2)/2;
int y = (height-height2)/2;
m_slider->Move(wxPoint(x,y));
}
开发者ID:ktd2004,项目名称:imsplayer,代码行数:20,代码来源:SliderPanel.cpp
示例13: DrawTicks
void THISCLASS::DrawTicks(wxPaintDC &dc, const SwisTrackCoreEventRecorder::Timeline *timeline) {
wxSize dcsize = dc.GetSize();
int dw = dcsize.GetWidth();
//int dh=dcsize.GetHeight(); // Not needed
dc.SetFont(GetFont());
dc.SetPen(wxPen(wxColour(0xcc, 0xcc, 0xcc)));
dc.SetTextForeground(wxColour(0xcc, 0xcc, 0xcc));
// Calculate how many ticks to display
double mintickdistance = 5;
double mintickdistancetime = mintickdistance / mViewScale;
double tickdistancetime = pow(10, ceil(log(mintickdistancetime) / log((double)10)));
// Draw ticks
double endtime = mSwisTrack->mSwisTrackCore->mEventRecorder->CalculateDuration(&(timeline->mBegin), &(timeline->mEnd));
int ticknumber = (int)ceil(-mViewOffset / mViewScale / tickdistancetime);
while (true) {
double xtime = ticknumber * tickdistancetime;
if (xtime >= endtime) {
break;
}
int x = (int)floor(xtime * mViewScale + mViewOffset);
if (x > dw) {
break;
}
if (ticknumber % 10 == 0) {
dc.DrawLine(x, 0, x, 4);
wxString label = wxString::Format(wxT("%d"), (int)(xtime * 1000));
int textwidth, textheight;
GetTextExtent(label, &textwidth, &textheight) ;
textwidth >>= 1;
dc.DrawText(label, x - textwidth, 2);
} else {
开发者ID:dtbinh,项目名称:swistrackplus,代码行数:35,代码来源:TimelinePanel.cpp
示例14: DrawLegends
void TimeLogChart::DrawLegends(wxPaintDC &dc)
{
const int LEGEND_LENGTH = 10;
if (m_chartCollection == NULL && m_chartCollection->GetCount() == 0)
return;
dc.SetFont(*m_valueFont);
wxSize ext = dc.GetTextExtent("H");
int dy = GetClientRect().GetBottom() - ext.GetHeight();
int dx = m_axisBounds.GetLeft();
for (int i = 0; i < m_chartCollection->GetCount(); i++)
{
ChartValueList *list = m_chartCollection->Item(i)->GetData();
dc.SetPen(wxPen(list->GetColour(), 5));
// draw legend with latest value
wxString label = list->GetTitle();
if (list->GetCount() > 0)
{
// get the latest value
double value = *list->GetLast()->GetData()/m_valueAxisScale;
label += " (" + wxString::Format(m_valueAxisFormat, value) + ")";
}
ext = dc.GetTextExtent(label);
dc.DrawLine(dx, dy, dx + LEGEND_LENGTH, dy);
dx += LEGEND_LENGTH + 5;
dc.DrawText(label, dx, dy - ext.GetHeight()/2);
dx += ext.GetWidth() + 20;
}
}
开发者ID:VinothRajasekar,项目名称:redis-wxui,代码行数:33,代码来源:simplechart.cpp
示例15: OnPaintCustom
//-----------------------------------------------------------------------------
void LineProfileCanvas::OnPaintCustom( wxPaintDC& dc )
//-----------------------------------------------------------------------------
{
wxCoord yOffset( 1 ), w( 0 ), h( 0 );
dc.GetSize( &w, &h );
const double scaleX = static_cast<double>( w - 2 * GetBorderWidth() ) / static_cast<double>( ( GetDataCount() == 0 ) ? 1 : GetDataCount() - 1 );
const double scaleY = GetScaleY( h );
DrawMarkerLines( dc, w, h, scaleX );
unsigned int from, to;
GetDrawRange( &from, &to );
const int borderWidth = GetBorderWidth();
const wxString YMarkerString( wxString::Format( wxT( "Draw Range(absolute): %d / %d, " ), from, to ) );
wxCoord xOffset;
dc.GetTextExtent( YMarkerString, &xOffset, 0 );
xOffset += borderWidth / 2;
dc.DrawText( YMarkerString, borderWidth / 2, yOffset );
if( m_boUnsupportedPixelFormat )
{
dc.SetTextForeground( *wxRED );
dc.DrawText( wxString( wxT( "Unsupported pixel format" ) ), xOffset, yOffset );
dc.SetTextForeground( *wxBLACK );
}
else if( m_ppData )
{
for( int channel = 0; channel < m_ChannelCount; channel++ )
{
DrawProfileLine( dc, h, borderWidth + 1, scaleX, scaleY, from, to, m_ppData[channel], GetDataCount(), *m_Pens[channel].pColour_ );
DrawInfoString( dc, wxString::Format( wxT( "%s%s: " ), ( channel != 0 ) ? wxT( ", " ) : wxT( "" ), m_Pens[channel].description_.c_str() ), xOffset, yOffset, *( m_Pens[channel].pColour_ ) );
}
}
}
开发者ID:jmaye,项目名称:libmv,代码行数:32,代码来源:LineProfileCanvas.cpp
示例16: Paint
bool THISCLASS::Paint(wxPaintDC &dc) {
// Get timeline
const SwisTrackCoreEventRecorder::Timeline *timeline = mSwisTrack->mSwisTrackCore->mEventRecorder->GetLastTimeline();
if (timeline == 0) {
return false;
}
// Draw background
dc.SetBackground(wxBrush(wxColour(0xff, 0xff, 0xff)));
dc.Clear();
// Draw
DrawTrigger(dc, timeline);
DrawTicks(dc, timeline);
DrawComponentSteps(dc, timeline);
DrawStepLapTimes(dc, timeline);
DrawSteps(dc, timeline);
DrawStartStop(dc, timeline);
DrawBeginEnd(dc, timeline);
DrawTimelineOverflow(dc, timeline);
return true;
}
开发者ID:dtbinh,项目名称:swistrackplus,代码行数:23,代码来源:TimelinePanel.cpp
示例17: OnPaintCustom
//-----------------------------------------------------------------------------
void PlotCanvasInfoBase::OnPaintCustom( wxPaintDC& dc )
//-----------------------------------------------------------------------------
{
wxCoord xOffset( 1 ), w( 0 ), h( 0 );
dc.GetSize( &w, &h );
const double scaleX = GetScaleX( w );
const double scaleY = GetScaleY( h );
DrawMarkerLines( dc, w, h, scaleX );
const plot_data_type offset = GetOffset();
for( unsigned int i = 0; i < m_PlotCount; i++ )
{
const unsigned int valCount = static_cast<unsigned int>( m_ppPlotValues[i]->size() );
if( valCount > 1 )
{
int lowerStart = h - GetBorderWidth();
dc.SetPen( m_pens[i % COLOUR_COUNT] );
for( unsigned int j = 0; j < valCount - 1; j++ )
{
dc.DrawLine( static_cast<int>( GetBorderWidth() + ( j * scaleX ) + 1 ),
static_cast<int>( lowerStart - ( ( ( *m_ppPlotValues[i] )[j] - offset ) * scaleY ) ),
static_cast<int>( GetBorderWidth() + ( ( j + 1 ) * scaleX ) + 1 ),
static_cast<int>( lowerStart - ( ( ( *m_ppPlotValues[i] )[j + 1] - offset ) * scaleY ) ) );
}
dc.SetPen( wxNullPen );
}
// info in the top left corner
if( m_dataType == ctPropFloat )
{
DrawInfoString( dc, wxString::Format( wxT( "Range: %.3f - %.3f, %s: %s " ), m_CurrentMinPlotValues[i], m_CurrentMaxPlotValues[i], GetPlotIdentifierPrefix().c_str(), m_PlotIdentifiers[i].c_str() ), xOffset, 1, m_pens[i] );
}
else
{
DrawInfoString( dc, wxString::Format( wxT( "Range: %lld - %lld, %s: %s " ), static_cast<int64_type>( m_CurrentMinPlotValues[i] ), static_cast<int64_type>( m_CurrentMaxPlotValues[i] ), GetPlotIdentifierPrefix().c_str(), m_PlotIdentifiers[i].c_str() ), xOffset, 1, m_pens[i] );
}
}
}
开发者ID:qintony,项目名称:sensor_drivers,代码行数:37,代码来源:PlotCanvasInfo.cpp
示例18: DrawTriangleMarkerFacingRight
void TimeLine::DrawTriangleMarkerFacingRight(wxPaintDC& dc, int& play_start_mark, const int& tri_size, int& height)
{
const wxPen* pen_black = wxBLACK_PEN;
const wxPen* pen_grey = wxLIGHT_GREY_PEN;
int y_top = height-tri_size;
int y_bottom = y_top;
int arrow_end = play_start_mark - 1;
dc.SetPen(*pen_grey);
for( ; y_bottom < height-1; y_bottom++, y_top--, arrow_end-- )
{
dc.DrawLine(arrow_end,y_top,arrow_end,y_bottom);
}
dc.SetPen(*pen_black);
dc.DrawLine(play_start_mark,y_top,play_start_mark,height-1);
dc.DrawLine(play_start_mark-1,height-tri_size,arrow_end,y_top);
dc.DrawLine(play_start_mark-1,height-tri_size,arrow_end,y_bottom);
dc.DrawLine(arrow_end,y_top,arrow_end,y_bottom);
}
开发者ID:rickcowan,项目名称:xLights,代码行数:18,代码来源:TimeLine.cpp
示例19: render
void RobotPanelLayer::render(wxPaintDC &dc, const CoordScale &drawscale) const {
const float minsize = min(drawscale.sx/gridscale.sx, drawscale.sy/gridscale.sy);
Pos pos = drawscale.coordToPos(robot.getPosition());
const float thickness = minsize * .3;
const float dir = robot.getDirection();
wxPoint points[3];
points[0].x = (int)(pos.x + thickness*cos(dir));
points[0].y = (int)(pos.y - thickness*sin(dir));
points[1].x = (int)(pos.x + thickness*cos(dir + 5*M_PI/4));
points[1].y = (int)(pos.y - thickness*sin(dir + 5*M_PI/4));
points[2].x = (int)(pos.x + thickness*cos(dir - 5*M_PI/4));
points[2].y = (int)(pos.y - thickness*sin(dir - 5*M_PI/4));
dc.DrawPolygon(3, points);
wxBrush victimbrush(wxColour(150, 200, 130));
const RoomPlanner::Plan &plan = robot.getPlan();
if (plan.identifyvictim)
dc.SetBrush(victimbrush);
const float radius = max(minsize*.1f, 3.0f);
for (int i = 0; i != plan.coords.size(); ++i) {
Pos p = drawscale.coordToPos(plan.coords[i]);
float dirrad = dirToRad(plan.facedirs[i]);
dc.DrawCircle(p.x, p.y, radius);
const float len = minsize*0.3;
const float endx = p.x+len*cos(dirrad);
const float endy = p.y-len*sin(dirrad);
dc.DrawLine(p.x, p.y, endx, endy);
dc.DrawCircle(endx, endy, 1);
}
const int crossdelta = (int)(minsize*0.15f);
const PosSet &victims = robot.getIdentifiedVictims();
for (PosSet::const_iterator i = victims.begin(); i != victims.end(); ++i) {
Pos pos = drawscale.coordToPos(victimscale.posToCoord(*i));
dc.DrawLine(pos.x-crossdelta, pos.y-crossdelta, pos.x+crossdelta+1, pos.y+crossdelta+1);
dc.DrawLine(pos.x-crossdelta, pos.y+crossdelta, pos.x+crossdelta+1, pos.y-crossdelta-1);
}
}
开发者ID:matthewbot,项目名称:IEEEGumstix,代码行数:44,代码来源:RobotPanelLayer.cpp
示例20: frame
void CMyGLCanvas_DisplayWindow3D::OnPostRenderSwapBuffers(
double At, wxPaintDC& dc)
{
if (m_win3D) m_win3D->internal_setRenderingFPS(At > 0 ? 1.0 / At : 1e9);
// If we are requested to do so, grab images to disk as they are rendered:
string grabFile;
if (m_win3D) grabFile = m_win3D->grabImageGetNextFile();
if (m_win3D && (!grabFile.empty() || m_win3D->isCapturingImgs()))
{
int w, h;
dc.GetSize(&w, &h);
// Save image directly from OpenGL - It could also use 4 channels and
// save with GL_BGRA_EXT
CImage::Ptr frame(new CImage(w, h, 3, false));
glReadBuffer(GL_FRONT);
glReadPixels(0, 0, w, h, GL_BGR_EXT, GL_UNSIGNED_BYTE, (*frame)(0, 0));
if (!grabFile.empty())
{
frame->saveToFile(grabFile);
m_win3D->internal_emitGrabImageEvent(grabFile);
}
if (m_win3D->isCapturingImgs())
{
{
std::lock_guard<std::mutex> lock(
m_win3D->m_last_captured_img_cs);
m_win3D->m_last_captured_img = frame;
frame.reset();
}
}
}
}
开发者ID:Triocrossing,项目名称:mrpt,代码行数:36,代码来源:CDisplayWindow3D.cpp
注:本文中的wxPaintDC类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论