public class

PreserveAspectRatio

extends Object
java.lang.Object
   ↳ com.caverock.androidsvg.PreserveAspectRatio

Class Overview

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">
 
 

Summary

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

Fields

public static final PreserveAspectRatio BOTTOM

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.

public static final PreserveAspectRatio END

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.

public static final PreserveAspectRatio FULLSCREEN

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.

public static final PreserveAspectRatio FULLSCREEN_START

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.

public static final PreserveAspectRatio LETTERBOX

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.

public static final PreserveAspectRatio START

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.

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.

The document will be positioned at the top of tall and narrow viewports, and at the centre of short and wide viewports.

public static final PreserveAspectRatio UNSCALED

Draw doucment at its natural position and scale.

Public Constructors

public PreserveAspectRatio (PreserveAspectRatio.Alignment alignment, PreserveAspectRatio.Scale scale)

Public Methods

public boolean equals (Object obj)

public PreserveAspectRatio.Alignment getAlignment ()

Returns the alignment value of this instance.

Returns
  • the alignment

public PreserveAspectRatio.Scale getScale ()

Returns the scale value of this instance.

Returns
  • the scale