java.lang.Object | |
↳ | com.caverock.androidsvg.PreserveAspectRatio |
The SVGPositioning class tells the renderer how to scale and position the
SVG document in the current viewport. It is roughly equivalent to the
preserveAspectRatio
attribute of an <svg>
element.
In order for scaling to happen, the SVG document must have a viewBox attribute set. For example:
<svg version="1.1" viewBox="0 0 200 100">
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
enum | PreserveAspectRatio.Alignment | Determines how the document is to me positioned relative to the viewport (normally the canvas). | |||||||||
enum | PreserveAspectRatio.Scale | Determine whether the scaled document fills the viewport entirely or is scaled to fill the viewport without overflowing. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static final PreserveAspectRatio | BOTTOM | Keep the document's aspect ratio, but scale it so that it fits neatly inside the viewport. | |||||||||
public static final PreserveAspectRatio | END | Keep the document's aspect ratio, but scale it so that it fits neatly inside the viewport. | |||||||||
public static final PreserveAspectRatio | FULLSCREEN | Keep the document's aspect ratio, but scale it so that it fills the entire viewport. | |||||||||
public static final PreserveAspectRatio | FULLSCREEN_START | Keep the document's aspect ratio, but scale it so that it fills the entire viewport. | |||||||||
public static final PreserveAspectRatio | LETTERBOX | Keep the document's aspect ratio, but scale it so that it fits neatly inside the viewport. | |||||||||
public static final PreserveAspectRatio | START | Keep the document's aspect ratio, but scale it so that it fits neatly inside the viewport. | |||||||||
public static final PreserveAspectRatio | STRETCH | Stretch horizontally and vertically to fill the viewport. | |||||||||
public static final PreserveAspectRatio | TOP | Keep the document's aspect ratio, but scale it so that it fits neatly inside the viewport. | |||||||||
public static final PreserveAspectRatio | UNSCALED | Draw doucment at its natural position and scale. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PreserveAspectRatio(PreserveAspectRatio.Alignment alignment, PreserveAspectRatio.Scale scale) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean | equals(Object obj) | ||||||||||
PreserveAspectRatio.Alignment |
getAlignment()
Returns the alignment value of this instance.
| ||||||||||
PreserveAspectRatio.Scale |
getScale()
Returns the scale value of this instance.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Keep the document's aspect ratio, but scale it so that it fits neatly inside the viewport.
The document will be positioned at the bottom of tall and narrow viewports, and at the centre of short and wide viewports.
Keep the document's aspect ratio, but scale it so that it fits neatly inside the viewport.
The document will be positioned at the bottom of tall and narrow viewports, and at the right of short and wide viewports.
Keep the document's aspect ratio, but scale it so that it fills the entire viewport. This may result in some of the document falling outside the viewport.
The document will be positioned so that the centre of the document will always be visible, but the edges of the document may not.
Keep the document's aspect ratio, but scale it so that it fills the entire viewport. This may result in some of the document falling outside the viewport.
The document will be positioned so that the top left of the document will always be visible, but the right hand or bottom edge may not.
Keep the document's aspect ratio, but scale it so that it fits neatly inside the viewport.
The document will be centred in the viewport and may have blank strips at either the top and bottom of the viewport or at the sides.
Keep the document's aspect ratio, but scale it so that it fits neatly inside the viewport.
The document will be positioned at the top of tall and narrow viewports, and at the left of short and wide viewports.
Stretch horizontally and vertically to fill the viewport.
Keep the document's aspect ratio, but scale it so that it fits neatly inside the viewport.
The document will be positioned at the top of tall and narrow viewports, and at the centre of short and wide viewports.
Returns the alignment value of this instance.
Returns the scale value of this instance.