removing the files recently added to HEAD from 2.8 branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45385 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,736 +0,0 @@
|
|||||||
\documentstyle[a4,makeidx,verbatim,texhelp,fancyhea,mysober,mytitle]{report}%
|
|
||||||
%\input{psbox.tex}
|
|
||||||
\newcommand{\commandref}[2]{\helpref{{\tt $\backslash$#1}}{#2}}%
|
|
||||||
\newcommand{\commandrefn}[2]{\helprefn{{\tt $\backslash$#1}}{#2}\index{#1}}%
|
|
||||||
\newcommand{\commandpageref}[2]{\latexignore{\helprefn{{\tt $\backslash$#1}}{#2}}\latexonly{{\tt $\backslash$#1} {\it page \pageref{#2}}}\index{#1}}%
|
|
||||||
\newcommand{\indexit}[1]{#1\index{#1}}%
|
|
||||||
\newcommand{\inioption}[1]{{\bf {\tt #1}}\index{#1}}%
|
|
||||||
\parskip=10pt%
|
|
||||||
\parindent=0pt%
|
|
||||||
%\backgroundcolour{255;255;255}\textcolour{0;0;0}% Has an effect in HTML only
|
|
||||||
\winhelpignore{\title{Manual for wxSVGFileDC}%
|
|
||||||
\author{Chris Elliott}%
|
|
||||||
\date{June 2002}%
|
|
||||||
}%
|
|
||||||
\winhelponly{\title{Manual for wxSVGFileDC}%
|
|
||||||
\author{by Chris Elliott}%
|
|
||||||
}%
|
|
||||||
\makeindex%
|
|
||||||
\begin{document}%
|
|
||||||
\maketitle%
|
|
||||||
\pagestyle{fancyplain}%
|
|
||||||
\bibliographystyle{plain}%
|
|
||||||
\pagenumbering{roman}%
|
|
||||||
\setheader{{\it CONTENTS}}{}{}{}{}{{\it CONTENTS}}%
|
|
||||||
\setfooter{\thepage}{}{}{}{}{\thepage}%
|
|
||||||
\tableofcontents%
|
|
||||||
|
|
||||||
\chapter*{Copyright notice}%
|
|
||||||
\setheader{{\it COPYRIGHT}}{}{}{}{}{{\it COPYRIGHT}}%
|
|
||||||
\setfooter{\thepage}{}{}{}{}{\thepage}%
|
|
||||||
|
|
||||||
\chapter*{wxSVGFileDC}%
|
|
||||||
\setheader{{\it wxSVGFileDC}}{}{}{}{}{{\it wxSVGFileDC}}%
|
|
||||||
\setfooter{\thepage}{}{}{}{}{\thepage}%
|
|
||||||
\section{\class{wxSVGFileDC}}\label{wxSVGFileDC}
|
|
||||||
|
|
||||||
A wxSVGFileDC is a {\it device context} onto which graphics and text can be drawn, and the output
|
|
||||||
produced as a vector file, in the SVG format (see http://www.w3.org/TR/2001/REC-SVG-20010904/ ).
|
|
||||||
This format can be read by a range of programs, including a Netscape plugin (Adobe), full details at
|
|
||||||
http://www.w3.org/Graphics/SVG/SVG-Implementations.htm8 Vector formats may often be smaller
|
|
||||||
than raster formats.
|
|
||||||
|
|
||||||
The intention behind wxSVGFileDC is that it can be used to produce a file corresponding
|
|
||||||
to the screen display context, wxSVGFileDC, by passing the wxSVGFileDC as a parameter instead of a wxSVGFileDC. Thus
|
|
||||||
the wxSVGFileDC is a write-only class.
|
|
||||||
|
|
||||||
As the wxSVGFileDC is a vector format, raster operations like GetPixel are unlikely to be supported.
|
|
||||||
However, the SVG specification allows for PNG format raster files to be embedded in the SVG, and so
|
|
||||||
bitmaps, icons and blit operations into the wxSVGFileDC are supported.
|
|
||||||
|
|
||||||
A more substantial SVG library (for reading and writing) is available at
|
|
||||||
http://www.xs4all.nl/~kholwerd/wxstuff/canvas/htmldocbook/aap.html
|
|
||||||
|
|
||||||
\wxheading{Derived from}
|
|
||||||
|
|
||||||
\helpref{wxDCBase}{wxDCBase}
|
|
||||||
|
|
||||||
\wxheading{Include files}
|
|
||||||
|
|
||||||
<wx/dcsvg.h>
|
|
||||||
|
|
||||||
\wxheading{See also}
|
|
||||||
|
|
||||||
%\helpref{Overview}{dcoverview}
|
|
||||||
|
|
||||||
|
|
||||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::wxSVGFileDC}
|
|
||||||
|
|
||||||
\func{}{wxSVGFileDC}{\param{wxString}{ f}} \rtfsp
|
|
||||||
\func{}{wxSVGFileDC}{\param{wxString}{ f}, \param{int}{ Width},\param{int}{ Height}} \rtfsp
|
|
||||||
\func{}{wxSVGFileDC}{\param{wxString}{ f}, \param{int}{ Width},\param{int}{ Height},\param{float}{ dpi}} \rtfsp
|
|
||||||
|
|
||||||
Constructors:
|
|
||||||
a filename {\it f} with default size 340x240 at 72.0 dots per inch (a frequent screen resolution).
|
|
||||||
a filename {\it f} with size {\it Width} by {\it Height} at 72.0 dots per inch
|
|
||||||
a filename {\it f} with size {\it Width} by {\it Height} at {\it dpi} resolution.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::\destruct{wxSVGFileDC}}
|
|
||||||
|
|
||||||
\func{}{\destruct{wxSVGFileDC}}{\void}
|
|
||||||
|
|
||||||
Destructor.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::BeginDrawing}\label{wxdcbegindrawing}
|
|
||||||
|
|
||||||
Does nothing
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::Blit}\label{wxdcblit}
|
|
||||||
|
|
||||||
\func{bool}{Blit}{\param{wxCoord}{ xdest}, \param{wxCoord}{ ydest}, \param{wxCoord}{ width}, \param{wxCoord}{ height},
|
|
||||||
\param{wxSVGFileDC* }{source}, \param{wxCoord}{ xsrc}, \param{wxCoord}{ ysrc}, \param{int}{ logicalFunc = wxCOPY},
|
|
||||||
\param{bool }{useMask = FALSE}, \param{wxCoord}{ xsrcMask = -1}, \param{wxCoord}{ ysrcMask = -1}}
|
|
||||||
|
|
||||||
As wxDC: Copy from a source DC to this DC, specifying the destination
|
|
||||||
coordinates, size of area to copy, source DC, source coordinates,
|
|
||||||
logical function, whether to use a bitmap mask, and mask source position.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::CalcBoundingBox}\label{wxdccalcboundingbox}
|
|
||||||
|
|
||||||
\func{void}{CalcBoundingBox}{\param{wxCoord }{x}, \param{wxCoord }{y}}
|
|
||||||
|
|
||||||
Adds the specified point to the bounding box which can be retrieved with
|
|
||||||
\helpref{MinX}{wxdcminx}, \helpref{MaxX}{wxdcmaxx} and
|
|
||||||
\helpref{MinY}{wxdcminy}, \helpref{MaxY}{wxdcmaxy} functions.
|
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::Clear}\label{wxdcclear}
|
|
||||||
|
|
||||||
\func{void}{Clear}{\void}
|
|
||||||
|
|
||||||
This makes no sense in wxSVGFileDC and does nothing
|
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::CrossHair}\label{wxdccrosshair}
|
|
||||||
|
|
||||||
\func{void}{CrossHair}{\param{wxCoord}{ x}, \param{wxCoord}{ y}}
|
|
||||||
|
|
||||||
Not Implemented
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DestroyClippingRegion}\label{wxdcdestroyclippingregion}
|
|
||||||
|
|
||||||
\func{void}{DestroyClippingRegion}{\void}
|
|
||||||
|
|
||||||
Not Implemented
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DeviceToLogicalX}\label{wxdcdevicetologicalx}
|
|
||||||
|
|
||||||
\func{wxCoord}{DeviceToLogicalX}{\param{wxCoord}{ x}}
|
|
||||||
|
|
||||||
Convert device X coordinate to logical coordinate, using the current
|
|
||||||
mapping mode.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DeviceToLogicalXRel}\label{wxdcdevicetologicalxrel}
|
|
||||||
|
|
||||||
\func{wxCoord}{DeviceToLogicalXRel}{\param{wxCoord}{ x}}
|
|
||||||
|
|
||||||
Convert device X coordinate to relative logical coordinate, using the current
|
|
||||||
mapping mode but ignoring the x axis orientation.
|
|
||||||
Use this function for converting a width, for example.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DeviceToLogicalY}\label{wxdcdevicetologicaly}
|
|
||||||
|
|
||||||
\func{wxCoord}{DeviceToLogicalY}{\param{wxCoord}{ y}}
|
|
||||||
|
|
||||||
Converts device Y coordinate to logical coordinate, using the current
|
|
||||||
mapping mode.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DeviceToLogicalYRel}\label{wxdcdevicetologicalyrel}
|
|
||||||
|
|
||||||
\func{wxCoord}{DeviceToLogicalYRel}{\param{wxCoord}{ y}}
|
|
||||||
|
|
||||||
Convert device Y coordinate to relative logical coordinate, using the current
|
|
||||||
mapping mode but ignoring the y axis orientation.
|
|
||||||
Use this function for converting a height, for example.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawArc}\label{wxdcdrawarc}
|
|
||||||
|
|
||||||
\func{void}{DrawArc}{\param{wxCoord}{ x1}, \param{wxCoord}{ y1}, \param{wxCoord}{ x2}, \param{wxCoord}{ y2}, \param{wxCoord}{ xc}, \param{wxCoord}{ yc}}
|
|
||||||
|
|
||||||
Draws an arc of a circle, centred on ({\it xc, yc}), with starting point ({\it x1, y1})
|
|
||||||
and ending at ({\it x2, y2}). The current pen is used for the outline
|
|
||||||
and the current brush for filling the shape.
|
|
||||||
|
|
||||||
The arc is drawn in an anticlockwise direction from the start point to the end point.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawBitmap}\label{wxdcdrawbitmap}
|
|
||||||
|
|
||||||
\func{void}{DrawBitmap}{\param{const wxBitmap\&}{ bitmap}, \param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{bool}{ transparent}}
|
|
||||||
|
|
||||||
Draw a bitmap on the device context at the specified point. If {\it transparent} is true and the bitmap has
|
|
||||||
a transparency mask, the bitmap will be drawn transparently.
|
|
||||||
|
|
||||||
When drawing a mono-bitmap, the current text foreground colour will be used to draw the foreground
|
|
||||||
of the bitmap (all bits set to 1), and the current text background colour to draw the background
|
|
||||||
(all bits set to 0). See also \helpref{SetTextForeground}{wxdcsettextforeground},
|
|
||||||
\helpref{SetTextBackground}{wxdcsettextbackground} and \helpref{wxMemoryDC}{wxmemorydc}.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawCheckMark}\label{wxdcdrawcheckmark}
|
|
||||||
|
|
||||||
\func{void}{DrawCheckMark}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
|
|
||||||
|
|
||||||
\func{void}{DrawCheckMark}{\param{const wxRect \&}{rect}}
|
|
||||||
|
|
||||||
Draws a check mark inside the given rectangle.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawCircle}\label{wxdcdrawcircle}
|
|
||||||
|
|
||||||
\func{void}{DrawCircle}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ radius}}
|
|
||||||
|
|
||||||
\func{void}{DrawCircle}{\param{const wxPoint\&}{ pt}, \param{wxCoord}{ radius}}
|
|
||||||
|
|
||||||
Draws a circle with the given centre and radius.
|
|
||||||
|
|
||||||
\wxheading{See also}
|
|
||||||
|
|
||||||
\helpref{DrawEllipse}{wxdcdrawellipse}
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawEllipse}\label{wxdcdrawellipse}
|
|
||||||
|
|
||||||
\func{void}{DrawEllipse}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
|
|
||||||
|
|
||||||
\func{void}{DrawEllipse}{\param{const wxPoint\&}{ pt}, \param{const wxSize\&}{ size}}
|
|
||||||
|
|
||||||
\func{void}{DrawEllipse}{\param{const wxRect\&}{ rect}}
|
|
||||||
|
|
||||||
Draws an ellipse contained in the rectangle specified either with the given top
|
|
||||||
left corner and the given size or directly. The current pen is used for the
|
|
||||||
outline and the current brush for filling the shape.
|
|
||||||
|
|
||||||
\wxheading{See also}
|
|
||||||
|
|
||||||
\helpref{DrawCircle}{wxdcdrawcircle}
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawEllipticArc}\label{wxdcdrawellipticarc}
|
|
||||||
|
|
||||||
\func{void}{DrawEllipticArc}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height},
|
|
||||||
\param{double}{ start}, \param{double}{ end}}
|
|
||||||
|
|
||||||
Draws an arc of an ellipse. The current pen is used for drawing the arc and
|
|
||||||
the current brush is used for drawing the pie.
|
|
||||||
|
|
||||||
{\it x} and {\it y} specify the x and y coordinates of the upper-left corner of the rectangle that contains
|
|
||||||
the ellipse.
|
|
||||||
|
|
||||||
{\it width} and {\it height} specify the width and height of the rectangle that contains
|
|
||||||
the ellipse.
|
|
||||||
|
|
||||||
{\it start} and {\it end} specify the start and end of the arc relative to the three-o'clock
|
|
||||||
position from the center of the rectangle. Angles are specified
|
|
||||||
in degrees (360 is a complete circle). Positive values mean
|
|
||||||
counter-clockwise motion. If {\it start} is equal to {\it end}, a
|
|
||||||
complete ellipse will be drawn.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawIcon}\label{wxdcdrawicon}
|
|
||||||
|
|
||||||
\func{void}{DrawIcon}{\param{const wxIcon\&}{ icon}, \param{wxCoord}{ x}, \param{wxCoord}{ y}}
|
|
||||||
|
|
||||||
Draw an icon on the display (does nothing if the device context is PostScript).
|
|
||||||
This can be the simplest way of drawing bitmaps on a window.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawLine}\label{wxdcdrawline}
|
|
||||||
|
|
||||||
\func{void}{DrawLine}{\param{wxCoord}{ x1}, \param{wxCoord}{ y1}, \param{wxCoord}{ x2}, \param{wxCoord}{ y2}}
|
|
||||||
|
|
||||||
Draws a line from the first point to the second. The current pen is used
|
|
||||||
for drawing the line.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawLines}\label{wxdcdrawlines}
|
|
||||||
|
|
||||||
\func{void}{DrawLines}{\param{int}{ n}, \param{wxPoint}{ points[]}, \param{wxCoord}{ xoffset = 0}, \param{wxCoord}{ yoffset = 0}}
|
|
||||||
|
|
||||||
\func{void}{DrawLines}{\param{wxList *}{points}, \param{wxCoord}{ xoffset = 0}, \param{wxCoord}{ yoffset = 0}}
|
|
||||||
|
|
||||||
Draws lines using an array of {\it points} of size {\it n}, or list of
|
|
||||||
pointers to points, adding the optional offset coordinate. The current
|
|
||||||
pen is used for drawing the lines. The programmer is responsible for
|
|
||||||
deleting the list of points.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawPolygon}\label{wxdcdrawpolygon}
|
|
||||||
|
|
||||||
\func{void}{DrawPolygon}{\param{int}{ n}, \param{wxPoint}{ points[]}, \param{wxCoord}{ xoffset = 0}, \param{wxCoord}{ yoffset = 0},\\
|
|
||||||
\param{int }{fill\_style = wxODDEVEN\_RULE}}
|
|
||||||
|
|
||||||
\func{void}{DrawPolygon}{\param{wxList *}{points}, \param{wxCoord}{ xoffset = 0}, \param{wxCoord}{ yoffset = 0},\\
|
|
||||||
\param{int }{fill\_style = wxODDEVEN\_RULE}}
|
|
||||||
|
|
||||||
Draws a filled polygon using an array of {\it points} of size {\it n},
|
|
||||||
or list of pointers to points, adding the optional offset coordinate.
|
|
||||||
|
|
||||||
The last argument specifies the fill rule: {\bf wxODDEVEN\_RULE} (the
|
|
||||||
default) or {\bf wxWINDING\_RULE}.
|
|
||||||
|
|
||||||
The current pen is used for drawing the outline, and the current brush
|
|
||||||
for filling the shape. Using a transparent brush suppresses filling.
|
|
||||||
The programmer is responsible for deleting the list of points.
|
|
||||||
|
|
||||||
Note that wxWindows automatically closes the first and last points.
|
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawPoint}\label{wxdcdrawpoint}
|
|
||||||
|
|
||||||
\func{void}{DrawPoint}{\param{wxCoord}{ x}, \param{wxCoord}{ y}}
|
|
||||||
|
|
||||||
Draws a point using the current pen.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawRectangle}\label{wxdcdrawrectangle}
|
|
||||||
|
|
||||||
\func{void}{DrawRectangle}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
|
|
||||||
|
|
||||||
Draws a rectangle with the given top left corner, and with the given
|
|
||||||
size. The current pen is used for the outline and the current brush
|
|
||||||
for filling the shape.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawRotatedText}\label{wxdcdrawrotatedtext}
|
|
||||||
|
|
||||||
\func{void}{DrawRotatedText}{\param{const wxString\& }{text}, \param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{double}{ angle}}
|
|
||||||
|
|
||||||
Draws the text rotated by {\it angle} degrees.
|
|
||||||
|
|
||||||
The wxMSW wxDC and wxSVGFileDC rotate the text around slightly different points, depending on the size of the font
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawRoundedRectangle}\label{wxdcdrawroundedrectangle}
|
|
||||||
|
|
||||||
\func{void}{DrawRoundedRectangle}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}, \param{double}{ radius = 20}}
|
|
||||||
|
|
||||||
Draws a rectangle with the given top left corner, and with the given
|
|
||||||
size. The corners are quarter-circles using the given radius. The
|
|
||||||
current pen is used for the outline and the current brush for filling
|
|
||||||
the shape.
|
|
||||||
|
|
||||||
If {\it radius} is positive, the value is assumed to be the
|
|
||||||
radius of the rounded corner. If {\it radius} is negative,
|
|
||||||
the absolute value is assumed to be the {\it proportion} of the smallest
|
|
||||||
dimension of the rectangle. This means that the corner can be
|
|
||||||
a sensible size relative to the size of the rectangle, and also avoids
|
|
||||||
the strange effects X produces when the corners are too big for
|
|
||||||
the rectangle.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawSpline}\label{wxdcdrawspline}
|
|
||||||
|
|
||||||
\func{void}{DrawSpline}{\param{wxList *}{points}}
|
|
||||||
|
|
||||||
Draws a spline between all given control points, using the current
|
|
||||||
pen. Doesn't delete the wxList and contents. The spline is drawn
|
|
||||||
using a series of lines, using an algorithm taken from the X drawing
|
|
||||||
program `XFIG'.
|
|
||||||
|
|
||||||
\func{void}{DrawSpline}{\param{wxCoord}{ x1}, \param{wxCoord}{ y1}, \param{wxCoord}{ x2}, \param{wxCoord}{ y2}, \param{wxCoord}{ x3}, \param{wxCoord}{ y3}}
|
|
||||||
|
|
||||||
Draws a three-point spline using the current pen.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::DrawText}\label{wxdcdrawtext}
|
|
||||||
|
|
||||||
\func{void}{DrawText}{\param{const wxString\& }{text}, \param{wxCoord}{ x}, \param{wxCoord}{ y}}
|
|
||||||
|
|
||||||
Draws a text string at the specified point, using the current text font,
|
|
||||||
and the current text foreground and background colours.
|
|
||||||
|
|
||||||
The coordinates refer to the top-left corner of the rectangle bounding
|
|
||||||
the string. See \helpref{wxSVGFileDC::GetTextExtent}{wxdcgettextextent} for how
|
|
||||||
to get the dimensions of a text string, which can be used to position the
|
|
||||||
text more precisely.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::EndDoc}\label{wxdcenddoc}
|
|
||||||
|
|
||||||
\func{void}{EndDoc}{\void}
|
|
||||||
|
|
||||||
Does nothing
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::EndDrawing}\label{wxdcenddrawing}
|
|
||||||
|
|
||||||
\func{void}{EndDrawing}{\void}
|
|
||||||
|
|
||||||
Does nothing
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::EndPage}\label{wxdcendpage}
|
|
||||||
|
|
||||||
\func{void}{EndPage}{\void}
|
|
||||||
|
|
||||||
Does nothing
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::FloodFill}\label{wxdcfloodfill}
|
|
||||||
|
|
||||||
\func{void}{FloodFill}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{const wxColour\&}{ colour}, \param{int}{ style=wxFLOOD\_SURFACE}}
|
|
||||||
|
|
||||||
Not implemented
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetBackground}\label{wxdcgetbackground}
|
|
||||||
|
|
||||||
\func{wxBrush\&}{GetBackground}{\void}
|
|
||||||
|
|
||||||
\constfunc{const wxBrush\&}{GetBackground}{\void}
|
|
||||||
|
|
||||||
Gets the brush used for painting the background (see \helpref{wxSVGFileDC::SetBackground}{wxdcsetbackground}).
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetBackgroundMode}\label{wxdcgetbackgroundmode}
|
|
||||||
|
|
||||||
\constfunc{int}{GetBackgroundMode}{\void}
|
|
||||||
|
|
||||||
Returns the current background mode: {\tt wxSOLID} or {\tt wxTRANSPARENT}.
|
|
||||||
|
|
||||||
\wxheading{See also}
|
|
||||||
|
|
||||||
\helpref{SetBackgroundMode}{wxdcsetbackgroundmode}
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetBrush}\label{wxdcgetbrush}
|
|
||||||
|
|
||||||
\func{wxBrush\&}{GetBrush}{\void}
|
|
||||||
|
|
||||||
\constfunc{const wxBrush\&}{GetBrush}{\void}
|
|
||||||
|
|
||||||
Gets the current brush (see \helpref{wxSVGFileDC::SetBrush}{wxdcsetbrush}).
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetCharHeight}\label{wxdcgetcharheight}
|
|
||||||
|
|
||||||
\func{wxCoord}{GetCharHeight}{\void}
|
|
||||||
|
|
||||||
Gets the character height of the currently set font.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetCharWidth}\label{wxdcgetcharwidth}
|
|
||||||
|
|
||||||
\func{wxCoord}{GetCharWidth}{\void}
|
|
||||||
|
|
||||||
Gets the average character width of the currently set font.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetClippingBox}\label{wxdcgetclippingbox}
|
|
||||||
|
|
||||||
\func{void}{GetClippingBox}{\param{wxCoord}{ *x}, \param{wxCoord}{ *y}, \param{wxCoord}{ *width}, \param{wxCoord}{ *height}}
|
|
||||||
|
|
||||||
Not implemented
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetFont}\label{wxdcgetfont}
|
|
||||||
|
|
||||||
\func{wxFont\&}{GetFont}{\void}
|
|
||||||
|
|
||||||
\constfunc{const wxFont\&}{GetFont}{\void}
|
|
||||||
|
|
||||||
Gets the current font (see \helpref{wxSVGFileDC::SetFont}{wxdcsetfont}).
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetLogicalFunction}\label{wxdcgetlogicalfunction}
|
|
||||||
|
|
||||||
\func{int}{GetLogicalFunction}{\void}
|
|
||||||
|
|
||||||
Gets the current logical function (see \helpref{wxSVGFileDC::SetLogicalFunction}{wxdcsetlogicalfunction}).
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetMapMode}\label{wxdcgetmapmode}
|
|
||||||
|
|
||||||
\func{int}{GetMapMode}{\void}
|
|
||||||
|
|
||||||
Gets the {\it mapping mode} for the device context (see \helpref{wxSVGFileDC::SetMapMode}{wxdcsetmapmode}).
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetPen}\label{wxdcgetpen}
|
|
||||||
|
|
||||||
\func{wxPen\&}{GetPen}{\void}
|
|
||||||
|
|
||||||
\constfunc{const wxPen\&}{GetPen}{\void}
|
|
||||||
|
|
||||||
Gets the current pen (see \helpref{wxSVGFileDC::SetPen}{wxdcsetpen}).
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetPixel}\label{wxdcgetpixel}
|
|
||||||
|
|
||||||
\func{bool}{GetPixel}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxColour *}{colour}}
|
|
||||||
|
|
||||||
Not implemented
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetSize}\label{wxdcgetsize}
|
|
||||||
|
|
||||||
\func{void}{GetSize}{\param{wxCoord *}{width}, \param{wxCoord *}{height}}
|
|
||||||
|
|
||||||
|
|
||||||
For a Windows printer device context, this gets the horizontal and vertical
|
|
||||||
resolution.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetTextBackground}\label{wxdcgettextbackground}
|
|
||||||
|
|
||||||
\func{wxColour\&}{GetTextBackground}{\void}
|
|
||||||
|
|
||||||
\constfunc{const wxColour\&}{GetTextBackground}{\void}
|
|
||||||
|
|
||||||
Gets the current text background colour (see \helpref{wxSVGFileDC::SetTextBackground}{wxdcsettextbackground}).
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetTextExtent}\label{wxdcgettextextent}
|
|
||||||
|
|
||||||
\func{void}{GetTextExtent}{\param{const wxString\& }{string}, \param{wxCoord *}{w}, \param{wxCoord *}{h},\\
|
|
||||||
\param{wxCoord *}{descent = NULL}, \param{wxCoord *}{externalLeading = NULL}, \param{wxFont *}{font = NULL}}
|
|
||||||
|
|
||||||
Gets the dimensions of the string using the currently selected font.
|
|
||||||
\rtfsp{\it string} is the text string to measure, {\it w} and {\it h} are
|
|
||||||
the total width and height respectively, {\it descent} is the
|
|
||||||
dimension from the baseline of the font to the bottom of the
|
|
||||||
descender, and {\it externalLeading} is any extra vertical space added
|
|
||||||
to the font by the font designer (usually is zero).
|
|
||||||
|
|
||||||
The optional parameter {\it font} specifies an alternative
|
|
||||||
to the currently selected font: but note that this does not
|
|
||||||
yet work under Windows, so you need to set a font for
|
|
||||||
the device context first.
|
|
||||||
|
|
||||||
See also \helpref{wxFont}{wxfont}, \helpref{wxSVGFileDC::SetFont}{wxdcsetfont}.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetTextForeground}\label{wxdcgettextforeground}
|
|
||||||
|
|
||||||
\func{wxColour\&}{GetTextForeground}{\void}
|
|
||||||
|
|
||||||
\constfunc{const wxColour\&}{GetTextForeground}{\void}
|
|
||||||
|
|
||||||
Gets the current text foreground colour (see \helpref{wxSVGFileDC::SetTextForeground}{wxdcsettextforeground}).
|
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::GetUserScale}\label{wxdcgetuserscale}
|
|
||||||
|
|
||||||
\func{void}{GetUserScale}{\param{double}{ *x}, \param{double}{ *y}}
|
|
||||||
|
|
||||||
Gets the current user scale factor (set by \helpref{SetUserScale}{wxdcsetuserscale}).
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::LogicalToDeviceX}\label{wxdclogicaltodevicex}
|
|
||||||
|
|
||||||
\func{wxCoord}{LogicalToDeviceX}{\param{wxCoord}{ x}}
|
|
||||||
|
|
||||||
Converts logical X coordinate to device coordinate, using the current
|
|
||||||
mapping mode.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::LogicalToDeviceXRel}\label{wxdclogicaltodevicexrel}
|
|
||||||
|
|
||||||
\func{wxCoord}{LogicalToDeviceXRel}{\param{wxCoord}{ x}}
|
|
||||||
|
|
||||||
Converts logical X coordinate to relative device coordinate, using the current
|
|
||||||
mapping mode but ignoring the x axis orientation.
|
|
||||||
Use this for converting a width, for example.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::LogicalToDeviceY}\label{wxdclogicaltodevicey}
|
|
||||||
|
|
||||||
\func{wxCoord}{LogicalToDeviceY}{\param{wxCoord}{ y}}
|
|
||||||
|
|
||||||
Converts logical Y coordinate to device coordinate, using the current
|
|
||||||
mapping mode.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::LogicalToDeviceYRel}\label{wxdclogicaltodeviceyrel}
|
|
||||||
|
|
||||||
\func{wxCoord}{LogicalToDeviceYRel}{\param{wxCoord}{ y}}
|
|
||||||
|
|
||||||
Converts logical Y coordinate to relative device coordinate, using the current
|
|
||||||
mapping mode but ignoring the y axis orientation.
|
|
||||||
Use this for converting a height, for example.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::MaxX}\label{wxdcmaxx}
|
|
||||||
|
|
||||||
\func{wxCoord}{MaxX}{\void}
|
|
||||||
|
|
||||||
Gets the maximum horizontal extent used in drawing commands so far.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::MaxY}\label{wxdcmaxy}
|
|
||||||
|
|
||||||
\func{wxCoord}{MaxY}{\void}
|
|
||||||
|
|
||||||
Gets the maximum vertical extent used in drawing commands so far.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::MinX}\label{wxdcminx}
|
|
||||||
|
|
||||||
\func{wxCoord}{MinX}{\void}
|
|
||||||
|
|
||||||
Gets the minimum horizontal extent used in drawing commands so far.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::MinY}\label{wxdcminy}
|
|
||||||
|
|
||||||
\func{wxCoord}{MinY}{\void}
|
|
||||||
|
|
||||||
Gets the minimum vertical extent used in drawing commands so far.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::Ok}\label{wxdcok}
|
|
||||||
|
|
||||||
\func{bool}{Ok}{\void}
|
|
||||||
|
|
||||||
Returns true if the DC is ok to use; False values arise from being unable to
|
|
||||||
write the file
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::ResetBoundingBox}\label{wxdcresetboundingbox}
|
|
||||||
|
|
||||||
\func{void}{ResetBoundingBox}{\void}
|
|
||||||
|
|
||||||
Resets the bounding box: after a call to this function, the bounding box
|
|
||||||
doesn't contain anything.
|
|
||||||
|
|
||||||
\wxheading{See also}
|
|
||||||
|
|
||||||
\helpref{CalcBoundingBox}{wxdccalcboundingbox}
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetAxisOrientation}\label{wxdcsetaxisorientation}
|
|
||||||
|
|
||||||
\func{void}{SetAxisOrientation}{\param{bool}{ xLeftRight},
|
|
||||||
\param{bool}{ yBottomUp}}
|
|
||||||
|
|
||||||
Sets the x and y axis orientation (i.e., the direction from lowest to
|
|
||||||
highest values on the axis). The default orientation is the natural
|
|
||||||
orientation, e.g. x axis from left to right and y axis from bottom up.
|
|
||||||
|
|
||||||
\wxheading{Parameters}
|
|
||||||
|
|
||||||
\docparam{xLeftRight}{True to set the x axis orientation to the natural
|
|
||||||
left to right orientation, false to invert it.}
|
|
||||||
|
|
||||||
\docparam{yBottomUp}{True to set the y axis orientation to the natural
|
|
||||||
bottom up orientation, false to invert it.}
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetDeviceOrigin}\label{wxdcsetdeviceorigin}
|
|
||||||
|
|
||||||
\func{void}{SetDeviceOrigin}{\param{wxCoord}{ x}, \param{wxCoord}{ y}}
|
|
||||||
|
|
||||||
Sets the device origin (i.e., the origin in pixels after scaling has been
|
|
||||||
applied).
|
|
||||||
|
|
||||||
This function may be useful in Windows printing
|
|
||||||
operations for placing a graphic on a page.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetBackground}\label{wxdcsetbackground}
|
|
||||||
|
|
||||||
\func{void}{SetBackground}{\param{const wxBrush\& }{brush}}
|
|
||||||
|
|
||||||
Sets the current background brush for the DC.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetBackgroundMode}\label{wxdcsetbackgroundmode}
|
|
||||||
|
|
||||||
\func{void}{SetBackgroundMode}{\param{int}{ mode}}
|
|
||||||
|
|
||||||
{\it mode} may be one of wxSOLID and wxTRANSPARENT. This setting determines
|
|
||||||
whether text will be drawn with a background colour or not.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetClippingRegion}\label{wxdcsetclippingregion}
|
|
||||||
|
|
||||||
\func{void}{SetClippingRegion}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}
|
|
||||||
|
|
||||||
\func{void}{SetClippingRegion}{\param{const wxPoint\& }{pt}, \param{const wxSize\& }{sz}}
|
|
||||||
|
|
||||||
\func{void}{SetClippingRegion}{\param{const wxRect\&}{ rect}}
|
|
||||||
|
|
||||||
\func{void}{SetClippingRegion}{\param{const wxRegion\&}{ region}}
|
|
||||||
|
|
||||||
Not implemented
|
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetPalette}\label{wxdcsetpalette}
|
|
||||||
|
|
||||||
\func{void}{SetPalette}{\param{const wxPalette\& }{palette}}
|
|
||||||
|
|
||||||
Not implemented
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetBrush}\label{wxdcsetbrush}
|
|
||||||
|
|
||||||
\func{void}{SetBrush}{\param{const wxBrush\& }{brush}}
|
|
||||||
|
|
||||||
Sets the current brush for the DC.
|
|
||||||
|
|
||||||
If the argument is wxNullBrush, the current brush is selected out of the device
|
|
||||||
context, and the original brush restored, allowing the current brush to
|
|
||||||
be destroyed safely.
|
|
||||||
|
|
||||||
See also \helpref{wxBrush}{wxbrush}.
|
|
||||||
|
|
||||||
See also \helpref{wxMemoryDC}{wxmemorydc} for the interpretation of colours
|
|
||||||
when drawing into a monochrome bitmap.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetFont}\label{wxdcsetfont}
|
|
||||||
|
|
||||||
\func{void}{SetFont}{\param{const wxFont\& }{font}}
|
|
||||||
|
|
||||||
Sets the current font for the DC. It must be a valid font, in particular you
|
|
||||||
should not pass {\tt wxNullFont} to this method.
|
|
||||||
|
|
||||||
See also \helpref{wxFont}{wxfont}.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetLogicalFunction}\label{wxdcsetlogicalfunction}
|
|
||||||
|
|
||||||
\func{void}{SetLogicalFunction}{\param{int}{ function}}
|
|
||||||
|
|
||||||
|
|
||||||
Only wxCOPY is avalaible; trying to set one of the othe values will fail
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetMapMode}\label{wxdcsetmapmode}
|
|
||||||
|
|
||||||
\func{void}{SetMapMode}{\param{int}{ int}}
|
|
||||||
|
|
||||||
The {\it mapping mode} of the device context defines the unit of
|
|
||||||
measurement used to convert logical units to device units. Note that
|
|
||||||
in X, text drawing isn't handled consistently with the mapping mode; a
|
|
||||||
font is always specified in point size. However, setting the {\it
|
|
||||||
user scale} (see \helpref{wxSVGFileDC::SetUserScale}{wxdcsetuserscale}) scales the text appropriately. In
|
|
||||||
Windows, scaleable TrueType fonts are always used; in X, results depend
|
|
||||||
on availability of fonts, but usually a reasonable match is found.
|
|
||||||
|
|
||||||
Note that the coordinate origin should ideally be selectable, but for
|
|
||||||
now is always at the top left of the screen/printer.
|
|
||||||
|
|
||||||
Drawing to a Windows printer device context under UNIX
|
|
||||||
uses the current mapping mode, but mapping mode is currently ignored for
|
|
||||||
PostScript output.
|
|
||||||
|
|
||||||
The mapping mode can be one of the following:
|
|
||||||
|
|
||||||
\begin{twocollist}\itemsep=0pt
|
|
||||||
\twocolitem{wxMM\_TWIPS}{Each logical unit is 1/20 of a point, or 1/1440 of
|
|
||||||
an inch.}
|
|
||||||
\twocolitem{wxMM\_POINTS}{Each logical unit is a point, or 1/72 of an inch.}
|
|
||||||
\twocolitem{wxMM\_METRIC}{Each logical unit is 1 mm.}
|
|
||||||
\twocolitem{wxMM\_LOMETRIC}{Each logical unit is 1/10 of a mm.}
|
|
||||||
\twocolitem{wxMM\_TEXT}{Each logical unit is 1 pixel.}
|
|
||||||
\end{twocollist}
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetPen}\label{wxdcsetpen}
|
|
||||||
|
|
||||||
\func{void}{SetPen}{\param{const wxPen\& }{pen}}
|
|
||||||
|
|
||||||
Sets the current pen for the DC.
|
|
||||||
|
|
||||||
If the argument is wxNullPen, the current pen is selected out of the device
|
|
||||||
context, and the original pen restored.
|
|
||||||
|
|
||||||
See also \helpref{wxMemoryDC}{wxmemorydc} for the interpretation of colours
|
|
||||||
when drawing into a monochrome bitmap.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetTextBackground}\label{wxdcsettextbackground}
|
|
||||||
|
|
||||||
\func{void}{SetTextBackground}{\param{const wxColour\& }{colour}}
|
|
||||||
|
|
||||||
Sets the current text background colour for the DC.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetTextForeground}\label{wxdcsettextforeground}
|
|
||||||
|
|
||||||
\func{void}{SetTextForeground}{\param{const wxColour\& }{colour}}
|
|
||||||
|
|
||||||
Sets the current text foreground colour for the DC.
|
|
||||||
|
|
||||||
See also \helpref{wxMemoryDC}{wxmemorydc} for the interpretation of colours
|
|
||||||
when drawing into a monochrome bitmap.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::SetUserScale}\label{wxdcsetuserscale}
|
|
||||||
|
|
||||||
\func{void}{SetUserScale}{\param{double}{ xScale}, \param{double}{ yScale}}
|
|
||||||
|
|
||||||
Sets the user scaling factor, useful for applications which require
|
|
||||||
`zooming'.
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::StartDoc}\label{wxdcstartdoc}
|
|
||||||
|
|
||||||
\func{bool}{StartDoc}{\param{const wxString\& }{message}}
|
|
||||||
|
|
||||||
Does nothing
|
|
||||||
|
|
||||||
\membersection{wxSVGFileDC::StartPage}\label{wxdcstartpage}
|
|
||||||
|
|
||||||
\func{bool}{StartPage}{\void}
|
|
||||||
|
|
||||||
Does nothing
|
|
@@ -1,315 +0,0 @@
|
|||||||
#ifndef __DCSVG_H
|
|
||||||
#define __DCSVG_H
|
|
||||||
#include "wx/wfstream.h"
|
|
||||||
#include "wx/string.h"
|
|
||||||
|
|
||||||
#ifdef WXMAKINGDLL_SVG
|
|
||||||
#define WXDLLIMPEXP_SVG WXEXPORT
|
|
||||||
#elif defined(WXUSINGDLL)
|
|
||||||
#define WXDLLIMPEXP_SVG WXIMPORT
|
|
||||||
#else // not making nor using DLL
|
|
||||||
#define WXDLLIMPEXP_SVG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define wxSVGVersion wxT("v0100")
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma warn -rch
|
|
||||||
#pragma warn -ccc
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
|
|
||||||
{
|
|
||||||
|
|
||||||
private:
|
|
||||||
wxFileOutputStream * m_outfile ;
|
|
||||||
wxString m_filename ;
|
|
||||||
//holds number of png format images we have
|
|
||||||
int m_sub_images ;
|
|
||||||
bool m_OK, m_graphics_changed ;
|
|
||||||
int m_width, m_height ;
|
|
||||||
|
|
||||||
double
|
|
||||||
m_logicalScaleX,
|
|
||||||
m_logicalScaleY,
|
|
||||||
m_userScaleX,
|
|
||||||
m_userScaleY,
|
|
||||||
m_scaleX,
|
|
||||||
m_scaleY,
|
|
||||||
m_OriginX,
|
|
||||||
m_OriginY,
|
|
||||||
m_mm_to_pix_x,
|
|
||||||
m_mm_to_pix_y;
|
|
||||||
|
|
||||||
bool
|
|
||||||
m_needComputeScaleX,
|
|
||||||
m_needComputeScaleY; // not yet used
|
|
||||||
|
|
||||||
|
|
||||||
bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const
|
|
||||||
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return true; };
|
|
||||||
|
|
||||||
virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, class wxDC *,
|
|
||||||
wxCoord, wxCoord, int = wxCOPY, bool = 0, int = -1, int = -1) ;
|
|
||||||
|
|
||||||
void DoCrossHair(wxCoord, wxCoord)
|
|
||||||
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::CrossHair Call not implemented")); return ; };
|
|
||||||
|
|
||||||
void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord);
|
|
||||||
|
|
||||||
void DoDrawBitmap(const class wxBitmap &, wxCoord, wxCoord, bool = 0) ;
|
|
||||||
|
|
||||||
void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height) ;
|
|
||||||
|
|
||||||
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) ;
|
|
||||||
|
|
||||||
void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) ;
|
|
||||||
|
|
||||||
void DoDrawIcon(const class wxIcon &, wxCoord, wxCoord) ;
|
|
||||||
|
|
||||||
void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) ;
|
|
||||||
|
|
||||||
void DoDrawPoint(wxCoord, wxCoord) ;
|
|
||||||
|
|
||||||
void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle) ;
|
|
||||||
|
|
||||||
void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) ;
|
|
||||||
|
|
||||||
void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) ;
|
|
||||||
|
|
||||||
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20) ;
|
|
||||||
|
|
||||||
void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
|
|
||||||
|
|
||||||
bool DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxColour& WXUNUSED(col),
|
|
||||||
int WXUNUSED(style) = wxFLOOD_SURFACE)
|
|
||||||
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::DoFloodFill Call not implemented")); return false ; };
|
|
||||||
|
|
||||||
void DoGetSize(int * x, int *y) const { *x = m_width; *y = m_height ; return ; } ;
|
|
||||||
|
|
||||||
void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, wxFont *font = NULL) const ;
|
|
||||||
|
|
||||||
void DoSetClippingRegionAsRegion(const class wxRegion &)
|
|
||||||
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion Call not yet implemented")); return ; };
|
|
||||||
|
|
||||||
void Init (wxString f, int Width, int Height, float dpi);
|
|
||||||
|
|
||||||
void NewGraphics () ;
|
|
||||||
|
|
||||||
#ifdef XDEV2LOG
|
|
||||||
#undef XDEV2LOG
|
|
||||||
#endif
|
|
||||||
wxCoord XDEV2LOG(wxCoord x) const
|
|
||||||
{
|
|
||||||
wxCoord new_x = x - m_deviceOriginX;
|
|
||||||
if (new_x > 0)
|
|
||||||
return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
|
|
||||||
}
|
|
||||||
#ifdef XDEV2LOGREL
|
|
||||||
#undef XDEV2LOGREL
|
|
||||||
#endif
|
|
||||||
wxCoord XDEV2LOGREL(wxCoord x) const
|
|
||||||
{
|
|
||||||
if (x > 0)
|
|
||||||
return (wxCoord)((double)(x) / m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) / m_scaleX - 0.5);
|
|
||||||
}
|
|
||||||
#ifdef YDEV2LOG
|
|
||||||
#undef YDEV2LOG
|
|
||||||
#endif
|
|
||||||
wxCoord YDEV2LOG(wxCoord y) const
|
|
||||||
{
|
|
||||||
wxCoord new_y = y - m_deviceOriginY;
|
|
||||||
if (new_y > 0)
|
|
||||||
return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
|
|
||||||
}
|
|
||||||
#ifdef YDEV2LOGREL
|
|
||||||
#undef YDEV2LOGREL
|
|
||||||
#endif
|
|
||||||
wxCoord YDEV2LOGREL(wxCoord y) const
|
|
||||||
{
|
|
||||||
if (y > 0)
|
|
||||||
return (wxCoord)((double)(y) / m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) / m_scaleY - 0.5);
|
|
||||||
}
|
|
||||||
#ifdef XLOG2DEV
|
|
||||||
#undef XLOG2DEV
|
|
||||||
#endif
|
|
||||||
wxCoord XLOG2DEV(wxCoord x) const
|
|
||||||
{
|
|
||||||
wxCoord new_x = x - m_logicalOriginX;
|
|
||||||
if (new_x > 0)
|
|
||||||
return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
|
|
||||||
}
|
|
||||||
#ifdef XLOG2DEVREL
|
|
||||||
#undef XLOG2DEVREL
|
|
||||||
#endif
|
|
||||||
wxCoord XLOG2DEVREL(wxCoord x) const
|
|
||||||
{
|
|
||||||
if (x > 0)
|
|
||||||
return (wxCoord)((double)(x) * m_scaleX + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(x) * m_scaleX - 0.5);
|
|
||||||
}
|
|
||||||
#ifdef YLOG2DEV
|
|
||||||
#undef YLOG2DEV
|
|
||||||
#endif
|
|
||||||
wxCoord YLOG2DEV(wxCoord y) const
|
|
||||||
{
|
|
||||||
wxCoord new_y = y - m_logicalOriginY;
|
|
||||||
if (new_y > 0)
|
|
||||||
return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
|
|
||||||
}
|
|
||||||
#ifdef YLOG2DEVREL
|
|
||||||
#undef YLOG2DEVREL
|
|
||||||
#endif
|
|
||||||
wxCoord YLOG2DEVREL(wxCoord y) const
|
|
||||||
{
|
|
||||||
if (y > 0)
|
|
||||||
return (wxCoord)((double)(y) * m_scaleY + 0.5);
|
|
||||||
else
|
|
||||||
return (wxCoord)((double)(y) * m_scaleY - 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
void write(const wxString &s);
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxSVGFileDC (wxString f);
|
|
||||||
wxSVGFileDC (wxString f, int Width, int Height);
|
|
||||||
wxSVGFileDC (wxString f, int Width, int Height, float dpi);
|
|
||||||
~wxSVGFileDC();
|
|
||||||
|
|
||||||
|
|
||||||
bool CanDrawBitmap() const { return true; };
|
|
||||||
|
|
||||||
bool CanGetTextExtent() const { return true; };
|
|
||||||
|
|
||||||
int GetDepth() const
|
|
||||||
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; };
|
|
||||||
|
|
||||||
void BeginDrawing() { return;};
|
|
||||||
|
|
||||||
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC* source, wxCoord xsrc, wxCoord ysrc, int logicalFunc = wxCOPY, bool useMask = false)
|
|
||||||
{ return DoBlit(xdest, ydest, width, height, source, xsrc, ysrc, logicalFunc, useMask); };
|
|
||||||
|
|
||||||
void Clear()
|
|
||||||
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?")); return ; };
|
|
||||||
|
|
||||||
void CrossHair(wxCoord x, wxCoord y)
|
|
||||||
{ DoCrossHair (x,y); return; };
|
|
||||||
|
|
||||||
virtual void ComputeScaleAndOrigin();
|
|
||||||
|
|
||||||
void DestroyClippingRegion()
|
|
||||||
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::void Call not yet implemented")); return ; };
|
|
||||||
|
|
||||||
wxCoord DeviceToLogicalX(wxCoord x) const ;
|
|
||||||
|
|
||||||
wxCoord DeviceToLogicalXRel(wxCoord x) const ;
|
|
||||||
|
|
||||||
wxCoord DeviceToLogicalY(wxCoord y) const ;
|
|
||||||
|
|
||||||
wxCoord DeviceToLogicalYRel(wxCoord y) const ;
|
|
||||||
|
|
||||||
void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool transparent)
|
|
||||||
{ DoDrawBitmap ( bitmap, x, y, transparent ) ; return ;};
|
|
||||||
|
|
||||||
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
|
|
||||||
{DoDrawIcon(icon, x, y) ; return ; };
|
|
||||||
|
|
||||||
void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0) ;
|
|
||||||
|
|
||||||
void EndDoc()
|
|
||||||
{ return ; };
|
|
||||||
|
|
||||||
void EndDrawing()
|
|
||||||
{ return ; };
|
|
||||||
|
|
||||||
void EndPage()
|
|
||||||
{ return ; };
|
|
||||||
|
|
||||||
void FloodFill(wxCoord x, wxCoord y, wxColour *colour, int style=wxFLOOD_SURFACE)
|
|
||||||
{ DoFloodFill (x, y, *colour, style); return ;} ;
|
|
||||||
|
|
||||||
wxCoord GetCharHeight() const;
|
|
||||||
|
|
||||||
wxCoord GetCharWidth() const;
|
|
||||||
|
|
||||||
void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y), wxCoord * WXUNUSED(width), wxCoord * WXUNUSED(height))
|
|
||||||
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetClippingBox Call not yet implemented")); return ; };
|
|
||||||
|
|
||||||
int GetLogicalFunction()
|
|
||||||
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetLogicalFunction() Call not implemented")); return wxCOPY ; };
|
|
||||||
|
|
||||||
int GetMapMode() ;
|
|
||||||
|
|
||||||
bool GetPixel(wxCoord x, wxCoord y, wxColour *colour)
|
|
||||||
{ return DoGetPixel (x, y, colour) ; } ;
|
|
||||||
|
|
||||||
void GetUserScale(double *x, double *y) const ;
|
|
||||||
|
|
||||||
wxCoord LogicalToDeviceX(wxCoord x) const ;
|
|
||||||
|
|
||||||
wxCoord LogicalToDeviceXRel(wxCoord x) const ;
|
|
||||||
|
|
||||||
wxCoord LogicalToDeviceY(wxCoord y) const ;
|
|
||||||
|
|
||||||
wxCoord LogicalToDeviceYRel(wxCoord y) const ;
|
|
||||||
|
|
||||||
bool Ok() const {return m_OK;};
|
|
||||||
|
|
||||||
void SetAxisOrientation( bool xLeftRight, bool yBottomUp ) ;
|
|
||||||
|
|
||||||
void SetClippingRegion(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxCoord WXUNUSED(width), wxCoord WXUNUSED(height))
|
|
||||||
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetClippingRegion Call not yet implemented")); return ; };
|
|
||||||
|
|
||||||
void SetPalette(const wxPalette& WXUNUSED(palette))
|
|
||||||
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetPalette Call not yet implemented")); return ; };
|
|
||||||
|
|
||||||
void SetBackground( const wxBrush &brush ) ;
|
|
||||||
|
|
||||||
void SetBackgroundMode( int mode ) ;
|
|
||||||
|
|
||||||
void SetBrush(const wxBrush& brush) ;
|
|
||||||
|
|
||||||
void SetFont(const wxFont& font) ;
|
|
||||||
|
|
||||||
void SetLogicalFunction(int WXUNUSED(function))
|
|
||||||
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetLogicalFunction Call implemented")); return ; };
|
|
||||||
|
|
||||||
void SetLogicalScale( double x, double y ) ;
|
|
||||||
|
|
||||||
void SetLogicalOrigin( wxCoord x, wxCoord y ) ;
|
|
||||||
|
|
||||||
void SetDeviceOrigin( wxCoord x, wxCoord y ) ;
|
|
||||||
|
|
||||||
void SetMapMode(int anint) ;
|
|
||||||
|
|
||||||
void SetPen(const wxPen& pen) ;
|
|
||||||
|
|
||||||
void SetUserScale(double xScale, double yScale) ;
|
|
||||||
|
|
||||||
bool StartDoc(const wxString& WXUNUSED(message))
|
|
||||||
{ return false; };
|
|
||||||
|
|
||||||
void StartPage()
|
|
||||||
{ return ; };
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma warn .rch
|
|
||||||
#pragma warn .ccc
|
|
||||||
#endif
|
|
||||||
#endif
|
|
@@ -1,849 +0,0 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Name: svg.cpp
|
|
||||||
// Purpose: SVG sample
|
|
||||||
// Author: Chris Elliott
|
|
||||||
// Modified by:
|
|
||||||
// RCS-ID: $Id$
|
|
||||||
// Licence: wxWindows license
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx/wx.h".
|
|
||||||
#include "wx/wxprec.h"
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma hdrstop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
|
||||||
#include "wx/wx.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "wx/svg/dcsvg.h"
|
|
||||||
|
|
||||||
#include "wx/image.h"
|
|
||||||
|
|
||||||
#define wxSVG_DEBUG FALSE
|
|
||||||
// or TRUE to see the calls being executed
|
|
||||||
#define newline wxString(wxT("\n"))
|
|
||||||
#define space wxString(wxT(" "))
|
|
||||||
#define semicolon wxString(wxT(";"))
|
|
||||||
#define wx_round(a) (int)((a)+.5)
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma warn -rch
|
|
||||||
#pragma warn -ccc
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } ;
|
|
||||||
|
|
||||||
wxString wxColStr ( wxColour c )
|
|
||||||
{
|
|
||||||
unsigned char r, g, b ;
|
|
||||||
r = c.Red ();
|
|
||||||
g = c.Green ();
|
|
||||||
b = c. Blue ();
|
|
||||||
|
|
||||||
// possible Unicode bug here
|
|
||||||
wxString s = wxDecToHex(r) + wxDecToHex(g) + wxDecToHex(b) ;
|
|
||||||
return s ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxString wxBrushString ( wxColour c, int style )
|
|
||||||
{
|
|
||||||
wxString s = wxT("fill:#") + wxColStr (c) + semicolon + space ;
|
|
||||||
switch ( style )
|
|
||||||
{
|
|
||||||
case wxSOLID :
|
|
||||||
s = s + wxT("fill-opacity:1.0; ");
|
|
||||||
break ;
|
|
||||||
case wxTRANSPARENT:
|
|
||||||
s = s + wxT("fill-opacity:0.0; ");
|
|
||||||
break ;
|
|
||||||
|
|
||||||
default :
|
|
||||||
wxASSERT_MSG(FALSE, wxT("wxSVGFileDC::Requested Brush Style not available")) ;
|
|
||||||
|
|
||||||
}
|
|
||||||
s = s + newline ;
|
|
||||||
return s ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::Init (wxString f, int Width, int Height, float dpi)
|
|
||||||
|
|
||||||
{
|
|
||||||
//set up things first wxDCBase does all this?
|
|
||||||
m_width = Width ;
|
|
||||||
m_height = Height ;
|
|
||||||
|
|
||||||
m_clipping = FALSE;
|
|
||||||
m_OK = TRUE;
|
|
||||||
|
|
||||||
m_mm_to_pix_x = dpi/25.4;
|
|
||||||
m_mm_to_pix_y = dpi/25.4;
|
|
||||||
|
|
||||||
m_signX = m_signY = 1;
|
|
||||||
|
|
||||||
m_userScaleX = m_userScaleY =
|
|
||||||
m_deviceOriginX = m_deviceOriginY = 0;
|
|
||||||
|
|
||||||
m_OriginX = m_OriginY = 0;
|
|
||||||
m_logicalOriginX = m_logicalOriginY = 0;
|
|
||||||
m_logicalScaleX = m_logicalScaleY = 0 ;
|
|
||||||
m_scaleX = m_scaleY = 1.0 ;
|
|
||||||
|
|
||||||
m_logicalFunction = wxCOPY;
|
|
||||||
m_backgroundMode = wxTRANSPARENT;
|
|
||||||
m_mappingMode = wxMM_TEXT;
|
|
||||||
|
|
||||||
m_backgroundBrush = *wxTRANSPARENT_BRUSH;
|
|
||||||
m_textForegroundColour = *wxBLACK;
|
|
||||||
m_textBackgroundColour = *wxWHITE;
|
|
||||||
m_colour = wxColourDisplay();
|
|
||||||
|
|
||||||
m_pen = *wxBLACK_PEN;
|
|
||||||
m_font = *wxNORMAL_FONT;
|
|
||||||
m_brush = *wxWHITE_BRUSH;
|
|
||||||
|
|
||||||
m_graphics_changed = TRUE ;
|
|
||||||
|
|
||||||
////////////////////code here
|
|
||||||
|
|
||||||
m_outfile = new wxFileOutputStream(f) ;
|
|
||||||
m_OK = m_outfile->Ok ();
|
|
||||||
if (m_OK)
|
|
||||||
{
|
|
||||||
m_filename = f ;
|
|
||||||
m_sub_images = 0 ;
|
|
||||||
wxString s ;
|
|
||||||
s = wxT("<?xml version=\"1.0\" standalone=\"no\"?>") ; s = s + newline ;
|
|
||||||
write(s);
|
|
||||||
s = wxT("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 20010904//EN\" ") + newline ;
|
|
||||||
write(s);
|
|
||||||
s = wxT("\"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\"> ")+ newline ;
|
|
||||||
write(s);
|
|
||||||
s.Printf ( wxT("<svg width=\"%.2gcm\" height=\"%.2gcm\" viewBox=\"0 0 %d %d \"> \n"), float(Width)/dpi*2.54, float(Height)/dpi*2.54, Width, Height );
|
|
||||||
write(s);
|
|
||||||
s = wxT("<title>SVG Picture created as ") + wxFileNameFromPath(f) + wxT(" </title>") + newline ;
|
|
||||||
write(s);
|
|
||||||
s = wxString (wxT("<desc>Picture generated by wxSVG ")) + wxSVGVersion + wxT(" </desc>")+ newline ;
|
|
||||||
write(s);
|
|
||||||
s = wxT("<g style=\"fill:black; stroke:black; stroke-width:1\">") + newline ;
|
|
||||||
write(s);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// constructors
|
|
||||||
wxSVGFileDC::wxSVGFileDC (wxString f)
|
|
||||||
{
|
|
||||||
// quarter 640x480 screen display at 72 dpi
|
|
||||||
Init (f,320,240,72.0);
|
|
||||||
};
|
|
||||||
|
|
||||||
wxSVGFileDC::wxSVGFileDC (wxString f, int Width, int Height)
|
|
||||||
{
|
|
||||||
Init (f,Width,Height,72.0);
|
|
||||||
};
|
|
||||||
|
|
||||||
wxSVGFileDC::wxSVGFileDC (wxString f, int Width, int Height, float dpi)
|
|
||||||
{
|
|
||||||
Init (f,Width,Height,dpi);
|
|
||||||
};
|
|
||||||
|
|
||||||
wxSVGFileDC::~wxSVGFileDC()
|
|
||||||
{
|
|
||||||
wxString s = wxT("</g> \n</svg> \n") ;
|
|
||||||
write(s);
|
|
||||||
delete m_outfile ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
|
|
||||||
{
|
|
||||||
if (m_graphics_changed) NewGraphics ();
|
|
||||||
wxString s ;
|
|
||||||
s.Printf ( wxT("<path d=\"M%d %d L%d %d\" /> \n"), x1,y1,x2,y2 );
|
|
||||||
if (m_OK)
|
|
||||||
{
|
|
||||||
write(s);
|
|
||||||
}
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DrawLine Call executed")) ;
|
|
||||||
CalcBoundingBox(x1, y1) ;
|
|
||||||
CalcBoundingBox(x2, y2) ;
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset , wxCoord yoffset )
|
|
||||||
{
|
|
||||||
for ( int i = 1; i < n ; i++ )
|
|
||||||
{
|
|
||||||
DoDrawLine ( points [i-1].x + xoffset, points [i-1].y + yoffset,
|
|
||||||
points [ i ].x + xoffset, points [ i ].y + yoffset ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawPoint (wxCoord x1, wxCoord y1)
|
|
||||||
{
|
|
||||||
wxString s;
|
|
||||||
if (m_graphics_changed) NewGraphics ();
|
|
||||||
s = wxT("<g style = \"stroke-linecap:round;\" > ") + newline ;
|
|
||||||
write(s);
|
|
||||||
DrawLine ( x1,y1,x1,y1 );
|
|
||||||
s = wxT("</g>");
|
|
||||||
write(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, wxCoord width, wxCoord height)
|
|
||||||
{
|
|
||||||
wxDCBase::DoDrawCheckMark (x1,y1,width,height) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawText(const wxString& text, wxCoord x1, wxCoord y1)
|
|
||||||
{
|
|
||||||
DoDrawRotatedText(text, x1,y1,0.0);
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DrawText Call executed")) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoord y, double angle)
|
|
||||||
{
|
|
||||||
//known bug; if the font is drawn in a scaled DC, it will not behave exactly as wxMSW
|
|
||||||
if (m_graphics_changed) NewGraphics ();
|
|
||||||
wxString s, sTmp;
|
|
||||||
|
|
||||||
// calculate bounding box
|
|
||||||
wxCoord w, h, desc ;
|
|
||||||
DoGetTextExtent(sText, &w, &h, &desc);
|
|
||||||
|
|
||||||
double rad = DegToRad(angle);
|
|
||||||
|
|
||||||
// wxT("upper left") and wxT("upper right")
|
|
||||||
CalcBoundingBox(x, y);
|
|
||||||
CalcBoundingBox((wxCoord)(x + w*cos(rad)), (wxCoord)(y - h*sin(rad)));
|
|
||||||
|
|
||||||
// wxT("bottom left") and wxT("bottom right")
|
|
||||||
x += (wxCoord)(h*sin(rad));
|
|
||||||
y += (wxCoord)(h*cos(rad));
|
|
||||||
CalcBoundingBox(x, y);
|
|
||||||
CalcBoundingBox((wxCoord)(x + h*sin(rad)), (wxCoord)(y + h*cos(rad)));
|
|
||||||
|
|
||||||
if (m_backgroundMode == wxSOLID)
|
|
||||||
{
|
|
||||||
// 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
|
|
||||||
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::Draw Rotated Text Call plotting text background")) ;
|
|
||||||
sTmp.Printf ( wxT(" <rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" "), x,y+desc-h, w, h );
|
|
||||||
s = sTmp + wxT("style=\"fill:#") + wxColStr (m_textBackgroundColour) + wxT("; ") ;
|
|
||||||
s = s + wxT("stroke-width:1; stroke:#") + wxColStr (m_textBackgroundColour) + wxT("; ") ;
|
|
||||||
sTmp.Printf ( wxT("\" transform=\"rotate( %.2g %d %d ) \">"), -angle, x,y ) ;
|
|
||||||
s = s + sTmp + newline ;
|
|
||||||
write(s);
|
|
||||||
}
|
|
||||||
//now do the text itself
|
|
||||||
s.Printf (wxT(" <text x=\"%d\" y=\"%d\" "),x,y );
|
|
||||||
|
|
||||||
sTmp = m_font.GetFaceName () ;
|
|
||||||
if (sTmp.Len () > 0) s = s + wxT("style=\"font-family:") + sTmp + wxT("; ");
|
|
||||||
else s = s + wxT("style=\" ") ;
|
|
||||||
|
|
||||||
wxString fontweights [3] = { wxT("normal"), wxT("lighter"), wxT("bold") };
|
|
||||||
s = s + wxT("font-weight:") + fontweights[m_font.GetWeight() - wxNORMAL] + semicolon + space;
|
|
||||||
|
|
||||||
wxString fontstyles [5] = { wxT("normal"), wxT("style error"), wxT("style error"), wxT("italic"), wxT("oblique") };
|
|
||||||
s = s + wxT("font-style:") + fontstyles[m_font.GetStyle() - wxNORMAL] + semicolon + space;
|
|
||||||
|
|
||||||
sTmp.Printf (wxT("font-size:%dpt; fill:#"), m_font.GetPointSize () );
|
|
||||||
s = s + sTmp ;
|
|
||||||
s = s + wxColStr (m_textForegroundColour) + wxT("; stroke:#") + wxColStr (m_textForegroundColour) + wxT("; ") ;
|
|
||||||
sTmp.Printf ( wxT("stroke-width:0;\" transform=\"rotate( %.2g %d %d ) \" >"), -angle, x,y ) ;
|
|
||||||
s = s + sTmp + sText + wxT("</text> ") + newline ;
|
|
||||||
if (m_OK)
|
|
||||||
{
|
|
||||||
write(s);
|
|
||||||
}
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DrawRotatedText Call executed")) ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
|
||||||
{
|
|
||||||
DoDrawRoundedRectangle(x, y, width, height, 0) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
|
|
||||||
|
|
||||||
{
|
|
||||||
if (m_graphics_changed) NewGraphics ();
|
|
||||||
wxString s ;
|
|
||||||
|
|
||||||
s.Printf ( wxT(" <rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" rx=\"%.2g\" "),
|
|
||||||
x, y, width, height, radius );
|
|
||||||
|
|
||||||
s = s + wxT(" /> ") + newline ;
|
|
||||||
write(s);
|
|
||||||
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawRoundedRectangle Call executed")) ;
|
|
||||||
CalcBoundingBox(x, y) ;
|
|
||||||
CalcBoundingBox(x + width, y + height) ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle)
|
|
||||||
{
|
|
||||||
if (m_graphics_changed) NewGraphics ();
|
|
||||||
wxString s, sTmp ;
|
|
||||||
s = wxT("<polygon style=\"") ;
|
|
||||||
if ( fillStyle == wxODDEVEN_RULE )
|
|
||||||
s = s + wxT("fill-rule:evenodd; ");
|
|
||||||
else
|
|
||||||
s = s + wxT("fill-rule:nonzero; ");
|
|
||||||
|
|
||||||
s = s + wxT("\" \npoints=\"") ;
|
|
||||||
|
|
||||||
for (int i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
sTmp.Printf ( wxT("%d,%d"), points [i].x+xoffset, points[i].y+yoffset );
|
|
||||||
s = s + sTmp + newline ;
|
|
||||||
CalcBoundingBox ( points [i].x+xoffset, points[i].y+yoffset);
|
|
||||||
}
|
|
||||||
s = s + wxT("\" /> ") ;
|
|
||||||
s = s + newline ;
|
|
||||||
write(s);
|
|
||||||
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawPolygon Call executed")) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
|
||||||
|
|
||||||
{
|
|
||||||
if (m_graphics_changed) NewGraphics ();
|
|
||||||
|
|
||||||
int rh = height /2 ;
|
|
||||||
int rw = width /2 ;
|
|
||||||
|
|
||||||
wxString s;
|
|
||||||
s.Printf ( wxT("<ellipse cx=\"%d\" cy=\"%d\" rx=\"%d\" ry=\"%d\" "), x+rw,y+rh, rw, rh );
|
|
||||||
s = s + wxT(" /> ") + newline ;
|
|
||||||
|
|
||||||
write(s);
|
|
||||||
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawEllipse Call executed")) ;
|
|
||||||
CalcBoundingBox(x, y) ;
|
|
||||||
CalcBoundingBox(x + width, y + height) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc)
|
|
||||||
{
|
|
||||||
/* Draws an arc of a circle, centred on (xc, yc), with starting point
|
|
||||||
(x1, y1) and ending at (x2, y2). The current pen is used for the outline
|
|
||||||
and the current brush for filling the shape.
|
|
||||||
|
|
||||||
The arc is drawn in an anticlockwise direction from the start point to
|
|
||||||
the end point.
|
|
||||||
|
|
||||||
Might be better described as Pie drawing */
|
|
||||||
|
|
||||||
if (m_graphics_changed) NewGraphics ();
|
|
||||||
wxString s ;
|
|
||||||
|
|
||||||
// we need the radius of the circle which has two estimates
|
|
||||||
double r1 = sqrt ( double( (x1-xc)*(x1-xc) ) + double( (y1-yc)*(y1-yc) ) );
|
|
||||||
double r2 = sqrt ( double( (x2-xc)*(x2-xc) ) + double( (y2-yc)*(y2-yc) ) );
|
|
||||||
|
|
||||||
wxASSERT_MSG( (fabs ( r2-r1 ) <= 3), wxT("wxSVGFileDC::DoDrawArc Error in getting radii of circle")) ;
|
|
||||||
if ( fabs ( r2-r1 ) > 3 ) //pixels
|
|
||||||
{
|
|
||||||
s = wxT("<!--- wxSVGFileDC::DoDrawArc Error in getting radii of circle --> \n") ;
|
|
||||||
write(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
double theta1 = atan2((double)(yc-y1),(double)(x1-xc));
|
|
||||||
if ( theta1 < 0 ) theta1 = theta1 + M_PI * 2;
|
|
||||||
double theta2 = atan2((double)(yc-y2), (double)(x2-xc));
|
|
||||||
if ( theta2 < 0 ) theta2 = theta2 + M_PI * 2;
|
|
||||||
if ( theta2 < theta1 ) theta2 = theta2 + M_PI *2 ;
|
|
||||||
|
|
||||||
int fArc ; // flag for large or small arc 0 means less than 180 degrees
|
|
||||||
if ( fabs(theta2 - theta1) > M_PI ) fArc = 1; else fArc = 0 ;
|
|
||||||
|
|
||||||
int fSweep = 0 ; // flag for sweep always 0
|
|
||||||
|
|
||||||
s.Printf ( wxT("<path d=\"M%d %d A%.2g %.2g 0.0 %d %d %d %d L%d %d z "),
|
|
||||||
x1,y1, r1, r2, fArc, fSweep, x2, y2, xc, yc );
|
|
||||||
|
|
||||||
// the z means close the path and fill
|
|
||||||
s = s + wxT(" \" /> ") + newline ;
|
|
||||||
|
|
||||||
|
|
||||||
if (m_OK)
|
|
||||||
{
|
|
||||||
write(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawArc Call executed")) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Draws an arc of an ellipse. The current pen is used for drawing the arc
|
|
||||||
and the current brush is used for drawing the pie. This function is
|
|
||||||
currently only available for X window and PostScript device contexts.
|
|
||||||
|
|
||||||
x and y specify the x and y coordinates of the upper-left corner of the
|
|
||||||
rectangle that contains the ellipse.
|
|
||||||
|
|
||||||
width and height specify the width and height of the rectangle that
|
|
||||||
contains the ellipse.
|
|
||||||
|
|
||||||
start and end specify the start and end of the arc relative to the
|
|
||||||
three-o'clock position from the center of the rectangle. Angles are
|
|
||||||
specified in degrees (360 is a complete circle). Positive values mean
|
|
||||||
counter-clockwise motion. If start is equal to end, a complete ellipse
|
|
||||||
will be drawn. */
|
|
||||||
|
|
||||||
//known bug: SVG draws with the current pen along the radii, but this does not happen in wxMSW
|
|
||||||
|
|
||||||
if (m_graphics_changed) NewGraphics ();
|
|
||||||
|
|
||||||
wxString s ;
|
|
||||||
//radius
|
|
||||||
double rx = w / 2 ;
|
|
||||||
double ry = h / 2 ;
|
|
||||||
// center
|
|
||||||
double xc = x + rx ;
|
|
||||||
double yc = y + ry ;
|
|
||||||
|
|
||||||
double xs, ys, xe, ye ;
|
|
||||||
xs = xc + rx * cos (DegToRad(sa)) ;
|
|
||||||
xe = xc + rx * cos (DegToRad(ea)) ;
|
|
||||||
ys = yc - ry * sin (DegToRad(sa)) ;
|
|
||||||
ye = yc - ry * sin (DegToRad(ea)) ;
|
|
||||||
|
|
||||||
///now same as circle arc...
|
|
||||||
|
|
||||||
double theta1 = atan2(ys-yc, xs-xc);
|
|
||||||
double theta2 = atan2(ye-yc, xe-xc);
|
|
||||||
|
|
||||||
int fArc ; // flag for large or small arc 0 means less than 180 degrees
|
|
||||||
if ( (theta2 - theta1) > 0 ) fArc = 1; else fArc = 0 ;
|
|
||||||
|
|
||||||
int fSweep ;
|
|
||||||
if ( fabs(theta2 - theta1) > M_PI) fSweep = 1; else fSweep = 0 ;
|
|
||||||
|
|
||||||
s.Printf ( wxT("<path d=\"M%d %d A%d %d 0.0 %d %d %d %d L %d %d z "),
|
|
||||||
int(xs), int(ys), int(rx), int(ry),
|
|
||||||
fArc, fSweep, int(xe), int(ye), int(xc), int(yc) );
|
|
||||||
|
|
||||||
|
|
||||||
s = s + wxT(" \" /> ") + newline ;
|
|
||||||
|
|
||||||
if (m_OK)
|
|
||||||
{
|
|
||||||
write(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawEllipticArc Call executed")) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, wxCoord *descent , wxCoord *externalLeading , wxFont *font) const
|
|
||||||
|
|
||||||
{
|
|
||||||
wxScreenDC sDC ;
|
|
||||||
|
|
||||||
sDC.SetFont (m_font);
|
|
||||||
if ( font != NULL ) sDC.SetFont ( *font );
|
|
||||||
sDC.GetTextExtent(string, w, h, descent, externalLeading );
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::GetTextExtent Call executed")) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxCoord wxSVGFileDC::GetCharHeight() const
|
|
||||||
|
|
||||||
{
|
|
||||||
wxScreenDC sDC ;
|
|
||||||
sDC.SetFont (m_font);
|
|
||||||
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::GetCharHeight Call executing")) ;
|
|
||||||
return ( sDC.GetCharHeight() );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxCoord wxSVGFileDC::GetCharWidth() const
|
|
||||||
{
|
|
||||||
wxScreenDC sDC ;
|
|
||||||
sDC.SetFont (m_font);
|
|
||||||
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::GetCharWidth Call executing")) ;
|
|
||||||
return ( sDC.GetCharWidth() ) ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Set Functions /////////////////////////////////////////////////////////////////
|
|
||||||
void wxSVGFileDC::SetBackground( const wxBrush &brush )
|
|
||||||
{
|
|
||||||
|
|
||||||
m_backgroundBrush = brush;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::SetBackgroundMode( int mode )
|
|
||||||
{
|
|
||||||
m_backgroundMode = mode;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::SetBrush(const wxBrush& brush)
|
|
||||||
|
|
||||||
{
|
|
||||||
m_brush = brush ;
|
|
||||||
|
|
||||||
m_graphics_changed = TRUE ;
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::SetBrush Call executed")) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::SetPen(const wxPen& pen)
|
|
||||||
{
|
|
||||||
// width, color, ends, joins : currently implemented
|
|
||||||
// dashes, stipple : not implemented
|
|
||||||
m_pen = pen ;
|
|
||||||
|
|
||||||
m_graphics_changed = TRUE ;
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::SetPen Call executed")) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSVGFileDC::NewGraphics ()
|
|
||||||
{
|
|
||||||
|
|
||||||
int w = m_pen.GetWidth ();
|
|
||||||
wxColour c = m_pen.GetColour () ;
|
|
||||||
|
|
||||||
wxString s, sBrush, sPenCap, sPenJoin, sPenStyle, sLast, sWarn;
|
|
||||||
|
|
||||||
sBrush = wxT("</g>\n<g style=\"") + wxBrushString ( m_brush.GetColour (), m_brush.GetStyle () )
|
|
||||||
+ wxT(" stroke:#") + wxColStr (c) + wxT("; ") ;
|
|
||||||
|
|
||||||
switch ( m_pen.GetCap () )
|
|
||||||
{
|
|
||||||
case wxCAP_PROJECTING :
|
|
||||||
sPenCap = wxT("stroke-linecap:square; ") ;
|
|
||||||
break ;
|
|
||||||
case wxCAP_BUTT :
|
|
||||||
sPenCap = wxT("stroke-linecap:butt; ") ;
|
|
||||||
break ;
|
|
||||||
case wxCAP_ROUND :
|
|
||||||
default :
|
|
||||||
sPenCap = wxT("stroke-linecap:round; ") ;
|
|
||||||
};
|
|
||||||
switch ( m_pen.GetJoin () )
|
|
||||||
{
|
|
||||||
case wxJOIN_BEVEL :
|
|
||||||
sPenJoin = wxT("stroke-linejoin:bevel; ") ;
|
|
||||||
break ;
|
|
||||||
case wxJOIN_MITER :
|
|
||||||
sPenJoin = wxT("stroke-linejoin:miter; ") ;
|
|
||||||
break ;
|
|
||||||
case wxJOIN_ROUND :
|
|
||||||
default :
|
|
||||||
sPenJoin = wxT("stroke-linejoin:round; ") ;
|
|
||||||
};
|
|
||||||
|
|
||||||
switch ( m_pen.GetStyle () )
|
|
||||||
{
|
|
||||||
case wxSOLID :
|
|
||||||
sPenStyle = wxT("stroke-opacity:1.0; stroke-opacity:1.0; ") ;
|
|
||||||
break ;
|
|
||||||
case wxTRANSPARENT :
|
|
||||||
sPenStyle = wxT("stroke-opacity:0.0; stroke-opacity:0.0; ") ;
|
|
||||||
break ;
|
|
||||||
default :
|
|
||||||
wxASSERT_MSG(FALSE, wxT("wxSVGFileDC::SetPen Call called to set a Style which is not available")) ;
|
|
||||||
sWarn = sWarn + wxT("<!--- wxSVGFileDC::SetPen Call called to set a Style which is not available --> \n") ;
|
|
||||||
}
|
|
||||||
|
|
||||||
sLast.Printf ( wxT("stroke-width:%d\" \n transform=\"translate(%.2g %.2g) scale(%.2g %.2g)\">"),
|
|
||||||
w, m_OriginX, m_OriginY, m_scaleX, m_scaleY );
|
|
||||||
|
|
||||||
s = sBrush + sPenCap + sPenJoin + sPenStyle + sLast + newline + sWarn;
|
|
||||||
write(s);
|
|
||||||
m_graphics_changed = FALSE ;
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::NewGraphics Call executed")) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::SetFont(const wxFont& font)
|
|
||||||
|
|
||||||
{
|
|
||||||
m_font = font ;
|
|
||||||
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::SetFont Call executed")) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::ComputeScaleAndOrigin()
|
|
||||||
{
|
|
||||||
m_scaleX = m_logicalScaleX * m_userScaleX;
|
|
||||||
m_scaleY = m_logicalScaleY * m_userScaleY;
|
|
||||||
m_OriginX = m_logicalOriginX * m_logicalScaleX + m_deviceOriginX ;
|
|
||||||
m_OriginY = m_logicalOriginY * m_logicalScaleY + m_deviceOriginY ;
|
|
||||||
m_graphics_changed = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int wxSVGFileDC::GetMapMode()
|
|
||||||
{
|
|
||||||
return m_mappingMode ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::SetMapMode( int mode )
|
|
||||||
{
|
|
||||||
switch (mode)
|
|
||||||
{
|
|
||||||
case wxMM_TWIPS:
|
|
||||||
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
|
|
||||||
break;
|
|
||||||
case wxMM_POINTS:
|
|
||||||
SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
|
|
||||||
break;
|
|
||||||
case wxMM_METRIC:
|
|
||||||
SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
|
|
||||||
break;
|
|
||||||
case wxMM_LOMETRIC:
|
|
||||||
SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case wxMM_TEXT:
|
|
||||||
SetLogicalScale( 1.0, 1.0 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m_mappingMode = mode;
|
|
||||||
|
|
||||||
/* we don't do this mega optimisation
|
|
||||||
if (mode != wxMM_TEXT)
|
|
||||||
{
|
|
||||||
m_needComputeScaleX = TRUE;
|
|
||||||
m_needComputeScaleY = TRUE;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::GetUserScale(double *x, double *y) const
|
|
||||||
{
|
|
||||||
*x = m_userScaleX ;
|
|
||||||
*y = m_userScaleY ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::SetUserScale( double x, double y )
|
|
||||||
{
|
|
||||||
// allow negative ? -> no
|
|
||||||
m_userScaleX = x;
|
|
||||||
m_userScaleY = y;
|
|
||||||
ComputeScaleAndOrigin();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::SetLogicalScale( double x, double y )
|
|
||||||
{
|
|
||||||
// allow negative ?
|
|
||||||
m_logicalScaleX = x;
|
|
||||||
m_logicalScaleY = y;
|
|
||||||
ComputeScaleAndOrigin();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::SetLogicalOrigin( wxCoord x, wxCoord y )
|
|
||||||
{
|
|
||||||
// is this still correct ?
|
|
||||||
m_logicalOriginX = x * m_signX;
|
|
||||||
m_logicalOriginY = y * m_signY;
|
|
||||||
ComputeScaleAndOrigin();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::SetDeviceOrigin( wxCoord x, wxCoord y )
|
|
||||||
{
|
|
||||||
// only wxPostScripDC has m_signX = -1,
|
|
||||||
m_deviceOriginX = x;
|
|
||||||
m_deviceOriginY = y;
|
|
||||||
ComputeScaleAndOrigin();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
|
|
||||||
{
|
|
||||||
// only wxPostScripDC has m_signX = -1,
|
|
||||||
m_signX = (xLeftRight ? 1 : -1);
|
|
||||||
m_signY = (yBottomUp ? -1 : 1);
|
|
||||||
ComputeScaleAndOrigin();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// export a bitmap as a raster image in png
|
|
||||||
bool wxSVGFileDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
|
||||||
wxDC* source, wxCoord xsrc, wxCoord ysrc,
|
|
||||||
int logicalFunc /*= wxCOPY*/, bool useMask /*= FALSE*/,
|
|
||||||
wxCoord /*xsrcMask = -1*/, wxCoord /*ysrcMask = -1*/)
|
|
||||||
{
|
|
||||||
if (logicalFunc != wxCOPY)
|
|
||||||
{
|
|
||||||
wxASSERT_MSG(FALSE, wxT("wxSVGFileDC::DoBlit Call requested nonCopy mode; this is not possible")) ;
|
|
||||||
return FALSE ;
|
|
||||||
}
|
|
||||||
if (useMask != FALSE)
|
|
||||||
{
|
|
||||||
wxASSERT_MSG(FALSE, wxT("wxSVGFileDC::DoBlit Call requested False mask ; this is not possible")) ;
|
|
||||||
return FALSE ;
|
|
||||||
}
|
|
||||||
wxBitmap myBitmap (width, height) ;
|
|
||||||
wxMemoryDC memDC;
|
|
||||||
memDC.SelectObject( myBitmap );
|
|
||||||
memDC.Blit(0, 0, width, height, source, xsrc, ysrc);
|
|
||||||
memDC.SelectObject( wxNullBitmap );
|
|
||||||
DoDrawBitmap(myBitmap, xdest, ydest);
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoBlit Call executed")) ;
|
|
||||||
return FALSE ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawIcon(const class wxIcon & myIcon, wxCoord x, wxCoord y)
|
|
||||||
{
|
|
||||||
wxBitmap myBitmap (myIcon.GetWidth(), myIcon.GetHeight() ) ;
|
|
||||||
wxMemoryDC memDC;
|
|
||||||
memDC.SelectObject( myBitmap );
|
|
||||||
memDC.DrawIcon(myIcon,0,0);
|
|
||||||
memDC.SelectObject( wxNullBitmap );
|
|
||||||
DoDrawBitmap(myBitmap, x, y);
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawIcon Call executed")) ;
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wxSVGFileDC::DoDrawBitmap(const class wxBitmap & bmp, wxCoord x, wxCoord y , bool WXUNUSED(bTransparent) /*=0*/ )
|
|
||||||
{
|
|
||||||
if (m_graphics_changed) NewGraphics ();
|
|
||||||
|
|
||||||
wxString sTmp, s, sPNG ;
|
|
||||||
wxImage::AddHandler(new wxPNGHandler);
|
|
||||||
|
|
||||||
// create suitable file name
|
|
||||||
sTmp.Printf ( wxT("_image%d.png"), m_sub_images);
|
|
||||||
sPNG = m_filename.BeforeLast(wxT('.')) + sTmp;
|
|
||||||
while (wxFile::Exists(sPNG) )
|
|
||||||
{
|
|
||||||
m_sub_images ++ ;
|
|
||||||
sTmp.Printf ( wxT("_image%d.png"), m_sub_images);
|
|
||||||
sPNG = m_filename.BeforeLast(wxT('.')) + sTmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
//create copy of bitmap (wxGTK doesn't like saving a constant bitmap)
|
|
||||||
wxBitmap myBitmap = bmp ;
|
|
||||||
//save it
|
|
||||||
bool bPNG_OK = myBitmap.SaveFile(sPNG,wxBITMAP_TYPE_PNG);
|
|
||||||
|
|
||||||
// refrence the bitmap from the SVG doc
|
|
||||||
int w = myBitmap.GetWidth();
|
|
||||||
int h = myBitmap.GetHeight();
|
|
||||||
sTmp.Printf ( wxT(" <image x=\"%d\" y=\"%d\" width=\"%dpx\" height=\"%dpx\" "), x,y,w,h );
|
|
||||||
s = s + sTmp ;
|
|
||||||
sTmp.Printf ( wxT(" xlink:href=\"%s\"> \n"), sPNG.c_str() );
|
|
||||||
s = s + sTmp + wxT("<title>Image from wxSVG</title> </image>") + newline;
|
|
||||||
|
|
||||||
if (m_OK && bPNG_OK)
|
|
||||||
{
|
|
||||||
write(s);
|
|
||||||
}
|
|
||||||
m_OK = m_outfile->Ok () && bPNG_OK;
|
|
||||||
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DoDrawBitmap Call executed")) ;
|
|
||||||
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// coordinates transformations
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
wxCoord wxSVGFileDC::DeviceToLogicalX(wxCoord x) const
|
|
||||||
{
|
|
||||||
return XDEV2LOG(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxCoord wxSVGFileDC::DeviceToLogicalY(wxCoord y) const
|
|
||||||
{
|
|
||||||
return YDEV2LOG(y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxCoord wxSVGFileDC::DeviceToLogicalXRel(wxCoord x) const
|
|
||||||
{
|
|
||||||
return XDEV2LOGREL(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxCoord wxSVGFileDC::DeviceToLogicalYRel(wxCoord y) const
|
|
||||||
{
|
|
||||||
return YDEV2LOGREL(y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxCoord wxSVGFileDC::LogicalToDeviceX(wxCoord x) const
|
|
||||||
{
|
|
||||||
return XLOG2DEV(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxCoord wxSVGFileDC::LogicalToDeviceY(wxCoord y) const
|
|
||||||
{
|
|
||||||
return YLOG2DEV(y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxCoord wxSVGFileDC::LogicalToDeviceXRel(wxCoord x) const
|
|
||||||
{
|
|
||||||
return XLOG2DEVREL(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxCoord wxSVGFileDC::LogicalToDeviceYRel(wxCoord y) const
|
|
||||||
{
|
|
||||||
return YLOG2DEVREL(y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSVGFileDC::write(const wxString &s)
|
|
||||||
{
|
|
||||||
const wxWX2MBbuf buf = s.mb_str(wxConvUTF8);
|
|
||||||
m_outfile->Write(buf, strlen((const char *)buf));
|
|
||||||
m_OK = m_outfile->Ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma warn .rch
|
|
||||||
#pragma warn .ccc
|
|
||||||
#endif
|
|
Reference in New Issue
Block a user