public class Handle extends Object
Once you have the Handle you can render it to Cairo directly with Context's
showHandle()
,
Rsvg.init(); ... graphic = new Handle("Tiger.svg"); cr.showHandle(graphic);
Constructor and Description |
---|
Handle() |
Handle(String filename)
Construct a handle to an SVG image sourced from the given filename.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Indicate you have finished loading data into the Handle.
|
DimensionData |
getDimensions()
Get the size of the SVG image represented by this Handle.
|
DimensionData |
getDimensionsSub(String id)
Get the size of a named sub-element of the SVG image represented by
this Handle.
|
double |
getDPIX()
Get the horizontal resolution of this graphic.
|
double |
getDPIY()
Get the vertical resolution of this graphic.
|
void |
write(byte[] data)
Write data into this Handle.
|
public Handle()
public Handle(String filename) throws FileNotFoundException
FileNotFoundException
public void close() throws IOException
This method is the compliment of the write()
method, and should be called when you have passed in all the data for
the image you are loading.
IOException
public DimensionData getDimensions()
public DimensionData getDimensionsSub(String id)
You can pass null
to get the size of the entire graphic.
public double getDPIX()
Resolution and SVG is a bit of a weird topic. The default unts in an
SVG file are "pixels", px
as defined in the CSS
specification, and the default resolution turns out to be 90 pixels per
inch. So unless the program writing the graphic you are loading has
gone to extraordinary lengths, the value of this property will be
90.0
regardless of the user space units in use inside
the graphic.
Under ordinary circumstances it will be the same as the vertical resolution so you probably don't have to query both.
public double getDPIY()
getDPIX()
for details.public void write(byte[] data) throws IOException
IOException
- if there is a problem loading the data