public final class Unit
extends java.lang.Object
Specifies the size value in different units (Pixel, Inches, etc.).
This sample shows how to create and save a BarCode image.BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.CODE_128); generator.getParameters().getBarcode().getBarHeight().setMillimeters(10); generator.save("test.png");
Constructor and Description |
---|
Unit(float value,
GraphicsUnit graphicsUnit)
Initializes a new instance of the
Unit class. |
Unit(Unit source) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Determines whether this instance and a specified object,
which must also be a
Unit object, have the same value. |
float |
getDocument()
Gets size value in document units.
|
float |
getInches()
Gets size value in inches.
|
float |
getMillimeters()
Gets size value in millimeters.
|
float |
getPixels()
Gets size value in pixels.
|
float |
getPoint()
Gets size value in point.
|
int |
getPx()
Deprecated.
|
float |
getResolution() |
int |
hashCode()
Returns the hash code for this object.
|
void |
setDocument(float value)
Sets size value in document units.
|
void |
setInches(float value)
Sets size value in inches.
|
void |
setMillimeters(float value)
Sets size value in millimeters.
|
void |
setPixels(float value)
Sets size value in pixels.
|
void |
setPoint(float value)
Sets size value in point.
|
java.lang.String |
toString()
Returns a human-readable string representation of this
Unit . |
void |
updateResolution(float dpi) |
public Unit(float value, GraphicsUnit graphicsUnit)
Initializes a new instance of the Unit
class.
It's using only in autogenerated code for UserControl, please don't use it.
value
- Size value the new Unit in the units specified by the graphicsUnit parameter.graphicsUnit
- The GraphicsUnit
of the new Unit object.public Unit(Unit source)
public float getPixels()
Gets size value in pixels.
public void setPixels(float value)
Sets size value in pixels.
@Deprecated public int getPx()
public float getInches()
Gets size value in inches.
public void setInches(float value)
Sets size value in inches.
public float getMillimeters()
Gets size value in millimeters.
public void setMillimeters(float value)
Sets size value in millimeters.
public float getPoint()
Gets size value in point.
public void setPoint(float value)
Sets size value in point.
public float getDocument()
Gets size value in document units.
public void setDocument(float value)
Sets size value in document units.
public java.lang.String toString()
Returns a human-readable string representation of this Unit
.
toString
in class java.lang.Object
Unit
.public boolean equals(java.lang.Object obj)
Determines whether this instance and a specified object,
which must also be a Unit
object, have the same value.
equals
in class java.lang.Object
obj
- The Unit
to compare to this instance.Unit
and its value is the same as this instance;
otherwise, false. If obj is null, the method returns false.public int hashCode()
Returns the hash code for this object.
hashCode
in class java.lang.Object
public float getResolution()
public void updateResolution(float dpi)