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

void wxPdfDocument::RoundedRect ( double  x,
double  y,
double  w,
double  h,
double  r,
int  roundCorner = wxPDF_CORNER_ALL,
int  style = wxPDF_STYLE_DRAW 
) [virtual]

Draws a rounded rectangle.

Parameters:
xAbscissa of upper-left corner
yOrdinate of upper-left corner
wWidth
hHeight
r,:Radius of the rounded corners
roundCorner,:Draws rounded corner or not.

  • wxPDF_CORNER_NONE no rounded corners
  • wxPDF_CORNER_TOP_LEFT top left corner
  • wxPDF_CORNER_TOP_RIGHT top right corner
  • wxPDF_CORNER_BOTTOM_LEFT bottom left corner
  • wxPDF_CORNER_BOTTOM_RIGHT bottom right corner
  • wxPDF_CORNER_ALL all corners
style,:Style of rectangle (draw and/or fill)

Definition at line 906 of file pdfgraphics.cpp.

References OutAscii(), OutCurve(), OutLine(), OutPoint(), Rect(), and wxPDF_CORNER_NONE.

{
  if ((roundCorner & wxPDF_CORNER_ALL) == wxPDF_CORNER_NONE)
  {
    // Not rounded
    Rect(x, y, w, h, style);
  }
  else
  {
    // Rounded
    wxString op;
    // Draw a rectangle
    if ((style & wxPDF_STYLE_FILLDRAW) == wxPDF_STYLE_FILL)
    {
      op = _T("f");
    }
    else
    {
      if ((style & wxPDF_STYLE_FILLDRAW) == wxPDF_STYLE_FILLDRAW)
      {
        op = _T("B");
      }
      else
      {
        op = _T("S");
      }
    }

    double myArc = 4. / 3. * (sqrt(2.) - 1.);

    OutPoint(x + r, y);
    double xc = x + w - r;
    double yc = y + r;
    OutLine(xc, y);

    if (roundCorner & wxPDF_CORNER_TOP_LEFT)
    {
      OutCurve(xc + (r * myArc), yc - r, xc + r, yc - (r * myArc), xc + r, yc);
    }
    else
    {
      OutLine(x + w, y);
    }

    xc = x + w - r ;
    yc = y + h - r;
    OutLine(x + w, yc);

    if (roundCorner & wxPDF_CORNER_TOP_RIGHT)
    {
      OutCurve(xc + r, yc + (r * myArc), xc + (r * myArc), yc + r, xc, yc + r);
    }
    else
    {
      OutLine(x + w, y + h);
    }

    xc = x + r;
    yc = y + h - r;
    OutLine(xc, y + h);

    if (roundCorner & wxPDF_CORNER_BOTTOM_LEFT)
    {
      OutCurve(xc - (r * myArc), yc + r, xc - r, yc + (r * myArc), xc - r, yc);
    }
    else
    {
      OutLine(x, y + h);
    }

    xc = x + r;
    yc = y + r;
    OutLine(x, yc);

    if (roundCorner & wxPDF_CORNER_BOTTOM_RIGHT)
    {
      OutCurve(xc - r, yc - (r * myArc), xc - (r * myArc), yc - r, xc, yc - r);
    }
    else
    {
      OutLine(x, y);
      OutLine(x + r, y);
    }
    OutAscii(op);
  }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index