RatioUtil
| Kind of class: | public class |
|---|---|
| Package: | org.casalib.util |
| Inherits from: | none |
| Version: | 08/29/08 |
| Author: | Aaron Clinger |
| Classpath: | org.casalib.util.RatioUtil |
| File last modified: | Monday, 01 December 2008, 11:16:36 |
Provides utility functions for ratio scaling.
Summary
Class methods
- widthToHeight (size:Rectangle) : Number
- Determines the ratio of width to height.
- heightToWidth (size:Rectangle) : Number
- Determines the ratio of height to width.
- scale (size:Rectangle, amount:Percent) : Rectangle
- Scales an area's width and height while preserving aspect ratio.
- scaleWidth (size:Rectangle, height:Number) : Rectangle
- Scales the width of an area while preserving aspect ratio.
- scaleHeight (size:Rectangle, width:Number) : Rectangle
- Scales the height of an area while preserving aspect ratio.
- scaleToFill (size:Rectangle, bounds:Rectangle) : Rectangle
- Resizes an area to fill the bounding area while preserving aspect ratio.
- scaleToFit (size:Rectangle, bounds:Rectangle) : Rectangle
- Resizes an area to the maximum size of a bounding area without exceeding while preserving aspect ratio.
Class methods
heightToWidth
public static function heightToWidth (
size:Rectangle) : Number
Determines the ratio of height to width.
Parameters:
size:
The area's width and height expressed as a
Rectangle. The Rectangle's x and y values are ignored.scale
Scales an area's width and height while preserving aspect ratio.
Parameters:
size :
The area's width and height expressed as a
Rectangle. The Rectangle's x and y values are ignored.amount:
The amount you wish to scale by.
scaleHeight
public static function scaleHeight (
size:Rectangle,
width:Number) : Rectangle
Scales the height of an area while preserving aspect ratio.
Parameters:
size :
The area's width and height expressed as a
Rectangle. The Rectangle's x and y values are ignored.width:
The new width of the area.
scaleToFill
public static function scaleToFill (
size:Rectangle,
bounds:Rectangle) : Rectangle
Resizes an area to fill the bounding area while preserving aspect ratio.
Parameters:
size :
The area's width and height expressed as a
Rectangle. The Rectangle's x and y values are ignored.bounds:
The area to fill. The
Rectangle's x and y values are ignored.scaleToFit
public static function scaleToFit (
size:Rectangle,
bounds:Rectangle) : Rectangle
Resizes an area to the maximum size of a bounding area without exceeding while preserving aspect ratio.
Parameters:
size :
The area's width and height expressed as a
Rectangle. The Rectangle's x and y values are ignored.bounds:
The area the rectangle needs to fit within. The
Rectangle's x and y values are ignored.scaleWidth
public static function scaleWidth (
size:Rectangle,
height:Number) : Rectangle
Scales the width of an area while preserving aspect ratio.
Parameters:
size :
The area's width and height expressed as a
Rectangle. The Rectangle's x and y values are ignored.height:
The new height of the area.
widthToHeight
public static function widthToHeight (
size:Rectangle) : Number
Determines the ratio of width to height.
Parameters:
size:
The area's width and height expressed as a
Rectangle. The Rectangle's x and y values are ignored.