GdPicture.NET Reference Guide
BarcodeAztecReaderGetBarcodeX4 Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : BarcodeAztecReaderGetBarcodeX4 Method
Barcode index. Must be between 1 and BarcodeAztecReaderGetBarcodeCount returned value.
Returns the X position (in pixels) of the bottom-right corner of a barcode detected by the' BarcodeAztecReaderDoScan method. If ROI has been set, this coordinate is relative to the used ROI.
Syntax
'Declaration
 
Public Function BarcodeAztecReaderGetBarcodeX4( _
   ByVal BarcodeNo As Integer _
) As Integer
public int BarcodeAztecReaderGetBarcodeX4( 
   int BarcodeNo
)
public function BarcodeAztecReaderGetBarcodeX4( 
    BarcodeNo: Integer
): Integer; 
public function BarcodeAztecReaderGetBarcodeX4( 
   BarcodeNo : int
) : int;
public: int BarcodeAztecReaderGetBarcodeX4( 
   int BarcodeNo
) 
public:
int BarcodeAztecReaderGetBarcodeX4( 
   int BarcodeNo
) 

Parameters

BarcodeNo
Barcode index. Must be between 1 and BarcodeAztecReaderGetBarcodeCount returned value.

Return Value

The barcode X position of the bottom-right corner; relative to the ROI, if any is defined.
Remarks
Use the GetStat() method to determine if this method has been successful.
Example
Detecting all aztec barcodes in an image and drawing a rectangle around them.
Using oImage As GdPictureImaging = New GdPictureImaging()
    Dim imageID As Integer = oImage.CreateGdPictureImageFromFile("")
    If oImage.GetStat() = GdPictureStatus.OK Then
        If oImage.BarcodeAztecReaderDoScan(imageID) = GdPictureStatus.OK Then
            Dim barcodeCount As Integer = oImage.BarcodeAztecReaderGetBarcodeCount()
            If barcodeCount > 0 Then
                'LeftArea, TopArea are coordinates used by SetROI()
                Dim X1, X2, X3, X4, Y1, Y2, Y3, Y4 As Integer
                For i As Integer = 1 To barcodeCount
                    X1 = oImage.BarcodeAztecReaderGetBarcodeX1(i) + LeftArea
                    X2 = oImage.BarcodeAztecReaderGetBarcodeX2(i) + LeftArea
                    X3 = oImage.BarcodeAztecReaderGetBarcodeX3(i) + LeftArea
                    X4 = oImage.BarcodeAztecReaderGetBarcodeX4(i) + LeftArea
                    Y1 = oImage.BarcodeAztecReaderGetBarcodeY1(i) + TopArea
                    Y2 = oImage.BarcodeAztecReaderGetBarcodeY2(i) + TopArea
                    Y3 = oImage.BarcodeAztecReaderGetBarcodeY3(i) + TopArea
                    Y4 = oImage.BarcodeAztecReaderGetBarcodeY4(i) + TopArea
                    oImage.DrawLine(imageID, X1, Y1, X2, Y2, 2, Color.Red, True)
                    oImage.DrawLine(imageID, X2, Y2, X3, Y3, 2, Color.Red, True)
                    oImage.DrawLine(imageID, X3, Y3, X4, Y4, 2, Color.Red, True)
                    oImage.DrawLine(imageID, X4, Y4, X1, Y1, 2, Color.Red, True)
                Next
                If oImage.SaveAsGIF(imageID, "aztec.gif") = GdPictureStatus.OK Then
                    MessageBox.Show("Done!", "BarcodeAztecReaderGetBarcodeX4")
                Else
                    MessageBox.Show("The file can't be saved. Status: " + oImage.GetStat().ToString(), "BarcodeAztecReaderGetBarcodeX4")
                End If
            Else
                MessageBox.Show("No barcode detected in the source file!", "BarcodeAztecReaderGetBarcodeX4")
            End If
            'Releasing allocated memory.
            oImage.BarcodeAztecReaderClear()
        Else
            MessageBox.Show("The scanning process has failed. Status: " + oImage.GetStat().ToString(), "BarcodeAztecReaderGetBarcodeX4")
        End If
        'Releasing the image resource from memory.
        oImage.ReleaseGdPictureImage(imageID)
    Else
        MessageBox.Show("The source file can't be loaded. Status: " + oImage.GetStat().ToString(), "BarcodeAztecReaderGetBarcodeX4")
    End If
End Using
using (GdPictureImaging oImage = new GdPictureImaging())
{
    int imageID = oImage.CreateGdPictureImageFromFile("");
    if (oImage.GetStat() == GdPictureStatus.OK)
    {
        if (oImage.BarcodeAztecReaderDoScan(imageID) == GdPictureStatus.OK)
        {
            int barcodeCount = oImage.BarcodeAztecReaderGetBarcodeCount();
            if (barcodeCount > 0)
            {
                //leftArea, topArea are coordinates used by SetROI()
                int X1, X2, X3, X4, Y1, Y2, Y3, Y4;
                for (int i = 1; i <= barcodeCount; i++)
                {
                    X1 = oImage.BarcodeAztecReaderGetBarcodeX1(i) + leftArea;
                    X2 = oImage.BarcodeAztecReaderGetBarcodeX2(i) + leftArea;
                    X3 = oImage.BarcodeAztecReaderGetBarcodeX3(i) + leftArea;
                    X4 = oImage.BarcodeAztecReaderGetBarcodeX4(i) + leftArea;
                    Y1 = oImage.BarcodeAztecReaderGetBarcodeY1(i) + topArea;
                    Y2 = oImage.BarcodeAztecReaderGetBarcodeY2(i) + topArea;
                    Y3 = oImage.BarcodeAztecReaderGetBarcodeY3(i) + topArea;
                    Y4 = oImage.BarcodeAztecReaderGetBarcodeY4(i) + topArea;
                    oImage.DrawLine(imageID, X1, Y1, X2, Y2, 2, Color.Red, true);
                    oImage.DrawLine(imageID, X2, Y2, X3, Y3, 2, Color.Red, true);
                    oImage.DrawLine(imageID, X3, Y3, X4, Y4, 2, Color.Red, true);
                    oImage.DrawLine(imageID, X4, Y4, X1, Y1, 2, Color.Red, true);
                }
                if (oImage.SaveAsGIF(imageID, "aztec.gif") == GdPictureStatus.OK)
                    MessageBox.Show("Done!", "BarcodeAztecReaderGetBarcodeX4");
                else
                    MessageBox.Show("The file can't be saved. Status: " + oImage.GetStat().ToString(), "BarcodeAztecReaderGetBarcodeX4");
            }
            else
                MessageBox.Show("No barcode detected in the source file!", "BarcodeAztecReaderGetBarcodeX4");
            oImage.BarcodeAztecReaderClear(); //Releasing allocated memory.
        }
        else
            MessageBox.Show("The scanning process has failed. Status: " + oImage.GetStat().ToString(), "BarcodeAztecReaderGetBarcodeX4");
        oImage.ReleaseGdPictureImage(imageID); //Releasing the image resource from memory.
    }
    else
        MessageBox.Show("The source file can't be loaded. Status: " + oImage.GetStat().ToString(), "BarcodeAztecReaderGetBarcodeX4");
}
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members