Class InvertedLuminanceSource
- Namespace
- ZXing
- Assembly
- zxing.dll
A wrapper implementation of {@link LuminanceSource} which inverts the luminances it returns -- black becomes white and vice versa, and each value becomes (255-value).
public sealed class InvertedLuminanceSource : LuminanceSource
- Inheritance
-
InvertedLuminanceSource
- Inherited Members
Constructors
InvertedLuminanceSource(LuminanceSource)
Initializes a new instance of the InvertedLuminanceSource class.
public InvertedLuminanceSource(LuminanceSource @delegate)
Parameters
delegate
LuminanceSourceThe @delegate.
Properties
CropSupported
public override bool CropSupported { get; }
Property Value
- bool
Whether this subclass supports cropping.
Matrix
Fetches luminance data for the underlying bitmap. Values should be fetched using: int luminance = array[y * width + x] & 0xff;
public override byte[] Matrix { get; }
Property Value
- byte[]
A row-major 2D array of luminance values. Do not use result.length as it may be larger than width * height bytes on some platforms. Do not modify the contents of the result.
RotateSupported
public override bool RotateSupported { get; }
Property Value
- bool
Whether this subclass supports counter-clockwise rotation.
Methods
crop(int, int, int, int)
Returns a new object with cropped image data. Implementations may keep a reference to the original data rather than a copy. Only callable if CropSupported is true.
public override LuminanceSource crop(int left, int top, int width, int height)
Parameters
left
intThe left coordinate, 0 <= left < Width.
top
intThe top coordinate, 0 <= top <= Height.
width
intThe width of the rectangle to crop.
height
intThe height of the rectangle to crop.
Returns
- LuminanceSource
A cropped version of this object.
getRow(int, byte[])
Fetches one row of luminance data from the underlying platform's bitmap. Values range from 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have to bitwise and with 0xff for each value. It is preferable for implementations of this method to only fetch this row rather than the whole image, since no 2D Readers may be installed and getMatrix() may never be called.
public override byte[] getRow(int y, byte[] row)
Parameters
y
intThe row to fetch, 0 <= y < Height.
row
byte[]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.
Returns
- byte[]
An array containing the luminance data.
invert()
Inverts this instance.
public override LuminanceSource invert()
Returns
- LuminanceSource
original delegate {@link LuminanceSource} since invert undoes itself
rotateCounterClockwise()
Returns a new object with rotated image data by 90 degrees counterclockwise. Only callable if {@link #isRotateSupported()} is true.
public override LuminanceSource rotateCounterClockwise()
Returns
- LuminanceSource
A rotated version of this object.
rotateCounterClockwise45()
Returns a new object with rotated image data by 45 degrees counterclockwise. Only callable if {@link #isRotateSupported()} is true.
public override LuminanceSource rotateCounterClockwise45()
Returns
- LuminanceSource
A rotated version of this object.