-
public class PixJava representation of a native Leptonica PIX object.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classPix.ImageFileFormatImage file format.
-
Method Summary
Modifier and Type Method Description longgetNativePix()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. booleangetDimensions(@Size(min = 3) Array<int> dimensions)Fills an array with this image's dimensions. Pixclone()Returns a clone of this Pix. Pixcopy()Returns a deep copy of this Pix that can be modified without affectingthe original Pix. booleaninvert()Inverts this Pix in-place. voidrecycle()Releases resources and frees any memory associated with this Pix. static PixcreateFromPix(Array<byte> pixData, int width, int height, int depth)Creates a new Pix from raw Pix data obtained from getData(). RectgetRect()Returns a Rect with the width and height of this Pix. intgetWidth()Returns the width of this Pix. intgetHeight()Returns the height of this Pix. intgetDepth()Returns the depth of this Pix. intgetSpp()Returns the spp of this Pix. intgetImageFormat()Returns the imageFormat of this Pix. intgetPixel(int x, int y)Returns the android.graphics.Color at the specified location. voidsetPixel(int x, int y, @ColorInt() int color)Sets the android.graphics.Color at the specified location. -
-
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.
-
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.
-
-
-
-