Help Center

Local Navigation

Preserving the aspect ratio of an object

Aspect ratio refers to the ratio between the height and the width of a rectangular object.

You can preserve the aspect ratio of the view box so that it is not stretched when it is displayed in a view port that has a different aspect ratio. By default, the aspect ratio of the view box is not preserved; content is stretched so that it fits view port.

The Preserve Aspect Ratio property is a combination of the following:

  • scaling, which defines how the BlackBerry® device scales the view box in the view port. You can choose one of the following options:
    • Meet: The BlackBerry device scales the view box so that there is no loss of content, and adds transparent padding around the content.
    • Slice: The BlackBerry device clips the view box so that the content fills the view port with no padding.
  • alignment, which defines how the BlackBerry device aligns the view box in the view port.
The view box and view port are of equal dimensions View box and view port are of different dimensions
Preserve Aspect Ratio: Ignored

Because the dimensions of the view box and view port are identical, the view box aspect ratio is not altered.

Preserve Aspect Ratio: On

Scaling: Meet

Alignment: Centered

The content in the view box is horizontally and vertically centered and scaled to fit the view port such that no clipping is required.

Preserve Aspect Ratio: On

Scaling: Slice

Alignment: Centered

The content in the view box is horizontally and vertically centered and scaled to fill the view port. The excess content is clipped.

Preserve Aspect Ratio: Off

Aspect ratio is not preserved. The content in the view box is stretched to fit the view port.

Index


Was this information helpful? Send us your comments.