X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/78cededfdcc2d1bde79d40aa10d11f5768f046f4..02cecc4dc2c07b3e4b109edf44c4c87a2fed87d9:/src/common/dcsvg.cpp diff --git a/src/common/dcsvg.cpp b/src/common/dcsvg.cpp index fba44bc12c..daafe55ff6 100644 --- a/src/common/dcsvg.cpp +++ b/src/common/dcsvg.cpp @@ -26,6 +26,7 @@ #include "wx/dcsvg.h" #include "wx/wfstream.h" +#include "wx/filename.h" #define wxSVG_DEBUG FALSE // or TRUE to see the calls being executed @@ -55,10 +56,10 @@ wxString wxBrushString ( wxColour c, int style ) wxString s = wxT("fill:#") + wxColStr (c) + semicolon + space ; switch ( style ) { - case wxSOLID : + case wxBRUSHSTYLE_SOLID : s = s + wxT("fill-opacity:1.0; "); break ; - case wxTRANSPARENT: + case wxBRUSHSTYLE_TRANSPARENT: s = s + wxT("fill-opacity:0.0; "); break ; @@ -119,10 +120,12 @@ void wxSVGFileDCImpl::Init (const wxString &filename, int Width, int Height, dou write(s); s = wxT(" ")+ newline ; - write(s); - s.Printf ( wxT(" \n"), float(Width)/dpi*2.54, float(Height)/dpi*2.54, Width, Height ); + s = wxT("\"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\"> ") + newline ; write(s); + s = wxT(" \n"), float(Width)/dpi*2.54, float(Height)/dpi*2.54, Width, Height ); + write(s); s = wxT("SVG Picture created as ") + wxFileNameFromPath(filename) + wxT(" ") + newline ; write(s); s = wxString (wxT("Picture generated by wxSVG ")) + wxSVGVersion + wxT(" ")+ newline ; @@ -228,7 +231,7 @@ void wxSVGFileDCImpl::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoor CalcBoundingBox(x, y); CalcBoundingBox((wxCoord)(x + h*sin(rad)), (wxCoord)(y + h*cos(rad))); - if (m_backgroundMode == wxSOLID) + if (m_backgroundMode == wxBRUSHSTYLE_SOLID) { // draw background first // just like DoDrawRectangle except we pass the text color to it and set the border to a 1 pixel wide text background @@ -564,10 +567,10 @@ void wxSVGFileDCImpl::NewGraphics () switch ( m_pen.GetStyle () ) { - case wxSOLID : + case wxPENSTYLE_SOLID : sPenStyle = wxT("stroke-opacity:1.0; stroke-opacity:1.0; ") ; break ; - case wxTRANSPARENT : + case wxPENSTYLE_TRANSPARENT : sPenStyle = wxT("stroke-opacity:0.0; stroke-opacity:0.0; ") ; break ; default : @@ -576,7 +579,7 @@ void wxSVGFileDCImpl::NewGraphics () } sLast.Printf( wxT("stroke-width:%d\" \n transform=\"translate(%.2g %.2g) scale(%.2g %.2g)\">"), - w, (double)m_logicalOriginX, m_logicalOriginY, m_scaleX, m_scaleY ); + w, double(m_logicalOriginX), double(m_logicalOriginY), m_scaleX, m_scaleY ); s = sBrush + sPenCap + sPenJoin + sPenStyle + sLast + newline + sWarn; write(s); @@ -655,6 +658,10 @@ void wxSVGFileDCImpl::DoDrawBitmap(const class wxBitmap & bmp, wxCoord x, wxCoor //save it bool bPNG_OK = myBitmap.SaveFile(sPNG,wxBITMAP_TYPE_PNG); +// reference the bitmap from the SVG doc +// only use filename & ext + sPNG = sPNG.AfterLast(wxFileName::GetPathSeparator()); + // refrence the bitmap from the SVG doc int w = myBitmap.GetWidth(); int h = myBitmap.GetHeight();