C# Class ZXing.QrCode.Internal.MaskUtil

Afficher le fichier Open project: Redth/ZXing.Net.Mobile Class Usage Examples

Méthodes publiques

Méthode Description
applyMaskPenaltyRule1 ( ByteMatrix matrix ) : int

Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and give penalty to them. Example: 00000 or 11111.

applyMaskPenaltyRule2 ( ByteMatrix matrix ) : int

Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.

applyMaskPenaltyRule3 ( ByteMatrix matrix ) : int

Apply mask penalty rule 3 and return the penalty. Find consecutive cells of 00001011101 or 10111010000, and give penalty to them. If we find patterns like 000010111010000, we give penalties twice (i.e. 40 * 2).

applyMaskPenaltyRule4 ( ByteMatrix matrix ) : int

Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.

getDataMaskBit ( int maskPattern, int x, int y ) : bool

Return the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask pattern conditions.

Private Methods

Méthode Description
applyMaskPenaltyRule1Internal ( ByteMatrix matrix, bool isHorizontal ) : int

Helper function for applyMaskPenaltyRule1. We need this for doing this calculation in both vertical and horizontal orders respectively.

isWhiteHorizontal ( byte rowArray, int from, int to ) : bool
isWhiteVertical ( byte array, int col, int from, int to ) : bool

Method Details

applyMaskPenaltyRule1() public static méthode

Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and give penalty to them. Example: 00000 or 11111.
public static applyMaskPenaltyRule1 ( ByteMatrix matrix ) : int
matrix ByteMatrix The matrix.
Résultat int

applyMaskPenaltyRule2() public static méthode

Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.
public static applyMaskPenaltyRule2 ( ByteMatrix matrix ) : int
matrix ByteMatrix The matrix.
Résultat int

applyMaskPenaltyRule3() public static méthode

Apply mask penalty rule 3 and return the penalty. Find consecutive cells of 00001011101 or 10111010000, and give penalty to them. If we find patterns like 000010111010000, we give penalties twice (i.e. 40 * 2).
public static applyMaskPenaltyRule3 ( ByteMatrix matrix ) : int
matrix ByteMatrix The matrix.
Résultat int

applyMaskPenaltyRule4() public static méthode

Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.
public static applyMaskPenaltyRule4 ( ByteMatrix matrix ) : int
matrix ByteMatrix The matrix.
Résultat int

getDataMaskBit() public static méthode

Return the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask pattern conditions.
public static getDataMaskBit ( int maskPattern, int x, int y ) : bool
maskPattern int The mask pattern.
x int The x.
y int The y.
Résultat bool