本文整理汇总了C++中wxDC::DrawEllipse方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::DrawEllipse方法的具体用法?C++ wxDC::DrawEllipse怎么用?C++ wxDC::DrawEllipse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDC
的用法示例。
在下文中一共展示了wxDC::DrawEllipse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void Envelope::Draw(wxDC & dc, wxRect & r, double h, double pps, bool dB)
{
h -= mOffset;
double tright = h + (r.width / pps);
dc.SetPen(AColor::envelopePen);
dc.SetBrush(*wxWHITE_BRUSH);
int ctr, height;
if (mMirror) {
height = r.height / 2;
ctr = r.y + height;
}
else {
height = r.height;
ctr = r.y + height;
}
int len = mEnv.Count();
for (int i = 0; i < len; i++) {
if (mEnv[i]->t >= h && mEnv[i]->t <= tright) {
if (i == mDragPoint) {
dc.SetPen(AColor::envelopePen);
dc.SetBrush(AColor::envelopeBrush);
}
double v = mEnv[i]->val;
int x = int ((mEnv[i]->t - h) * pps);
int y;
if (dB)
y = int (toDB(v) * height);
else
y = int (v * height);
wxRect circle(r.x + x - 1, ctr - y, 4, 4);
dc.DrawEllipse(circle);
if (mMirror) {
circle.y = ctr + y - 2;
dc.DrawEllipse(circle);
}
if (i == mDragPoint) {
dc.SetPen(AColor::envelopePen);
dc.SetBrush(*wxWHITE_BRUSH);
}
}
}
}
示例2: DrawPoint
void DrawPoint(wxDC & dc, wxRect & r, int x, int y, bool top, bool contour)
{
if (y >= 0 && y <= r.height) {
if(contour){
wxRect circle(r.x + x - 2, r.y + y - 2,
4, 4);
dc.DrawEllipse(circle);
}else{
wxRect circle(r.x + x - 2, r.y + (top? y-1: y-4),
4, 4);
dc.DrawEllipse(circle);
}
}
}
示例3: DrawPoint
/// TODO: This should probably move to track artist.
static void DrawPoint(wxDC & dc, const wxRect & r, int x, int y, bool top)
{
if (y >= 0 && y <= r.height) {
wxRect circle(r.x + x, r.y + (top ? y - 1: y - 2), 4, 4);
dc.DrawEllipse(circle);
}
}
示例4: BenchmarkEllipses
void BenchmarkEllipses(const wxString& msg, wxDC& dc)
{
if ( !opts.testEllipses )
return;
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
dc.SetBrush( *wxBLUE_BRUSH );
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
wxStopWatch sw;
for ( long n = 0; n < opts.numIters; n++ )
{
int x = rand() % opts.width,
y = rand() % opts.height;
dc.DrawEllipse(x, y, 48, 32);
}
const long t = sw.Time();
wxPrintf("%ld ellipses done in %ldms = %gus/ellipse\n",
opts.numIters, t, (1000. * t)/opts.numIters);
}
示例5: OnDraw
// Define the repainting behaviour
void MyCanvas::OnDraw(wxDC& dc)
{
dc.SetFont(*wxSWISS_FONT);
dc.SetPen(*wxGREEN_PEN);
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
dc.SetBrush(*wxCYAN_BRUSH);
dc.SetPen(*wxRED_PEN);
dc.DrawRectangle(100, 100, 100, 50);
dc.DrawRoundedRectangle(150, 150, 100, 50, 20);
dc.DrawEllipse(250, 250, 100, 50);
#if wxUSE_SPLINES
dc.DrawSpline(50, 200, 50, 100, 200, 10);
#endif // wxUSE_SPLINES
dc.DrawLine(50, 230, 200, 230);
dc.DrawText(wxT("This is a test string"), 50, 230);
wxPoint points[3];
points[0].x = 200; points[0].y = 300;
points[1].x = 100; points[1].y = 400;
points[2].x = 300; points[2].y = 400;
dc.DrawPolygon(3, points);
}
示例6: Draw
void wxHtmlListmarkCell::Draw(wxDC& dc, int x, int y,
int WXUNUSED(view_y1), int WXUNUSED(view_y2),
wxHtmlRenderingInfo& WXUNUSED(info))
{
dc.SetBrush(m_Brush);
dc.DrawEllipse(x + m_PosX + m_Width / 3, y + m_PosY + m_Height / 3,
(m_Width / 3), (m_Width / 3));
}
示例7: DrawPath
void DrawPath(wxDC& dc, const CalChartConfiguration& config, const std::vector<CC_DrawCommand>& draw_commands, const CC_coord& end)
{
dc.SetBrush(*wxTRANSPARENT_BRUSH);
auto brushAndPen = config.Get_CalChartBrushAndPen(COLOR_PATHS);
dc.SetPen(brushAndPen.second);
DrawCC_DrawCommandList(dc, draw_commands);
dc.SetBrush(brushAndPen.first);
float circ_r = Float2Coord(config.Get_DotRatio());
dc.DrawEllipse(end.x - circ_r/2, end.y - circ_r/2, circ_r, circ_r);
}
示例8: pen
/*
* Here we do the actual rendering. I put it in a separate
* method so that it can work no matter what type of DC
* (e.g. wxPaintDC or wxClientDC) is used.
*/
void
pcl::visualization::ImageWidgetWX::ImagePanel::render (wxDC& dc)
{
//cout << __PRETTY_FUNCTION__<<" called.\n";
if (image==NULL) return;
int newWidth, newHeight;
dc.GetSize (&newWidth, &newHeight);
if (newWidth != scaledWidth || newHeight != scaledHeight)
{
resizeImage (newWidth, newHeight);
}
dc.DrawBitmap (resized_, 0, 0, false);
int circleSize = 4;
for (unsigned int i = 0; i < markedPoints.size (); ++i)
{
const ImagePoint& point = markedPoints.at (i);
dc.SetPen (*point.color);
dc.SetBrush (*point.background);
dc.DrawEllipse (pcl_lrint ((point.x+0.5f)*scaledWidth / image->GetWidth ())-0.5f*circleSize,
pcl_lrint ((point.y+0.5f)*scaledHeight / image->GetHeight ())-0.5f*circleSize, circleSize, circleSize);
}
for (unsigned int i = 0; i < lines.size (); ++i)
{
const ImageLine& line = lines.at (i);
wxPoint points_array[2];
points_array[0].x = pcl_lrint ((line.x1+0.5f)*scaledWidth / image->GetWidth ());
points_array[0].y = pcl_lrint ((line.y1+0.5f)*scaledHeight / image->GetHeight ());
points_array[1].x = pcl_lrint((line.x2+0.5f)*scaledWidth / image->GetWidth ());
points_array[1].y = pcl_lrint((line.y2+0.5f)*scaledHeight / image->GetHeight ());
wxPen pen(*line.color);
pen.SetWidth(3);
dc.SetPen(pen);
dc.DrawLines (2, points_array);
}
if (getParentImageWidget()->visualize_selected_point)
{
int selected_x = getParentImageWidget()->last_clicked_point_x,
selected_y = getParentImageWidget()->last_clicked_point_y;
if (selected_x >= 0 && selected_y >= 0)
{
wxPen pen(*wxGREEN, 2);
dc.SetPen (pen);
dc.CrossHair (pcl_lrint((selected_x+0.5f)*scaledWidth / image->GetWidth ()),
pcl_lrint((selected_y+0.5f)*scaledHeight / image->GetHeight ()));
}
}
}
示例9: Draw
// do something that the default renderer doesn't here just to show that it is
// possible to alter the appearance of the cell beyond what the attributes
// allow
void MyGridCellRenderer::Draw(wxGrid& grid,
wxGridCellAttr& attr,
wxDC& dc,
const wxRect& rect,
int row, int col,
bool isSelected)
{
wxGridCellStringRenderer::Draw(grid, attr, dc, rect, row, col, isSelected);
dc.SetPen(*wxGREEN_PEN);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawEllipse(rect);
}
示例10: draw
void Guy::draw(wxDC& dc) const {
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(wxBrush(color));
const int midx = left + width/2;
const int midy = top + height/2;
const int legs = height/4; // offset of arms & legs
const int head = width/4;
dc.DrawLine(midx, midy-legs, midx, midy+legs); // body
dc.DrawLine(midx, midy-legs, left, midy); // left arm
dc.DrawLine(midx, midy-legs, width+left, midy); // right arm
dc.DrawLine(midx, midy+legs, left, top+height); // left leg
dc.DrawLine(midx, midy+legs, left+width, top+height); // right leg
dc.DrawEllipse(midx-head/2, top, head, legs); // head
}
示例11: OnDraw
void wxEllipseShape::OnDraw(wxDC &dc)
{
if (m_shadowMode != SHADOW_NONE)
{
if (m_shadowBrush)
dc.SetBrush(* m_shadowBrush);
dc.SetPen(* g_oglTransparentPen);
dc.DrawEllipse((long) ((m_xpos - GetWidth() / 2) + m_shadowOffsetX),
(long) ((m_ypos - GetHeight() / 2) + m_shadowOffsetY),
(long) GetWidth(), (long) GetHeight());
}
if (m_pen)
{
if (m_pen->GetWidth() == 0)
dc.SetPen(* g_oglTransparentPen);
else
dc.SetPen(* m_pen);
}
if (m_brush)
dc.SetBrush(* m_brush);
dc.DrawEllipse((long) (m_xpos - GetWidth() / 2), (long) (m_ypos - GetHeight() / 2), (long) GetWidth(), (long) GetHeight());
}
示例12: HandlePaint_BouncingBall
void Lyrics::HandlePaint_BouncingBall(wxDC &dc)
{
int ctr = mWidth / 2;
int x;
double y;
GetKaraokePosition(mT, &x, &y);
dc.SetTextForeground(wxColour(238, 0, 102));
bool changedColor = false;
SetDrawnFont(&dc);
unsigned int i;
wxCoord yTextTop = mKaraokeHeight - mTextHeight - 4;
for(i=0; i<mSyllables.GetCount(); i++) {
if (mSyllables[i].x + mSyllables[i].width < (x - ctr))
continue;
if (mSyllables[i].x > x + ctr)
continue;
if (!changedColor && mSyllables[i].x >= x) {
dc.SetTextForeground(*wxBLACK);
changedColor = true;
}
wxString text = mSyllables[i].text;
if (text.Length() > 0 && text.Right(1) == wxT("_")) {
text = text.Left(text.Length() - 1);
}
dc.DrawText(text,
mSyllables[i].leftX + ctr - x,
yTextTop);
}
int ballRadius = (int)(mTextHeight / 8.0);
int bounceTop = ballRadius * 2;
int bounceHeight = yTextTop - bounceTop;
int yi = (int)(yTextTop - 4 - (y * bounceHeight));
if (mT >= 0.0) {
wxRect ball(ctr - ballRadius, yi - ballRadius, 2 * ballRadius, 2 * ballRadius);
dc.SetBrush(wxBrush(wxColour(238, 0, 102), wxSOLID));
dc.DrawEllipse(ball);
}
}
示例13: OnDraw
// Define the repainting behaviour
void MyCanvas::OnDraw(wxDC& dc)
{
// vars to use ...
#if wxUSE_STATUSBAR
wxString s;
#endif // wxUSE_STATUSBAR
wxPen wP;
wxBrush wB;
wxPoint points[6];
wxColour wC;
wxFont wF;
dc.SetFont(*wxSWISS_FONT);
dc.SetPen(*wxGREEN_PEN);
switch (m_index)
{
default:
case 0:
// draw lines to make a cross
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
// draw point colored line and spline
wP = *wxCYAN_PEN;
wP.SetWidth(3);
dc.SetPen(wP);
dc.DrawPoint (25,15);
dc.DrawLine(50, 30, 200, 30);
dc.DrawSpline(50, 200, 50, 100, 200, 10);
#if wxUSE_STATUSBAR
s = wxT("Green Cross, Cyan Line and spline");
#endif // wxUSE_STATUSBAR
break;
case 1:
// draw standard shapes
dc.SetBrush(*wxCYAN_BRUSH);
dc.SetPen(*wxRED_PEN);
dc.DrawRectangle(10, 10, 100, 70);
wB = wxBrush (wxT("DARK ORCHID"), wxBRUSHSTYLE_TRANSPARENT);
dc.SetBrush (wB);
dc.DrawRoundedRectangle(50, 50, 100, 70, 20);
dc.SetBrush (wxBrush(wxT("GOLDENROD")) );
dc.DrawEllipse(100, 100, 100, 50);
points[0].x = 100; points[0].y = 200;
points[1].x = 70; points[1].y = 260;
points[2].x = 160; points[2].y = 230;
points[3].x = 40; points[3].y = 230;
points[4].x = 130; points[4].y = 260;
points[5].x = 100; points[5].y = 200;
dc.DrawPolygon(5, points);
dc.DrawLines (6, points, 160);
#if wxUSE_STATUSBAR
s = wxT("Blue rectangle, red edge, clear rounded rectangle, gold ellipse, gold and clear stars");
#endif // wxUSE_STATUSBAR
break;
case 2:
// draw text in Arial or similar font
dc.DrawLine(50,25,50,35);
dc.DrawLine(45,30,55,30);
dc.DrawText(wxT("This is a Swiss-style string"), 50, 30);
wC = dc.GetTextForeground();
dc.SetTextForeground (wxT("FIREBRICK"));
// no effect in msw ??
dc.SetTextBackground (wxT("WHEAT"));
dc.DrawText(wxT("This is a Red string"), 50, 200);
dc.DrawRotatedText(wxT("This is a 45 deg string"), 50, 200, 45);
dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90);
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
dc.SetFont(wF);
dc.SetTextForeground (wC);
dc.DrawText(wxT("This is a Times-style string"), 50, 60);
#if wxUSE_STATUSBAR
s = wxT("Swiss, Times text; red text, rotated and colored orange");
#endif // wxUSE_STATUSBAR
break;
case 3 :
// four arcs start and end points, center
dc.SetBrush(*wxGREEN_BRUSH);
dc.DrawArc ( 200,300, 370,230, 300,300 );
dc.SetBrush(*wxBLUE_BRUSH);
dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 );
dc.SetDeviceOrigin(-10,-10);
dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 );
dc.SetDeviceOrigin(0,0);
wP.SetColour (wxT("CADET BLUE"));
dc.SetPen(wP);
dc.DrawArc ( 75,125, 110, 40, 75, 75 );
wP.SetColour (wxT("SALMON"));
dc.SetPen(wP);
dc.SetBrush(*wxRED_BRUSH);
//.........这里部分代码省略.........
示例14: Draw
void MyApp::Draw(wxDC&dc)
{
// This routine just draws a bunch of random stuff on the screen so that we
// can check that different types of object are being drawn consistently
// between the screen image, the print preview image (at various zoom
// levels), and the printed page.
dc.SetBackground(*wxWHITE_BRUSH);
// dc.Clear();
dc.SetFont(m_testFont);
// dc.SetBackgroundMode(wxTRANSPARENT);
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxLIGHT_GREY_BRUSH);
dc.DrawRectangle(0, 0, 230, 350);
dc.DrawLine(0, 0, 229, 349);
dc.DrawLine(229, 0, 0, 349);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetBrush(*wxCYAN_BRUSH);
dc.SetPen(*wxRED_PEN);
dc.DrawRoundedRectangle(0, 20, 200, 80, 20);
dc.DrawText( wxT("Rectangle 200 by 80"), 40, 40);
dc.SetPen( wxPen(*wxBLACK, 0, wxPENSTYLE_DOT_DASH) );
dc.DrawEllipse(50, 140, 100, 50);
dc.SetPen(*wxRED_PEN);
dc.DrawText( wxT("Test message: this is in 10 point text"), 10, 180);
#if wxUSE_UNICODE
const char *test = "Hebrew שלום -- Japanese (日本語)";
wxString tmp = wxConvUTF8.cMB2WC( test );
dc.DrawText( tmp, 10, 200 );
#endif
wxPoint points[5];
points[0].x = 0;
points[0].y = 0;
points[1].x = 20;
points[1].y = 0;
points[2].x = 20;
points[2].y = 20;
points[3].x = 10;
points[3].y = 20;
points[4].x = 10;
points[4].y = -20;
dc.DrawPolygon( 5, points, 20, 250, wxODDEVEN_RULE );
dc.DrawPolygon( 5, points, 50, 250, wxWINDING_RULE );
dc.DrawEllipticArc( 80, 250, 60, 30, 0.0, 270.0 );
points[0].x = 150;
points[0].y = 250;
points[1].x = 180;
points[1].y = 250;
points[2].x = 180;
points[2].y = 220;
points[3].x = 200;
points[3].y = 220;
dc.DrawSpline( 4, points );
dc.DrawArc( 20,10, 10,10, 25,40 );
wxString str;
int i = 0;
str.Printf( wxT("---- Text at angle %d ----"), i );
dc.DrawRotatedText( str, 100, 300, i );
i = m_angle;
str.Printf( wxT("---- Text at angle %d ----"), i );
dc.DrawRotatedText( str, 100, 300, i );
wxIcon my_icon = wxICON(sample);
dc.DrawIcon( my_icon, 100, 100);
if (m_bitmap.IsOk())
dc.DrawBitmap( m_bitmap, 10, 10 );
#if wxUSE_GRAPHICS_CONTEXT
wxGraphicsContext *gc = NULL;
wxPrinterDC *printer_dc = wxDynamicCast( &dc, wxPrinterDC );
if (printer_dc)
gc = wxGraphicsContext::Create( *printer_dc );
wxWindowDC *window_dc = wxDynamicCast( &dc, wxWindowDC );
if (window_dc)
gc = wxGraphicsContext::Create( *window_dc );
#ifdef __WXMSW__
wxEnhMetaFileDC *emf_dc = wxDynamicCast( &dc, wxEnhMetaFileDC );
if (emf_dc)
gc = wxGraphicsContext::Create( *emf_dc );
#endif
//.........这里部分代码省略.........
示例15: DrawCont
//.........这里部分代码省略.........
{
bool do_tab = false;
switch (c.font)
{
case PSFONT_NORM:
case PSFONT_SYMBOL:
dc.SetFont(*contPlainFont);
break;
case PSFONT_BOLD:
dc.SetFont(*contBoldFont);
break;
case PSFONT_ITAL:
dc.SetFont(*contItalFont);
break;
case PSFONT_BOLDITAL:
dc.SetFont(*contBoldItalFont);
break;
case PSFONT_TAB:
{
tabnum++;
wxCoord textw = bounding.GetLeft() + charWidth * TabStops(tabnum, landscape);
if (textw >= x) x = textw;
else x += charWidth;
do_tab = true;
}
break;
default:
break;
}
if (c.font == PSFONT_SYMBOL)
{
wxCoord textw, texth, textd;
dc.GetTextExtent(wxT("O"), &textw, &texth, &textd);
const float d = textw;
const float top_y = y + texth - textd - textw;
for (std::string::const_iterator s = c.text.begin(); s != c.text.end(); s++)
{
{
dc.SetPen(*wxBLACK_PEN);
SYMBOL_TYPE sym = (SYMBOL_TYPE)(*s - 'A');
switch (sym)
{
case SYMBOL_SOL:
case SYMBOL_SOLBKSL:
case SYMBOL_SOLSL:
case SYMBOL_SOLX:
dc.SetBrush(*wxBLACK_BRUSH);
break;
default:
dc.SetBrush(*wxTRANSPARENT_BRUSH);
}
dc.DrawEllipse(x, top_y, d, d);
switch (sym)
{
case SYMBOL_SL:
case SYMBOL_X:
case SYMBOL_SOLSL:
case SYMBOL_SOLX:
dc.DrawLine(x-1, top_y + d+1, x + d+1, top_y-1);
break;
default:
break;
}
switch (sym)
{
case SYMBOL_BKSL:
case SYMBOL_X:
case SYMBOL_SOLBKSL:
case SYMBOL_SOLX:
dc.DrawLine(x-1, top_y-1, x + d+1, top_y + d+1);
break;
default:
break;
}
}
x += d;
}
}
else
{
if (!do_tab)
{
wxCoord textw, texth;
dc.GetTextExtent(c.text, &textw, &texth);
dc.DrawText(c.text, x, y);
x += textw;
}
}
}
y += maxtexth;
}
#if DEBUG
char buffer[100];
snprintf(buffer, sizeof(buffer), "TopLeft %d, %d", bounding.GetTopLeft().x, bounding.GetTopLeft().y);
dc.DrawText(buffer, bounding.GetTopLeft());
snprintf(buffer, sizeof(buffer), "BottomRight %d, %d", bounding.GetBottomRight().x, bounding.GetBottomRight().y);
dc.DrawText(buffer, bounding.GetBottomRight());
#endif
}