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

void wxPdfDocument::Shape ( const wxPdfShape shape,
int  style = wxPDF_STYLE_DRAW 
) [virtual]

Draws a shape.

Parameters:
shape,:shape to be drawn
styleStyle of rendering. Possible values are:

  • wxPDF_STYLE_DRAW (default)
  • wxPDF_STYLE_FILL: fill
  • wxPDF_STYLE_FILLDRAW: draw and fill
  • wxPDF_STYLE_DRAWCLOSE: close path and draw (can be combined with wxPDF_STYLE_FILL

Definition at line 1344 of file pdfgraphics.cpp.

References wxPdfShape::GetSegment(), wxPdfShape::GetSegmentCount(), Out(), OutAscii(), OutCurve(), OutLine(), and OutPoint().

{
  wxString op;
  if ((style & wxPDF_STYLE_MASK) == wxPDF_STYLE_FILL)
  {
    op = _T("f");
  }
  else
  {
    if ((style & wxPDF_STYLE_MASK) == wxPDF_STYLE_FILLDRAW)
    {
      op = _T("B");
    }
    else if ((style & wxPDF_STYLE_MASK) == (wxPDF_STYLE_DRAWCLOSE | wxPDF_STYLE_FILL))
    {
      op = _T("b"); // small 'b' means closing the path as well
    }
    else if ((style & wxPDF_STYLE_MASK) == wxPDF_STYLE_DRAWCLOSE)
    {
      op = _T("s"); // small 's' means closing the path as well
    }
    else
    {
      op = _T("S");
    }
  }

  Out("q");

  double scratch[6];
  int iterType;
  int iterPoints = 0;
  int segCount = shape.GetSegmentCount();
  for (iterType = 0; iterType < segCount; iterType++)
  {
    int segType = shape.GetSegment(iterType, iterPoints, scratch);
    switch (segType)
    {
      case wxPDF_SEG_CLOSE:
        Out("h");
        iterPoints++;
        break;
      case wxPDF_SEG_MOVETO:
        OutPoint(scratch[0], scratch[1]);
        iterPoints++;
        break;
      case wxPDF_SEG_LINETO:
        OutLine(scratch[0], scratch[1]);
        iterPoints++;
        break;
      case wxPDF_SEG_CURVETO:
        OutCurve(scratch[0], scratch[1], scratch[2], scratch[3],scratch[4], scratch[5]);
        iterPoints += 3;
        break;
    }
  }
  OutAscii(op);
  Out("Q");

//  ClosePath(style);
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index