public class Pix extends Object
Modifier and Type | Field and Description |
---|---|
static int |
INDEX_D
Index of the image bit-depth within the dimensions array.
|
static int |
INDEX_H
Index of the image height within the dimensions array.
|
static int |
INDEX_W
Index of the image width within the dimensions array.
|
Constructor and Description |
---|
Pix(int width,
int height,
int depth) |
Pix(long nativePix)
Creates a new Pix wrapper for the specified native PIX object.
|
Modifier and Type | Method and Description |
---|---|
Pix |
clone()
Returns a clone of this Pix.
|
Pix |
copy()
Returns a deep copy of this Pix that can be modified without affecting
the original Pix.
|
static Pix |
createFromPix(byte[] pixData,
int width,
int height,
int depth)
Creates a new Pix from raw Pix data obtained from getData().
|
byte[] |
getData()
Return the raw bytes of the native PIX object.
|
int |
getDepth()
Returns the depth of this Pix.
|
int[] |
getDimensions()
Returns an array of this image's dimensions.
|
boolean |
getDimensions(int[] dimensions)
Fills an array with this image's dimensions.
|
int |
getHeight()
Returns the height of this Pix.
|
long |
getNativePix()
Returns a pointer to the native Pix object.
|
int |
getPixel(int x,
int y)
Returns the
Color at the specified location. |
Rect |
getRect()
Returns a Rect with the width and height of this Pix.
|
int |
getRefCount() |
int |
getWidth()
Returns the width of this Pix.
|
boolean |
invert()
Inverts this Pix in-place.
|
void |
recycle()
Releases resources and frees any memory associated with this Pix.
|
void |
setPixel(int x,
int y,
int color)
Sets the
Color at the specified location. |
public static final int INDEX_W
public static final int INDEX_H
public static final int INDEX_D
public Pix(long nativePix)
nativePix
- A pointer to the native PIX object.public Pix(int width, int height, int depth)
public long getNativePix()
public byte[] getData()
public int[] getDimensions()
null
on
failurepublic boolean getDimensions(int[] dimensions)
dimensions
- An integer array with at least three elements.true
on successpublic Pix clone()
public Pix copy()
public boolean invert()
true
on successpublic void recycle()
public static Pix createFromPix(byte[] pixData, int width, int height, int depth)
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.null
on errorpublic Rect getRect()
public int getWidth()
public int getHeight()
public int getDepth()
public int getRefCount()
public int getPixel(int x, int y)
Color
at the specified location.x
- The x coordinate (0...width-1) of the pixel to return.y
- The y coordinate (0...height-1) of the pixel to return.Color
at the specified
coordinate.IllegalArgumentException
- If x, y exceeds the image bounds.public void setPixel(int x, int y, int color)
Color
at the specified location.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 Color
to set at the
specified coordinate.IllegalArgumentException
- If x, y exceeds the image bounds.