public interface SvgOps
Auxiliary SVG operations.
When
OutputStreamGraphics
is used to generate
SVG, a provider will typically use the width and height passed to
the OutputStreamGraphics
's constructor the
svg element's width, height, and viewBox attributes, with the
viewBox typically set to "0 0 W H" where W is the width and
H is the height. The width and height attributes should normally
use units of points (pt). For scaling the image, other units
and other values may be appropriate.
Implementing this interface is optional for an SVG provider but is encouraged.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
setDimensions
(double width, String widthUnit, double height, String heightUnit) Set the SVG height and width attributes.
-
Method Details
-
setDimensions
void setDimensions(double width, String widthUnit, double height, String heightUnit) throws IllegalStateException Set the SVG height and width attributes. This option should not override the viewBox. The units must be standard SVG units (px, pt, mm, etc.).This method should be called before the output is written, which occurs when
OutputStreamGraphics.imageComplete()
is called.- Parameters:
width
- the widthwidthUnit
- the units for the widthheight
- the heightheightUnit
- the units for the height- Throws:
IllegalStateException
- this method was called at the wrong time.
-