Enable usage of clipping regions in wxSVGFileDC.
It was implemented 3 and half years ago in 614e38d
.
Close remaining clipping regions when closing the SVG file.
This commit is contained in:
@@ -91,10 +91,10 @@ public:
|
|||||||
virtual wxCoord GetCharHeight() const wxOVERRIDE;
|
virtual wxCoord GetCharHeight() const wxOVERRIDE;
|
||||||
virtual wxCoord GetCharWidth() const wxOVERRIDE;
|
virtual wxCoord GetCharWidth() const wxOVERRIDE;
|
||||||
|
|
||||||
virtual void SetClippingRegion(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
|
virtual void SetClippingRegion(wxCoord x, wxCoord y,
|
||||||
wxCoord WXUNUSED(w), wxCoord WXUNUSED(h))
|
wxCoord w, wxCoord h)
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(wxT("wxSVGFILEDC::SetClippingRegion not implemented"));
|
DoSetClippingRegion(x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetPalette(const wxPalette& WXUNUSED(palette)) wxOVERRIDE
|
virtual void SetPalette(const wxPalette& WXUNUSED(palette)) wxOVERRIDE
|
||||||
@@ -102,10 +102,10 @@ public:
|
|||||||
wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented"));
|
wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented"));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y),
|
virtual void GetClippingBox(wxCoord *x, wxCoord *y,
|
||||||
wxCoord *WXUNUSED(w), wxCoord *WXUNUSED(h))
|
wxCoord *w, wxCoord *h)
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(wxT("wxSVGFILEDC::GetClippingBox not implemented"));
|
DoGetClippingBox(x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetLogicalFunction(wxRasterOperationMode WXUNUSED(function)) wxOVERRIDE
|
virtual void SetLogicalFunction(wxRasterOperationMode WXUNUSED(function)) wxOVERRIDE
|
||||||
@@ -201,9 +201,10 @@ private:
|
|||||||
wxCoord *externalLeading = NULL,
|
wxCoord *externalLeading = NULL,
|
||||||
const wxFont *font = NULL) const wxOVERRIDE;
|
const wxFont *font = NULL) const wxOVERRIDE;
|
||||||
|
|
||||||
virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region)) wxOVERRIDE
|
virtual void DoSetDeviceClippingRegion(const wxRegion& region) wxOVERRIDE
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetDeviceClippingRegion not yet implemented"));
|
DoSetClippingRegion(region.GetBox().x, region.GetBox().y,
|
||||||
|
region.GetBox().width, region.GetBox().height);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void DoSetClippingRegion(int x, int y, int width, int height) wxOVERRIDE;
|
virtual void DoSetClippingRegion(int x, int y, int width, int height) wxOVERRIDE;
|
||||||
|
@@ -279,7 +279,13 @@ void wxSVGFileDCImpl::Init (const wxString &filename, int Width, int Height, dou
|
|||||||
|
|
||||||
wxSVGFileDCImpl::~wxSVGFileDCImpl()
|
wxSVGFileDCImpl::~wxSVGFileDCImpl()
|
||||||
{
|
{
|
||||||
wxString s = wxT("</g> \n</svg> \n");
|
wxString s;
|
||||||
|
|
||||||
|
// Close remaining clipping group elements
|
||||||
|
for (size_t i = 0; i < m_clipUniqueId; i++)
|
||||||
|
s += wxS("</g>\n");
|
||||||
|
|
||||||
|
s += wxS("</g>\n</svg>\n");
|
||||||
write(s);
|
write(s);
|
||||||
delete m_outfile;
|
delete m_outfile;
|
||||||
}
|
}
|
||||||
@@ -617,7 +623,7 @@ void wxSVGFileDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSVGFileDCImpl::DoSetClippingRegion( int x, int y, int width, int height )
|
void wxSVGFileDCImpl::DoSetClippingRegion(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
wxString svg;
|
wxString svg;
|
||||||
|
|
||||||
@@ -625,14 +631,14 @@ void wxSVGFileDCImpl::DoSetClippingRegion( int x, int y, int width, int height
|
|||||||
// graphics can be subsequently changed inside the clipping region)
|
// graphics can be subsequently changed inside the clipping region)
|
||||||
svg << "</g>\n"
|
svg << "</g>\n"
|
||||||
"<defs>\n"
|
"<defs>\n"
|
||||||
"<clipPath id=\"clip" << m_clipNestingLevel << "\">\n"
|
" <clipPath id=\"clip" << m_clipNestingLevel << "\">\n"
|
||||||
"<rect id=\"cliprect" << m_clipNestingLevel << "\" "
|
" <rect id=\"cliprect" << m_clipNestingLevel << "\" "
|
||||||
"x=\"" << x << "\" "
|
"x=\"" << x << "\" "
|
||||||
"y=\"" << y << "\" "
|
"y=\"" << y << "\" "
|
||||||
"width=\"" << width << "\" "
|
"width=\"" << width << "\" "
|
||||||
"height=\"" << height << "\" "
|
"height=\"" << height << "\" "
|
||||||
"style=\"stroke: gray; fill: none;\"/>\n"
|
"style=\"stroke: gray; fill: none;\"/>\n"
|
||||||
"</clipPath>\n"
|
" </clipPath>\n"
|
||||||
"</defs>\n"
|
"</defs>\n"
|
||||||
"<g style=\"clip-path: url(#clip" << m_clipNestingLevel << ");\">\n";
|
"<g style=\"clip-path: url(#clip" << m_clipNestingLevel << ");\">\n";
|
||||||
|
|
||||||
@@ -656,9 +662,8 @@ void wxSVGFileDCImpl::DestroyClippingRegion()
|
|||||||
// Close clipping group elements
|
// Close clipping group elements
|
||||||
for ( size_t i = 0; i < m_clipUniqueId; i++ )
|
for ( size_t i = 0; i < m_clipUniqueId; i++ )
|
||||||
{
|
{
|
||||||
svg << "</g>";
|
svg << "</g>\n";
|
||||||
}
|
}
|
||||||
svg << "\n";
|
|
||||||
|
|
||||||
write(svg);
|
write(svg);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user