Package 

Class Pix


  • 
    public class Pix
    
                        

    Java representation of a native Leptonica PIX object.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public final class Pix.ImageFileFormat

      Image file format.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static int INDEX_W
      public final static int INDEX_H
      public final static int INDEX_D
    • Constructor Summary

      Constructors 
      Constructor Description
      Pix(long nativePix) Creates a new Pix wrapper for the specified native PIX object.
      Pix(int width, int height, int depth)
    • Method Summary

      Modifier and Type Method Description
      long getNativePix() Returns a pointer to the native Pix object.
      Array<byte> getData() Return the raw bytes of the native PIX object.
      Array<int> getDimensions() Returns an array of this image's dimensions.
      boolean getDimensions(@Size(min = 3) Array<int> dimensions) Fills an array with this image's dimensions.
      Pix clone() Returns a clone of this Pix.
      Pix copy() Returns a deep copy of this Pix that can be modified without affectingthe original Pix.
      boolean invert() Inverts this Pix in-place.
      void recycle() Releases resources and frees any memory associated with this Pix.
      static Pix createFromPix(Array<byte> pixData, int width, int height, int depth) Creates a new Pix from raw Pix data obtained from getData().
      Rect getRect() Returns a Rect with the width and height of this Pix.
      int getWidth() Returns the width of this Pix.
      int getHeight() Returns the height of this Pix.
      int getDepth() Returns the depth of this Pix.
      int getSpp() Returns the spp of this Pix.
      int getImageFormat() Returns the imageFormat of this Pix.
      int getPixel(int x, int y) Returns the android.graphics.Color at the specified location.
      void setPixel(int x, int y, @ColorInt() int color) Sets the android.graphics.Color at the specified location.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Pix

        Pix(long nativePix)
        Creates a new Pix wrapper for the specified native PIX object.
        Parameters:
        nativePix - A pointer to the native PIX object.
      • Pix

        Pix(int width, int height, int depth)
    • Method Detail

      • getNativePix

         long getNativePix()

        Returns a pointer to the native Pix object. This is used by native codeand is only valid within the same process in which the Pix was created.

      • getData

         Array<byte> getData()

        Return the raw bytes of the native PIX object. You can reconstruct thePix from this data using createFromPix().

      • getDimensions

         Array<int> getDimensions()

        Returns an array of this image's dimensions. See Pix.INDEX_* for indices.

      • getDimensions

         boolean getDimensions(@Size(min = 3) Array<int> dimensions)

        Fills an array with this image's dimensions. The array must be at least 3elements long.

        Parameters:
        dimensions - An integer array with at least three elements.
      • clone

         Pix clone()

        Returns a clone of this Pix. This does NOT create a separate copy, just anew pointer that can be recycled without affecting other clones.

      • copy

         Pix copy()

        Returns a deep copy of this Pix that can be modified without affectingthe original Pix.

      • invert

         boolean invert()

        Inverts this Pix in-place.

      • recycle

         void recycle()

        Releases resources and frees any memory associated with this Pix. You maynot modify or access the pix after calling this method.

      • createFromPix

         static Pix createFromPix(Array<byte> pixData, int width, int height, int depth)

        Creates a new Pix from raw Pix data obtained from getData().

        Parameters:
        pixData - Raw pix data obtained from getData().
        width - The width of the original Pix.
        height - The height of the original Pix.
        depth - The bit-depth of the original Pix.
      • getRect

         Rect getRect()

        Returns a Rect with the width and height of this Pix.

      • getWidth

         int getWidth()

        Returns the width of this Pix.

      • getHeight

         int getHeight()

        Returns the height of this Pix.

      • getDepth

         int getDepth()

        Returns the depth of this Pix.

      • getSpp

         int getSpp()

        Returns the spp of this Pix.

      • getImageFormat

         int getImageFormat()

        Returns the imageFormat of this Pix.

      • getPixel

         int getPixel(int x, int y)

        Returns the android.graphics.Color at the specified location.

        Parameters:
        x - The x coordinate (0...width-1) of the pixel to return.
        y - The y coordinate (0...height-1) of the pixel to return.
      • setPixel

         void setPixel(int x, int y, @ColorInt() int color)

        Sets the android.graphics.Color at the specified location.

        Parameters:
        x - The x coordinate (0...width-1) of the pixel to set.
        y - The y coordinate (0...height-1) of the pixel to set.
        color - The argb android.graphics.Color to set at thespecified coordinate.