Logo Search packages:      
Sourcecode: codeblocks version File versions  Download package

void wxPdfDocument::StarPolygon ( double  x0,
double  y0,
double  r,
int  nv,
int  ng,
double  angle = 0,
bool  circle = false,
int  style = wxPDF_STYLE_DRAW,
int  circleStyle = wxPDF_STYLE_DRAW,
const wxPdfLineStyle circleLineStyle = wxPdfLineStyle(),
const wxPdfColour circleFillColor = wxPdfColour() 
) [virtual]

Draws a star polygon.

Parameters:
x0,:Abscissa of Center point
y0,:Ordinate of Center point
r,:Radius of circumscribed circle
nv,:Number of vertices
ng,:Number of gaps (ng % nv = 1 => regular polygon)
angle,:Orientation angle (anti-clockwise)
circle,:Flag whether to draw circumscribed circle or not
style,:Style of polygon (draw and/or fill)
circleStyle,:Style of circumscribed circle (draw and/or fill) (if draw)
circleLineStyle,:Line style for circumscribed circle. (if draw)
circleFillColor,:Fill color for circumscribed circle. (if draw fill circle)

Definition at line 1303 of file pdfgraphics.cpp.

References Circle(), GetFillColor(), GetLineStyle(), Polygon(), SetFillColor(), and SetLineStyle().

{
  if (nv < 2)
  {
    nv = 2;
  }
  if (circle)
  {
    wxPdfLineStyle saveStyle = GetLineStyle();
    SetLineStyle(circleLineStyle);
    wxPdfColour saveColor = GetFillColor();
    SetFillColor(circleFillColor);
    Circle(x0, y0, r, 0, 360, circleStyle);
    SetLineStyle(saveStyle);
    SetFillColor(saveColor);
  }
  wxArrayInt visited;
  visited.SetCount(nv);
  int i;
  for (i = 0; i < nv; i++)
  {
    visited[i] = 0;
  }
  static double pi = 4. * atan(1.);
  double a;
  wxPdfArrayDouble x, y;
  i = 0;
  do
  {
    visited[i] = 1;
    a = (angle + (i * 360 / nv)) / 180. * pi;
    x.Add(x0 + (r * sin(a)));
    y.Add(y0 + (r * cos(a)));
    i = (i + ng) % nv;
  }
  while (visited[i] == 0);
  Polygon(x, y, style);
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index