-
-
Constructor Summary
Constructors Constructor Description Pixa(long nativePixa, int width, int height)Creates a wrapper for the specified native Pixa pointer.
-
Method Summary
Modifier and Type Method Description static PixacreatePixa(int size)Creates a new Pixa with the specified minimum capacity. static PixacreatePixa(int size, int width, int height)Creates a new Pixa with the specified minimum capacity. longgetNativePixa()Returns a pointer to the native PIXA object. Pixacopy()Creates a shallow copy of this Pixa. Pixasort(int field, int order)Sorts this Pixa using the specified field and order. intsize()Returns the number of elements in this Pixa. synchronized voidrecycle()Recycles this Pixa and frees natively allocated memory. booleanjoin(Pixa otherPixa)Merges the contents of another Pixa into this one. voidaddPix(Pix pix, int mode)Adds a Pix to this Pixa. voidaddBox(Box box, int mode)Adds a Box to this Pixa. voidadd(Pix pix, Box box, int mode)Adds a Pix and associated Box to this Pixa. BoxgetBox(int index)Creates and returns clone of the Box at the specified index, or nullon error.Returned object should be recycled after use.PixgetPix(int index)Creates and returns clone of the Pix at the specified index, or nullon error.Returned object should be recycled after use.intgetWidth()Returns the width of this Pixa, or 0 if one was not set when it wascreated. intgetHeight()Returns the height of this Pixa, or 0 if one was not set when it wascreated. RectgetRect()Returns a bounding Rect for this Pixa, which may be (0,0,0,0) if widthand height were not specified on creation. Array<int>getBoxGeometry(int index)Returns a geometry array for the Box at the specified index. booleangetBoxGeometry(int index, @Size(min = 4) Array<int> dimensions)Fills an array with the geometry of the Box at the specified index. RectgetBoxRect(int index)Returns a bounding Rect for the Box at the specified index. ArrayList<Rect>getBoxRects()Returns an ArrayList of Box bounding Rects. voidreplacePix(int index, Pix pix, Box box)Replaces the Pix and Box at the specified index with the specified Pixand Box. voidmergeAndReplacePix(int indexA, int indexB)Merges the Pix at the specified indices and removes the Pix at the secondindex. booleanwriteToFileRandomCmap(File file)Writes the components of this Pix to a bitmap-formatted file using arandom color map. Iterator<Pix>iterator()-
-
Method Detail
-
createPixa
static Pixa createPixa(int size)
Creates a new Pixa with the specified minimum capacity. The Pixa willexpand automatically as new Pix are added.
- Parameters:
size- The minimum capacity of this Pixa.
-
createPixa
static Pixa createPixa(int size, int width, int height)
Creates a new Pixa with the specified minimum capacity. The Pixa willexpand automatically as new Pix are added.
If non-zero, the specified width and height will be used to specify thebounds of output images. *
- Parameters:
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.
-
getNativePixa
long getNativePixa()
Returns a pointer to the native PIXA object. This is used by native code.
-
copy
Pixa copy()
Creates a shallow copy of this Pixa. Contained Pix are cloned, and theresulting Pixa may be recycled separately from the original.
-
sort
Pixa sort(int field, int order)
Sorts this Pixa using the specified field and order. SeeConstants.L_SORT_BY_* and Constants.L_SORT_INCREASING orConstants.L_SORT_DECREASING.
- Parameters:
field- The field to sort by.order- The order in which to sort.
-
size
int size()
Returns the number of elements in this Pixa.
-
recycle
synchronized void recycle()
Recycles this Pixa and frees natively allocated memory. You may notaccess or modify the Pixa after calling this method.
Any Pix obtained from this Pixa or copies of this Pixa will still beaccessible until they are explicitly recycled or finalized by the garbagecollector.
-
join
boolean join(Pixa otherPixa)
Merges the contents of another Pixa into this one.
- Parameters:
otherPixa- The Pix to merge.
-
addPix
void addPix(Pix pix, int mode)
Adds a Pix to this Pixa.
- Parameters:
pix- The Pix to add.mode- The mode in which to add this Pix, typicallyConstants.L_CLONE.
-
addBox
void addBox(Box box, int mode)
Adds a Box to this Pixa.
- Parameters:
box- The Box to add.mode- The mode in which to add this Box, typicallyConstants.L_CLONE.
-
add
void add(Pix pix, Box box, int mode)
Adds a Pix and associated Box to this Pixa.
- Parameters:
pix- The Pix to add.box- The Box to add.mode- The mode in which to add this Pix and Box, typicallyConstants.L_CLONE.
-
getBox
Box getBox(int index)
Creates and returns clone of the Box at the specified index, or
nullon error.Returned object should be recycled after use.- Parameters:
index- The index of the Box to return.
-
getPix
Pix getPix(int index)
Creates and returns clone of the Pix at the specified index, or
nullon error.Returned object should be recycled after use.- Parameters:
index- The index of the Pix to return.
-
getWidth
int getWidth()
Returns the width of this Pixa, or 0 if one was not set when it wascreated.
-
getHeight
int getHeight()
Returns the height of this Pixa, or 0 if one was not set when it wascreated.
-
getRect
Rect getRect()
Returns a bounding Rect for this Pixa, which may be (0,0,0,0) if widthand height were not specified on creation.
-
getBoxGeometry
Array<int> getBoxGeometry(int index)
Returns a geometry array for the Box at the specified index. SeeBox.INDEX_* for indices.
- Parameters:
index- The index of the Box to get the geometry of.
-
getBoxGeometry
boolean getBoxGeometry(int index, @Size(min = 4) Array<int> dimensions)
Fills an array with the geometry of the Box at the specified index. SeeBox.INDEX_* for indices.
- Parameters:
index- The index of the Box to get the geometry of.dimensions- The array to fill with Box geometry.
-
getBoxRect
Rect getBoxRect(int index)
Returns a bounding Rect for the Box at the specified index.
- Parameters:
index- The index of the Box to get the bounding Rect of.
-
getBoxRects
ArrayList<Rect> getBoxRects()
Returns an ArrayList of Box bounding Rects.
-
replacePix
void replacePix(int index, Pix pix, Box box)
Replaces the Pix and Box at the specified index with the specified Pixand Box. Pixa takes ownership of the given objects, they shouldn't beused or recycled after calling this method.
- Parameters:
index- The index of the Pix to replace.pix- The Pix to replace the existing Pix; it becomes an alias of the one stored in Pixa.box- The Box to replace the existing Box; it becomes an alias of the one stored in Pixa.
-
mergeAndReplacePix
void mergeAndReplacePix(int indexA, int indexB)
Merges the Pix at the specified indices and removes the Pix at the secondindex.
- Parameters:
indexA- The index of the first Pix.indexB- The index of the second Pix, which will be removed aftermerging.
-
writeToFileRandomCmap
boolean writeToFileRandomCmap(File file)
Writes the components of this Pix to a bitmap-formatted file using arandom color map.
- Parameters:
file- The file to write to.
-
-
-
-