Class BaseLuminanceSource
- Namespace
- ZXing
- Assembly
- zxing.dll
The base class for luminance sources which supports cropping and rotating based upon the luminance values.
public abstract class BaseLuminanceSource : LuminanceSource
- Inheritance
-
BaseLuminanceSource
- Derived
- Inherited Members
Constructors
BaseLuminanceSource(byte[], int, int)
Initializes a new instance of the BaseLuminanceSource class.
protected BaseLuminanceSource(byte[] luminanceArray, int width, int height)
Parameters
BaseLuminanceSource(int, int)
Initializes a new instance of the BaseLuminanceSource class.
protected BaseLuminanceSource(int width, int height)
Parameters
Fields
BChannelWeight
weight of the blue channel for calculating a gray scale image
protected const int BChannelWeight = 7424
Field Value
ChannelWeight
numbers of bits which for right shifting
protected const int ChannelWeight = 16
Field Value
GChannelWeight
weight of the green channel for calculating a gray scale image
protected const int GChannelWeight = 38550
Field Value
RChannelWeight
weight of the red channel for calculating a gray scale image
protected const int RChannelWeight = 19562
Field Value
luminances
protected byte[] luminances
Field Value
- byte[]
Properties
CropSupported
public override bool CropSupported { get; }
Property Value
- bool
Whether this subclass supports cropping.
InversionSupported
public override bool InversionSupported { get; }
Property Value
- bool
Whether this subclass supports invertion.
Matrix
gets the luminance matrix
public override byte[] Matrix { get; }
Property Value
- byte[]
RotateSupported
public override bool RotateSupported { get; }
Property Value
- bool
Whether this subclass supports counter-clockwise rotation.
Methods
CreateLuminanceSource(byte[], int, int)
Should create a new luminance source with the right class type. The method is used in methods crop and rotate.
protected abstract LuminanceSource CreateLuminanceSource(byte[] newLuminances, int width, int height)
Parameters
Returns
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). 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 the luminance values (newValue = 255 - oldValue)
public override LuminanceSource invert()
Returns
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()
TODO: not implemented yet
public override LuminanceSource rotateCounterClockwise45()
Returns
- LuminanceSource
A rotated version of this object.