VintaSoft Barcode .NET SDK v10.0
MatrixBarcodeStructure Class
Members  Example 




Vintasoft.WpfBarcode.BarcodeStructure Namespace : MatrixBarcodeStructure Class
A class that stores structure of two-dimentsional matrix barcode (Aztec, QR Code, Micro QR, Data Matrix, Han Xin Code).
Object Model
MatrixBarcodeStructure Class
Syntax
'Declaration
 
Public Class MatrixBarcodeStructure 
   Inherits BarcodeStructureBase
'Usage
 
Dim instance As MatrixBarcodeStructure
public class MatrixBarcodeStructure : BarcodeStructureBase 
public __gc class MatrixBarcodeStructure : public BarcodeStructureBase 
public ref class MatrixBarcodeStructure : public BarcodeStructureBase 
Remarks
When generating the "design" barcodes it is necessary to take into account that you cannot change any barcode element if you want to recognize the barcode.
This class contains information about barcode elements of matrix barcode and provides information about importance of barcode elements for recognition systems.
Information about importance of barcode elements for recognition systems can be used for generating the "design" barcode, which can be recognized.

Two-dimensional matrix barcode usually consists from the following layers:
While changing the barcode element, it is necessary to take into account the importance of barcode element and the ability to restore the barcode element during the barcode recognition:
Example
This example shows how to generate QR barcode as a text file (ASCII graphics).
''' <summary>   
''' Generates the QR barcode structure as text file.   
''' </summary>   
''' <param name="value">The barcode value.</param>   
''' <param name="outputFilename">The output filename.</param>   
Public Shared Sub GenerateQRBarcodeStructureAsText(ByVal value As String, ByVal outputFilename As String)   
    Dim writer As New BarcodeWriter()   
    writer.Settings.Barcode = BarcodeType.Aztec   
    writer.Settings.Value = value   
    Dim barcode As MatrixBarcodeStructure = DirectCast(writer.GetBarcodeStructure(), MatrixBarcodeStructure)   
    Dim barcodeBBox As Int32Rect = barcode.GetBoundingBox()   
    Dim x0 As Integer = barcodeBBox.X   
    Dim x1 As Integer = barcodeBBox.X + barcodeBBox.Width   
    Dim y0 As Integer = barcodeBBox.Y   
    Dim y1 As Integer = barcodeBBox.Y + barcodeBBox.Height   
    Dim result As New StringBuilder((barcodeBBox.Width * 2 + 2) * barcodeBBox.Height)   
    For y As Integer = y0 To y1   
        For x As Integer = x0 To x1   
            Dim symbol As Char = " "c   
            If barcode.IsBlackCell(x, y) Then   
                If barcode.IsDataLayer(x, y) Then   
                    symbol = "D"c   
                ElseIf barcode.IsAlignmentPattern(x, y) Then   
                    symbol = "A"c   
                ElseIf barcode.IsFormatInformation(x, y) Then   
                    symbol = "F"c   
                ElseIf barcode.IsSearchPattern(x, y) Then   
                    symbol = "#"c   
                ElseIf barcode.IsTimingPattern(x, y) Then   
                    symbol = "T"c   
                End If   
            End If   
            result.Append(symbol)   
        Next   
        result.AppendLine()   
    Next   
    File.WriteAllText(outputFilename, result.ToString())   
End Sub
/// <summary>
/// Generates the QR barcode structure as text file.
/// </summary>
/// <param name="value">The barcode value.</param>
/// <param name="outputFilename">The output filename.</param>
public static void GenerateQRBarcodeStructureAsText(string value, string outputFilename)
{
    BarcodeWriter writer = new BarcodeWriter();
    writer.Settings.Barcode = BarcodeType.Aztec;
    writer.Settings.Value = value;
    MatrixBarcodeStructure barcode = (MatrixBarcodeStructure)writer.GetBarcodeStructure();
    Int32Rect barcodeBBox = barcode.GetBoundingBox();
    int x0 = barcodeBBox.X;
    int x1 = barcodeBBox.X + barcodeBBox.Width;
    int y0 = barcodeBBox.Y;
    int y1 = barcodeBBox.Y + barcodeBBox.Height;
    StringBuilder result = new StringBuilder((barcodeBBox.Width * 2 + 2) * barcodeBBox.Height);
    for (int y = y0; y <= y1; y++)
    {
        for (int x = x0; x <= x1; x++)
        {
            char symbol = ' ';
            if (barcode.IsBlackCell(x, y))
            {
                if (barcode.IsDataLayer(x, y))
                    symbol = 'D';
                else if (barcode.IsAlignmentPattern(x, y))
                    symbol = 'A';
                else if (barcode.IsFormatInformation(x, y))
                    symbol = 'F';
                else if (barcode.IsSearchPattern(x, y))
                    symbol = '#';
                else if (barcode.IsTimingPattern(x, y))
                    symbol = 'T';
            }
            result.Append(symbol);
        }
        result.AppendLine();
    }
    File.WriteAllText(outputFilename, result.ToString());            
}
Inheritance Hierarchy

System.Object
   Vintasoft.WpfBarcode.BarcodeStructure.BarcodeElement
      Vintasoft.WpfBarcode.BarcodeStructure.BarcodeCompositeElement<T>
         Vintasoft.WpfBarcode.BarcodeStructure.BarcodeCompositeElement
            Vintasoft.WpfBarcode.BarcodeStructure.BarcodeStructureBase
               Vintasoft.WpfBarcode.BarcodeStructure.MatrixBarcodeStructure

Requirements

Target Platforms: Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

See Also

Reference

MatrixBarcodeStructure Members
Vintasoft.WpfBarcode.BarcodeStructure Namespace
BarcodeElements Class
ISO15415QualityTest