added wxDC::DrawPolyPolygon() (patch 882189)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25549 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -564,7 +564,7 @@ void wxPostScriptDC::DoDrawPoint (wxCoord x, wxCoord y)
|
||||
CalcBoundingBox( x, y );
|
||||
}
|
||||
|
||||
void wxPostScriptDC::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int WXUNUSED(fillStyle))
|
||||
void wxPostScriptDC::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
|
||||
{
|
||||
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
|
||||
|
||||
@@ -597,7 +597,7 @@ void wxPostScriptDC::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset, wx
|
||||
}
|
||||
|
||||
if ( m_pstream )
|
||||
fprintf( m_pstream, "fill\n" );
|
||||
fprintf( m_pstream, (fillStyle == wxODDEVEN_RULE ? "eofill\n" : "fill\n"));
|
||||
}
|
||||
|
||||
if (m_pen.GetStyle () != wxTRANSPARENT)
|
||||
@@ -634,6 +634,72 @@ void wxPostScriptDC::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset, wx
|
||||
}
|
||||
}
|
||||
|
||||
void wxPostScriptDC::DoDrawPolyPolygon (int n, int start[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
|
||||
{
|
||||
wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
|
||||
|
||||
if (n <= 0) return;
|
||||
|
||||
if (m_brush.GetStyle () != wxTRANSPARENT)
|
||||
{
|
||||
SetBrush( m_brush );
|
||||
|
||||
fprintf( m_pstream, "newpath\n" );
|
||||
|
||||
int ofs = 0;
|
||||
for (int i = 0; i < n; ofs += start[i++])
|
||||
{
|
||||
wxCoord xx = LogicalToDeviceX(points[ofs].x + xoffset);
|
||||
wxCoord yy = LogicalToDeviceY(points[ofs].y + yoffset);
|
||||
|
||||
fprintf( m_pstream, "%d %d moveto\n", xx, yy );
|
||||
|
||||
CalcBoundingBox( points[ofs].x + xoffset, points[ofs].y + yoffset );
|
||||
|
||||
for (int j = 1; j < start[i]; j++)
|
||||
{
|
||||
xx = LogicalToDeviceX(points[ofs+j].x + xoffset);
|
||||
yy = LogicalToDeviceY(points[ofs+j].y + yoffset);
|
||||
|
||||
fprintf( m_pstream, "%d %d lineto\n", xx, yy );
|
||||
|
||||
CalcBoundingBox( points[ofs+j].x + xoffset, points[ofs+j].y + yoffset);
|
||||
}
|
||||
}
|
||||
fprintf( m_pstream, (fillStyle == wxODDEVEN_RULE ? "eofill\n" : "fill\n"));
|
||||
}
|
||||
|
||||
if (m_pen.GetStyle () != wxTRANSPARENT)
|
||||
{
|
||||
SetPen( m_pen );
|
||||
|
||||
fprintf( m_pstream, "newpath\n" );
|
||||
|
||||
int ofs = 0;
|
||||
for (int i = 0; i < n; ofs += start[i++])
|
||||
{
|
||||
wxCoord xx = LogicalToDeviceX(points[ofs].x + xoffset);
|
||||
wxCoord yy = LogicalToDeviceY(points[ofs].y + yoffset);
|
||||
|
||||
fprintf( m_pstream, "%d %d moveto\n", xx, yy );
|
||||
|
||||
CalcBoundingBox( points[ofs].x + xoffset, points[ofs].y + yoffset );
|
||||
|
||||
for (int j = 1; j < start[i]; j++)
|
||||
{
|
||||
xx = LogicalToDeviceX(points[ofs+j].x + xoffset);
|
||||
yy = LogicalToDeviceY(points[ofs+j].y + yoffset);
|
||||
|
||||
fprintf( m_pstream, "%d %d lineto\n", xx, yy );
|
||||
|
||||
CalcBoundingBox( points[ofs+j].x + xoffset, points[ofs+j].y + yoffset);
|
||||
}
|
||||
}
|
||||
fprintf( m_pstream, "closepath\n" );
|
||||
fprintf( m_pstream, "stroke\n" );
|
||||
}
|
||||
}
|
||||
|
||||
void wxPostScriptDC::DoDrawLines (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
|
||||
{
|
||||
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
|
||||
|
@@ -793,6 +793,50 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffs
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
wxDC::DoDrawPolyPolygon(int n,
|
||||
int start[],
|
||||
wxPoint points[],
|
||||
wxCoord xoffset,
|
||||
wxCoord yoffset,
|
||||
int fillStyle)
|
||||
{
|
||||
#ifdef __WXMICROWIN__
|
||||
if (!GetHDC()) return;
|
||||
#endif
|
||||
|
||||
wxColourChanger cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling
|
||||
int i, cnt;
|
||||
for (i = cnt = 0; i < n; i++)
|
||||
cnt += start[i];
|
||||
|
||||
// Do things less efficiently if we have offsets
|
||||
if (xoffset != 0 || yoffset != 0)
|
||||
{
|
||||
POINT *cpoints = new POINT[cnt];
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
cpoints[i].x = (int)(points[i].x + xoffset);
|
||||
cpoints[i].y = (int)(points[i].y + yoffset);
|
||||
|
||||
CalcBoundingBox(cpoints[i].x, cpoints[i].y);
|
||||
}
|
||||
int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING);
|
||||
(void)PolyPolygon(GetHdc(), cpoints, start, n);
|
||||
SetPolyFillMode(GetHdc(),prev);
|
||||
delete[] cpoints;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < cnt; i++)
|
||||
CalcBoundingBox(points[i].x, points[i].y);
|
||||
|
||||
int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING);
|
||||
(void)PolyPolygon(GetHdc(), (POINT*) points, start, n);
|
||||
SetPolyFillMode(GetHdc(),prev);
|
||||
}
|
||||
}
|
||||
|
||||
void wxDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
|
||||
{
|
||||
#ifdef __WXMICROWIN__
|
||||
|
Reference in New Issue
Block a user