X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/888dde65f43d5f57e8fb2028b27191cca1741403..ddabd45b6148976e174ca7487ab283517d8825df:/src/common/dcsvg.cpp?ds=inline diff --git a/src/common/dcsvg.cpp b/src/common/dcsvg.cpp index ceefb7cfd7..15781af016 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 ; @@ -76,20 +77,12 @@ wxString wxBrushString ( wxColour c, int style ) IMPLEMENT_ABSTRACT_CLASS(wxSVGFileDCImpl, wxDC) -#if wxUSE_NEW_DC - wxSVGFileDCImpl::wxSVGFileDCImpl( wxSVGFileDC *owner, const wxString &filename, +wxSVGFileDCImpl::wxSVGFileDCImpl( wxSVGFileDC *owner, const wxString &filename, int width, int height, double dpi ) : wxDCImpl( owner ) { Init( filename, width, height, dpi ); } -#else - wxSVGFileDC::wxSVGFileDC( const wxString &filename, - int width, int height, double dpi ) - { - Init( filename, width, height, dpi ); - } -#endif void wxSVGFileDCImpl::Init (const wxString &filename, int Width, int Height, double dpi) { @@ -127,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 ; @@ -203,11 +198,7 @@ void wxSVGFileDCImpl::DoDrawPoint (wxCoord x1, wxCoord y1) void wxSVGFileDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1, wxCoord width, wxCoord height) { -#if wxUSE_NEW_DC wxDCImpl::DoDrawCheckMark (x1,y1,width,height) ; -#else - wxDCBase::DoDrawCheckMark (x1,y1,width,height) ; -#endif } @@ -240,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 @@ -576,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 : @@ -667,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(); @@ -692,43 +687,6 @@ void wxSVGFileDCImpl::write(const wxString &s) m_OK = m_outfile->Ok(); } -// --------------------------------------------------------------------------- -// coordinates transformations -// --------------------------------------------------------------------------- - -#if wxUSE_NEW_DC -#else -void wxSVGFileDCImpl::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) -{ - wxDCBase::SetAxisOrientation( xLeftRight, yBottomUp ); -} - -void wxSVGFileDCImpl::SetMapMode(int mode) -{ - wxDCBase::SetMapMode(mode); -} - -void wxSVGFileDCImpl::SetUserScale(double x, double y) -{ - wxDCBase::SetUserScale(x,y); -} - -void wxSVGFileDCImpl::SetLogicalScale(double x, double y) -{ - wxDCBase::SetLogicalScale(x,y); -} - -void wxSVGFileDCImpl::SetLogicalOrigin(wxCoord x, wxCoord y) -{ - wxDCBase::SetLogicalOrigin(x,y); -} - -void wxSVGFileDCImpl::SetDeviceOrigin(wxCoord x, wxCoord y) -{ - wxDCBase::SetDeviceOrigin(x,y); -} -#endif - #ifdef __BORLANDC__ #pragma warn .rch