- All Implemented Interfaces:
Serializable
,Comparable<ImageTransform>
,Constable
Each transformation type has a unique integer ID which can be used for efficient storage in a
file or database. The IDs are small non-negative integers (0-7) that can be safely cast to byte
if needed. See getID()
and valueOf(int id)
.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionNo rotationHorizontal flip (no rotation)180 degrees rotation180 degrees rotation with horizontal flip270 degrees clockwise rotation270 degrees clockwise rotation with horizontal flip90 degrees clockwise rotation90 degrees clockwise rotation with horizontal flip -
Method Summary
Modifier and TypeMethodDescriptionint
getID()
Returns the integer ID associated with this image transform.boolean
hasFlip()
Checks whether this transformation type includes a horizontal flip (mirroring).boolean
isFlat()
Checks whether this transformation type represents a flat rotation (0° or 180°).static ImageTransform
valueOf
(int id) Returns the enum constant of this class associated with the specified integer ID.static ImageTransform
Returns the enum constant of this class with the specified name.static ImageTransform[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ROTATE_0
No rotation -
ROTATE_90
90 degrees clockwise rotation -
ROTATE_180
180 degrees rotation -
ROTATE_270
270 degrees clockwise rotation -
ROTATE_0_FLIP
Horizontal flip (no rotation) -
ROTATE_90_FLIP
90 degrees clockwise rotation with horizontal flip -
ROTATE_180_FLIP
180 degrees rotation with horizontal flip -
ROTATE_270_FLIP
270 degrees clockwise rotation with horizontal flip
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
valueOf
Returns the enum constant of this class associated with the specified integer ID.- Parameters:
id
- the ID of the enum constant to be returned- Returns:
- the enum constant associated with the specified ID
- Throws:
IllegalArgumentException
- if this enum class has no constant associated with the specified ID
-
getID
public int getID()Returns the integer ID associated with this image transform.- Returns:
- the integer ID associated with this image transform
- See Also:
-
isFlat
public boolean isFlat()Checks whether this transformation type represents a flat rotation (0° or 180°).This is a convenience method that can be used to determine whether the horizontal or vertical resolution of the output medium is relevant in a particular case.
For 1D barcodes, which mainly consist of vertical bars, only one of the two resolutions is relevant. For example, when creating a 1D barcode at a 90° or 270° angle, the vertical resolution is crucial as the bar widths must be adjusted to it. Similarly, at a 0° or 180° angle, the horizontal resolution is important.
(However, for 2D codes, if the output medium has differing horizontal and vertical resolutions, regardless of the transformation used, always use the smaller resolution. For example, in a setting of 300x600 DPI, use 300 DPI as the relevant resolution.)
- Returns:
true
if this transformation type represents a 0° or 180° rotation (ROTATE_0, ROTATE_180, ROTATE_0_FLIP, or ROTATE_180_FLIP),false
otherwise (90° or 270° rotations)
-
hasFlip
public boolean hasFlip()Checks whether this transformation type includes a horizontal flip (mirroring).- Returns:
true
if this transformation includes a flip (ROTATE_0_FLIP, ROTATE_90_FLIP, ROTATE_180_FLIP, or ROTATE_270_FLIP),false
otherwise
-