Constructor and Description |
---|
Pixa(long nativePixa,
int width,
int height)
Creates a wrapper for the specified native Pixa pointer.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Pix pix,
Box box,
int mode)
Adds a Pix and associated Box to this Pixa.
|
void |
addBox(Box box,
int mode)
Adds a Box to this Pixa.
|
void |
addPix(Pix pix,
int mode)
Adds a Pix to this Pixa.
|
Pixa |
copy()
Creates a shallow copy of this Pixa.
|
static Pixa |
createPixa(int size)
Creates a new Pixa with the specified minimum capacity.
|
static Pixa |
createPixa(int size,
int width,
int height)
Creates a new Pixa with the specified minimum capacity.
|
protected void |
finalize() |
Box |
getBox(int index)
Returns the Box at the specified index, or
null on error. |
int[] |
getBoxGeometry(int index)
Returns a geometry array for the Box at the specified index.
|
boolean |
getBoxGeometry(int index,
int[] dimensions)
Fills an array with the geometry of the Box at the specified index.
|
Rect |
getBoxRect(int index)
Returns a bounding Rect for the Box at the specified index.
|
ArrayList<Rect> |
getBoxRects()
Returns an ArrayList of Box bounding Rects.
|
int |
getHeight()
Returns the height of this Pixa, or 0 if one was not set when it was
created.
|
long |
getNativePixa()
Returns a pointer to the native PIXA object.
|
Pix |
getPix(int index)
Returns the Pix at the specified index, or
null on error. |
Rect |
getRect()
Returns a bounding Rect for this Pixa, which may be (0,0,0,0) if width
and height were not specified on creation.
|
int |
getWidth()
Returns the width of this Pixa, or 0 if one was not set when it was
created.
|
Iterator<Pix> |
iterator() |
boolean |
join(Pixa otherPixa)
Merges the contents of another Pixa into this one.
|
void |
mergeAndReplacePix(int indexA,
int indexB)
Merges the Pix at the specified indices and removes the Pix at the second
index.
|
void |
recycle()
Recycles this Pixa and frees natively allocated memory.
|
void |
replacePix(int index,
Pix pix,
Box box)
Replaces the Pix and Box at the specified index with the specified Pix
and Box, both of which may be recycled after calling this method.
|
int |
size()
Returns the number of elements in this Pixa.
|
Pixa |
sort(int field,
int order)
Sorts this Pixa using the specified field and order.
|
boolean |
writeToFileRandomCmap(File file)
Writes the components of this Pix to a bitmap-formatted file using a
random color map.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public Pixa(long nativePixa, int width, int height)
nativePixa
- Native pointer to a PIXA object.width
- The width of the PIXA.height
- The height of the PIXA.public static Pixa createPixa(int size)
size
- The minimum capacity of this Pixa.null
on errorpublic static Pixa createPixa(int size, int width, int height)
If non-zero, the specified width and height will be used to specify the bounds of output images. *
size
- The minimum capacity of this Pixa.width
- (Optional) The width of this Pixa, use 0 for default.height
- (Optional) The height of this Pixa, use 0 for default.null
on errorpublic long getNativePixa()
public Pixa copy()
public Pixa sort(int field, int order)
field
- The field to sort by. See Constants.L_SORT_BY_*.order
- The order in which to sort. Must be either
Constants.L_SORT_INCREASING or Constants.L_SORT_DECREASING.public int size()
public void recycle()
Any Pix obtained from this Pixa or copies of this Pixa will still be accessible until they are explicitly recycled or finalized by the garbage collector.
protected void finalize() throws Throwable
public boolean join(Pixa otherPixa)
otherPixa
- The Pix to merge.true
on successpublic void addPix(Pix pix, int mode)
pix
- The Pix to add.mode
- The mode in which to add this Pix, typically
Constants.L_CLONE.public void addBox(Box box, int mode)
box
- The Box to add.mode
- The mode in which to add this Box, typically
Constants.L_CLONE.public void add(Pix pix, Box box, int mode)
pix
- The Pix to add.box
- The Box to add.mode
- The mode in which to add this Pix and Box, typically
Constants.L_CLONE.public Box getBox(int index)
null
on error.index
- The index of the Box to return.null
on errorpublic Pix getPix(int index)
null
on error.index
- The index of the Pix to return.null
on errorpublic int getWidth()
public int getHeight()
public Rect getRect()
public int[] getBoxGeometry(int index)
index
- The index of the Box to get the geometry of.public boolean getBoxGeometry(int index, int[] dimensions)
index
- The index of the Box to get the geometry of.dimensions
- The array to fill with Box geometry. Must be at least 4
elements.true
on successpublic Rect getBoxRect(int index)
index
- The index of the Box to get the bounding Rect of.public ArrayList<Rect> getBoxRects()
public void replacePix(int index, Pix pix, Box box)
index
- The index of the Pix to replace.pix
- The Pix to replace the existing Pix.box
- The Box to replace the existing Box.public void mergeAndReplacePix(int indexA, int indexB)
indexA
- The index of the first Pix.indexB
- The index of the second Pix, which will be removed after
merging.public boolean writeToFileRandomCmap(File file)
file
- The file to write to.true
on success