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:
parent
3eae97d2d7
commit
ebab640578
@ -91,10 +91,10 @@ public:
|
||||
virtual wxCoord GetCharHeight() const wxOVERRIDE;
|
||||
virtual wxCoord GetCharWidth() const wxOVERRIDE;
|
||||
|
||||
virtual void SetClippingRegion(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
|
||||
wxCoord WXUNUSED(w), wxCoord WXUNUSED(h))
|
||||
virtual void SetClippingRegion(wxCoord x, wxCoord y,
|
||||
wxCoord w, wxCoord h)
|
||||
{
|
||||
wxFAIL_MSG(wxT("wxSVGFILEDC::SetClippingRegion not implemented"));
|
||||
DoSetClippingRegion(x, y, w, h);
|
||||
}
|
||||
|
||||
virtual void SetPalette(const wxPalette& WXUNUSED(palette)) wxOVERRIDE
|
||||
@ -102,10 +102,10 @@ public:
|
||||
wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented"));
|
||||
}
|
||||
|
||||
virtual void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y),
|
||||
wxCoord *WXUNUSED(w), wxCoord *WXUNUSED(h))
|
||||
virtual void GetClippingBox(wxCoord *x, wxCoord *y,
|
||||
wxCoord *w, wxCoord *h)
|
||||
{
|
||||
wxFAIL_MSG(wxT("wxSVGFILEDC::GetClippingBox not implemented"));
|
||||
DoGetClippingBox(x, y, w, h);
|
||||
}
|
||||
|
||||
virtual void SetLogicalFunction(wxRasterOperationMode WXUNUSED(function)) wxOVERRIDE
|
||||
@ -201,9 +201,10 @@ private:
|
||||
wxCoord *externalLeading = NULL,
|
||||
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;
|
||||
|
@ -279,7 +279,13 @@ void wxSVGFileDCImpl::Init (const wxString &filename, int Width, int Height, dou
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
@ -625,14 +631,14 @@ void wxSVGFileDCImpl::DoSetClippingRegion( int x, int y, int width, int height
|
||||
// graphics can be subsequently changed inside the clipping region)
|
||||
svg << "</g>\n"
|
||||
"<defs>\n"
|
||||
"<clipPath id=\"clip" << m_clipNestingLevel << "\">\n"
|
||||
"<rect id=\"cliprect" << m_clipNestingLevel << "\" "
|
||||
" <clipPath id=\"clip" << m_clipNestingLevel << "\">\n"
|
||||
" <rect id=\"cliprect" << m_clipNestingLevel << "\" "
|
||||
"x=\"" << x << "\" "
|
||||
"y=\"" << y << "\" "
|
||||
"width=\"" << width << "\" "
|
||||
"height=\"" << height << "\" "
|
||||
"style=\"stroke: gray; fill: none;\"/>\n"
|
||||
"</clipPath>\n"
|
||||
" </clipPath>\n"
|
||||
"</defs>\n"
|
||||
"<g style=\"clip-path: url(#clip" << m_clipNestingLevel << ");\">\n";
|
||||
|
||||
@ -656,9 +662,8 @@ void wxSVGFileDCImpl::DestroyClippingRegion()
|
||||
// Close clipping group elements
|
||||
for ( size_t i = 0; i < m_clipUniqueId; i++ )
|
||||
{
|
||||
svg << "</g>";
|
||||
svg << "</g>\n";
|
||||
}
|
||||
svg << "\n";
|
||||
|
||||
write(svg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user