com.aspose.barcode.generation

Class Unit

  • java.lang.Object
    • com.aspose.barcode.generation.Unit


  • 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 Summary

      Constructors 
      Constructor and Description
      Unit(float value, GraphicsUnit graphicsUnit)
      Initializes a new instance of the Unit class.
      Unit(Unit source) 
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      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) 
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Unit

        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.

        Parameters:
        value - Size value the new Unit in the units specified by the graphicsUnit parameter.
        graphicsUnit - The GraphicsUnit of the new Unit object.
      • Unit

        public Unit(Unit source)
    • Method Detail

      • getPixels

        public float getPixels()

        Gets size value in pixels.

      • setPixels

        public void setPixels(float value)

        Sets size value in pixels.

      • getPx

        @Deprecated
        public int getPx()
        Deprecated. 
      • getInches

        public float getInches()

        Gets size value in inches.

      • setInches

        public void setInches(float value)

        Sets size value in inches.

      • getMillimeters

        public float getMillimeters()

        Gets size value in millimeters.

      • setMillimeters

        public void setMillimeters(float value)

        Sets size value in millimeters.

      • getPoint

        public float getPoint()

        Gets size value in point.

      • setPoint

        public void setPoint(float value)

        Sets size value in point.

      • getDocument

        public float getDocument()

        Gets size value in document units.

      • setDocument

        public void setDocument(float value)

        Sets size value in document units.

      • toString

        public java.lang.String toString()

        Returns a human-readable string representation of this Unit.

        Overrides:
        toString in class java.lang.Object
        Returns:
        A string that represents this Unit.
      • equals

        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.

        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The Unit to compare to this instance.
        Returns:
        true if obj is a Unit and its value is the same as this instance; otherwise, false. If obj is null, the method returns false.
      • hashCode

        public int hashCode()

        Returns the hash code for this object.

        Overrides:
        hashCode in class java.lang.Object
        Returns:
        A 32-bit signed integer hash code.
      • getResolution

        public float getResolution()
      • updateResolution

        public void updateResolution(float dpi)