}
}
+void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y,
+ wxCoord width, wxCoord height)
+{
+ double r = 4 * (sqrt (2) - 1) / 3;
+ double halfW = 0.5 * width,
+ halfH = 0.5 * height,
+ halfWR = r * halfW,
+ halfHR = r * halfH;
+ wxCoord halfWI = (wxCoord) halfW,
+ halfHI = (wxCoord) halfH;
+
+ gs_lgp->gnome_print_newpath( m_gpc );
+
+ // Approximate an ellipse using four cubic splines, clockwise from 0 deg */
+ gs_lgp->gnome_print_moveto( m_gpc,
+ XLOG2DEV(x + width),
+ YLOG2DEV(y + halfHI) );
+ gs_lgp->gnome_print_curveto( m_gpc,
+ XLOG2DEV(x + width),
+ YLOG2DEV(y + (wxCoord) rint (halfH + halfHR)),
+ XLOG2DEV(x + (wxCoord) rint(halfW + halfWR)),
+ YLOG2DEV(y + height),
+ XLOG2DEV(x + halfWI),
+ YLOG2DEV(y + height) );
+ gs_lgp->gnome_print_curveto( m_gpc,
+ XLOG2DEV(x + (wxCoord) rint(halfW - halfWR)),
+ YLOG2DEV(y + height),
+ XLOG2DEV(x),
+ YLOG2DEV(y + (wxCoord) rint (halfH + halfHR)),
+ XLOG2DEV(x), YLOG2DEV(y+halfHI) );
+ gs_lgp->gnome_print_curveto( m_gpc,
+ XLOG2DEV(x),
+ YLOG2DEV(y + (wxCoord) rint (halfH - halfHR)),
+ XLOG2DEV(x + (wxCoord) rint (halfW - halfWR)),
+ YLOG2DEV(y),
+ XLOG2DEV(x+halfWI), YLOG2DEV(y) );
+ gs_lgp->gnome_print_curveto( m_gpc,
+ XLOG2DEV(x + (wxCoord) rint(halfW + halfWR)),
+ YLOG2DEV(y),
+ XLOG2DEV(x + width),
+ YLOG2DEV(y + (wxCoord) rint(halfH - halfHR)),
+ XLOG2DEV(x + width), YLOG2DEV(y + halfHI) );
+
+ gs_lgp->gnome_print_closepath(m_gpc);
+}
+
void wxGnomePrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
if (m_brush.GetStyle () != wxTRANSPARENT)
{
SetBrush( m_brush );
-
- gs_lgp->gnome_print_newpath( m_gpc );
- gs_lgp->gnome_print_moveto( m_gpc,
- XLOG2DEV(x), YLOG2DEV(y+height/2) );
-
- // start with top half
- gs_lgp->gnome_print_curveto( m_gpc,
- XLOG2DEV(x), YLOG2DEV(y),
- XLOG2DEV(x+width), YLOG2DEV(y),
- XLOG2DEV(x+width), YLOG2DEV(y+height/2) );
- // lower half
- gs_lgp->gnome_print_curveto( m_gpc,
- XLOG2DEV(x+width), YLOG2DEV(y+height),
- XLOG2DEV(x), YLOG2DEV(y+height),
- XLOG2DEV(x), YLOG2DEV(y+height/2) );
-
- gs_lgp->gnome_print_closepath( m_gpc );
+ makeEllipticalPath( x, y, width, height );
gs_lgp->gnome_print_fill( m_gpc );
-
CalcBoundingBox( x, y );
CalcBoundingBox( x + width, y + height );
}
if (m_pen.GetStyle () != wxTRANSPARENT)
{
SetPen (m_pen);
-
- gs_lgp->gnome_print_newpath( m_gpc );
- gs_lgp->gnome_print_moveto( m_gpc,
- XLOG2DEV(x), YLOG2DEV(y+height/2) );
-
- // start with top half
- gs_lgp->gnome_print_curveto( m_gpc,
- XLOG2DEV(x), YLOG2DEV(y),
- XLOG2DEV(x+width), YLOG2DEV(y),
- XLOG2DEV(x+width), YLOG2DEV(y+height/2) );
- // lower half
- gs_lgp->gnome_print_curveto( m_gpc,
- XLOG2DEV(x+width), YLOG2DEV(y+height),
- XLOG2DEV(x), YLOG2DEV(y+height),
- XLOG2DEV(x), YLOG2DEV(y+height/2) );
-
- gs_lgp->gnome_print_closepath( m_gpc );
+ makeEllipticalPath( x, y, width, height );
gs_lgp->gnome_print_stroke( m_gpc );
-
CalcBoundingBox( x, y );
CalcBoundingBox( x + width, y + height );
}