Package ca.cgjennings.apps.arkham.sheet
Class PrintDimensions
- java.lang.Object
-
- ca.cgjennings.apps.arkham.sheet.PrintDimensions
-
public final class PrintDimensions extends java.lang.ObjectAn 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 booleanequals(PrintDimensions other)Returnstrueifotherrepresents the same printed size as this.booleanequals(java.lang.Object obj)Returnstrueifobjis a print dimensions instance that represents the same printed size as this instance.doublegetHeight()Returns the height of the printed item, in points.doublegetHeightInUnit(int unit)Returns the height of the printed item, in a specific unit.doublegetWidth()Returns the width of the printed item, in points.doublegetWidthInUnit(int unit)Returns the width of the printed item, in a specific unit.inthashCode()java.lang.StringtoString()
-
-
-
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- ifimageisnull
-
-
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 theLengthunit 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 theLengthunit constants- Returns:
- the print height, in the requested unit
-
equals
public boolean equals(java.lang.Object obj)
Returnstrueifobjis a print dimensions instance that represents the same printed size as this instance.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to compare this to- Returns:
trueif 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)
Returnstrueifotherrepresents the same printed size as this.- Parameters:
other- the object to compare this to- Returns:
trueif 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:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-