|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mortennobel.imagescaling.DimensionConstrain
public class DimensionConstrain
This class let you create dimension constrains based on a actual image. Class may be subclassed to create user defined behavior. To do this you need to overwrite the method getDimension(Dimension).
Constructor Summary | |
---|---|
protected |
DimensionConstrain()
|
Method Summary | |
---|---|
static DimensionConstrain |
createAbsolutionDimension(int width,
int height)
Used when the destination size is fixed. |
static DimensionConstrain |
createMaxDimension(int width,
int height)
Forces the image to keep radio and be keeped within the width and height |
static DimensionConstrain |
createMaxDimension(int width,
int height,
boolean neverEnlargeImage)
Forces the image to keep radio and be keeped within the width and height. |
static DimensionConstrain |
createMaxDimensionNoOrientation(int length1,
int length2)
Forces the image to keep radio and be keeped within the width and height. |
static DimensionConstrain |
createMaxDimensionNoOrientation(int length1,
int length2,
boolean neverEnlargeImage)
Forces the image to keep radio and be keeped within the width and height. |
static DimensionConstrain |
createRelativeDimension(float fraction)
Used when the destination size is relative to the source. |
static DimensionConstrain |
createRelativeDimension(float fractionWidth,
float fractionHeight)
Used when the destination size is relative to the source. |
java.awt.Dimension |
getDimension(java.awt.Dimension dimension)
Will always return a dimension with positive width and height; |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DimensionConstrain()
Method Detail |
---|
public java.awt.Dimension getDimension(java.awt.Dimension dimension)
dimension
- of the unscaled image
public static DimensionConstrain createAbsolutionDimension(int width, int height)
width
- destination dimension widthheight
- destination dimension height
public static DimensionConstrain createRelativeDimension(float fraction)
fraction
- resize fraction (must be a positive number)
public static DimensionConstrain createRelativeDimension(float fractionWidth, float fractionHeight)
-
public static DimensionConstrain createMaxDimension(int width, int height)
width
- height
-
public static DimensionConstrain createMaxDimension(int width, int height, boolean neverEnlargeImage)
width
- height
- neverEnlargeImage
- if true only a downscale will occour
public static DimensionConstrain createMaxDimensionNoOrientation(int length1, int length2)
length1
- length2
-
public static DimensionConstrain createMaxDimensionNoOrientation(int length1, int length2, boolean neverEnlargeImage)
length1
- length2
- neverEnlargeImage
- if true only a downscale will occour
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |