public abstract class LuminanceSource extends Object
Modifier | Constructor and Description |
---|---|
protected |
LuminanceSource(int width,
int height) |
Modifier and Type | Method and Description |
---|---|
LuminanceSource |
crop(int left,
int top,
int width,
int height)
Returns a new object with cropped image data.
|
int |
getHeight() |
abstract byte[] |
getMatrix()
Fetches luminance data for the underlying bitmap.
|
abstract byte[] |
getRow(int y,
byte[] row)
Fetches one row of luminance data from the underlying platform's bitmap.
|
int |
getWidth() |
LuminanceSource |
invert() |
boolean |
isCropSupported() |
boolean |
isRotateSupported() |
LuminanceSource |
rotateCounterClockwise()
Returns a new object with rotated image data by 90 degrees counterclockwise.
|
LuminanceSource |
rotateCounterClockwise45()
Returns a new object with rotated image data by 45 degrees counterclockwise.
|
String |
toString() |
public abstract byte[] getRow(int y, byte[] row)
y
- The row to fetch, which must be in [0,getHeight())row
- An optional preallocated array. If null or too small, it will be ignored.
Always use the returned object, and ignore the .length of the array.public abstract byte[] getMatrix()
int luminance = array[y * width + x] & 0xff
public final int getWidth()
public final int getHeight()
public boolean isCropSupported()
public LuminanceSource crop(int left, int top, int width, int height)
left
- The left coordinate, which must be in [0,getWidth())top
- The top coordinate, which must be in [0,getHeight())width
- The width of the rectangle to crop.height
- The height of the rectangle to crop.public boolean isRotateSupported()
public LuminanceSource invert()
LuminanceSource
which inverts the luminances it returns -- black becomes
white and vice versa, and each value becomes (255-value).public LuminanceSource rotateCounterClockwise()
isRotateSupported()
is true.public LuminanceSource rotateCounterClockwise45()
isRotateSupported()
is true.Copyright © 2007–2024. All rights reserved.