Package ca.cgjennings.apps.arkham.sheet
Class PrintDimensions
- java.lang.Object
-
- ca.cgjennings.apps.arkham.sheet.PrintDimensions
-
public final class PrintDimensions extends java.lang.Object
An immutable representation of the printed size of a sheet, measured in points.- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description PrintDimensions(double width, double height)
Creates a new print dimensions instance with the specified width and height (in points).PrintDimensions(java.awt.image.BufferedImage image, double pixelsPerInch, double finalBleedMargin, double includedBleedMargin)
Creates a new print dimensions instance based on a source image (typically, a rendering of aSheet
).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(PrintDimensions other)
Returnstrue
ifother
represents the same printed size as this.boolean
equals(java.lang.Object obj)
Returnstrue
ifobj
is a print dimensions instance that represents the same printed size as this instance.double
getHeight()
Returns the height of the printed item, in points.double
getHeightInUnit(int unit)
Returns the height of the printed item, in a specific unit.double
getWidth()
Returns the width of the printed item, in points.double
getWidthInUnit(int unit)
Returns the width of the printed item, in a specific unit.int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
PrintDimensions
public PrintDimensions(double width, double height)
Creates a new print dimensions instance with the specified width and height (in points).- Parameters:
width
- the print width, in points; must be non-negativeheight
- the print height, in points; must be non-negative
-
PrintDimensions
public PrintDimensions(java.awt.image.BufferedImage image, double pixelsPerInch, double finalBleedMargin, double includedBleedMargin)
Creates a new print dimensions instance based on a source image (typically, a rendering of aSheet
).- Parameters:
image
- the image whose pixel width and height will be usedpixelsPerInch
- the image resolution, in pixels per inchfinalBleedMargin
- the size of the final desired bleed margin, measured in pointsincludedBleedMargin
- the size of any bleed margin already included in the image, measured in points- Throws:
java.lang.NullPointerException
- ifimage
isnull
-
-
Method Detail
-
getWidth
public double getWidth()
Returns the width of the printed item, in points.- Returns:
- the print width
-
getHeight
public double getHeight()
Returns the height of the printed item, in points.- Returns:
- the print height
-
getWidthInUnit
public double getWidthInUnit(int unit)
Returns the width of the printed item, in a specific unit.- Parameters:
unit
- one of theLength
unit constants- Returns:
- the print width, in the requested unit
-
getHeightInUnit
public double getHeightInUnit(int unit)
Returns the height of the printed item, in a specific unit.- Parameters:
unit
- one of theLength
unit constants- Returns:
- the print height, in the requested unit
-
equals
public boolean equals(java.lang.Object obj)
Returnstrue
ifobj
is a print dimensions instance that represents the same printed size as this instance.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the object to compare this to- Returns:
true
if and only if they are print dimensions of the same size, within one one hundred thousandth of a point in any dimension
-
equals
public boolean equals(PrintDimensions other)
Returnstrue
ifother
represents the same printed size as this.- Parameters:
other
- the object to compare this to- Returns:
true
if and only if they are print dimensions of the same size, within one one hundred thousandth of a point in any dimension
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-