Package com.sun.jna.platform
Class RasterRangesUtils
- java.lang.Object
- 
- com.sun.jna.platform.RasterRangesUtils
 
- 
 public class RasterRangesUtils extends java.lang.ObjectMethods that are useful to decompose a raster into a set of rectangles. An occupied pixel has two possible meanings, depending on the raster :- if the raster has an alpha layer, occupied means with alpha not null
- if the raster doesn't have any alpha layer, occupied means not completely black
 - Author:
- Olivier Chafik
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static interfaceRasterRangesUtils.RangesOutputAbstraction of a sink for ranges.
 - 
Constructor SummaryConstructors Constructor Description RasterRangesUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanoutputOccupiedRanges(int[] pixels, int w, int h, int occupationMask, RasterRangesUtils.RangesOutput out)Output the occupied values of an integer-pixels image as ranges of contiguous values.static booleanoutputOccupiedRanges(java.awt.image.Raster raster, RasterRangesUtils.RangesOutput out)Outputs ranges of occupied pixels.static booleanoutputOccupiedRangesOfBinaryPixels(byte[] binaryBits, int w, int h, RasterRangesUtils.RangesOutput out)Output the non-null values of a binary image as ranges of contiguous values.
 
- 
- 
- 
Method Detail- 
outputOccupiedRangespublic static boolean outputOccupiedRanges(java.awt.image.Raster raster, RasterRangesUtils.RangesOutput out)Outputs ranges of occupied pixels. In a raster that has an alpha layer, a pixel is occupied if its alpha value is not null. In a raster without alpha layer, a pixel is occupied if it is not completely black.- Parameters:
- raster- image to be segmented in non black or non-transparent ranges
- out- destination of the non null ranges
- Returns:
- true if the output succeeded, false otherwise
 
 - 
outputOccupiedRangesOfBinaryPixelspublic static boolean outputOccupiedRangesOfBinaryPixels(byte[] binaryBits, int w, int h, RasterRangesUtils.RangesOutput out)Output the non-null values of a binary image as ranges of contiguous values.- Parameters:
- binaryBits- byte-packed binary bits of an image
- w- width of the image (in pixels)
- h- height of the image
- out-
- Returns:
- true if the output succeeded, false otherwise
 
 - 
outputOccupiedRangespublic static boolean outputOccupiedRanges(int[] pixels, int w, int h, int occupationMask, RasterRangesUtils.RangesOutput out)Output the occupied values of an integer-pixels image as ranges of contiguous values. A pixel is considered occupied if the bitwise AND of its integer value with the provided occupationMask is not null.- Parameters:
- pixels- integer values of the pixels of an image
- w- width of the image (in pixels)
- h- height of the image
- occupationMask- mask used to select which bits are used in a pixel to check its occupied status. 0xff000000 would only take the alpha layer into account, for instance.
- out- where to output all the contiguous ranges of non occupied pixels
- Returns:
- true if the output succeeded, false otherwise
 
 
- 
 
-