|
java-gnome version 4.1.1 | ||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.freedesktop.bindings.Pointer
org.freedesktop.bindings.Proxy
org.gnome.glib.Object
org.gnome.rsvg.Handle
public class Handle
Handle to an SVG image in memory. This class allows you to load an SVG image from a file on disk or from memory.
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 Summary | |
---|---|
Handle()
|
|
Handle(String filename)
Construct a handle to an SVG image sourced from the given filename. |
Method Summary | |
---|---|
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. |
Methods inherited from class org.freedesktop.bindings.Pointer |
---|
toString |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Handle()
public Handle(String filename) throws FileNotFoundException
FileNotFoundException
Method Detail |
---|
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
|
![]() java-gnome |
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |