GdPicture.NET Reference Guide
BarcodeDataMatrixReaderGetBarcodeX1 Method (GdPictureImaging)

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


Barcode index. Must be between 1 and BarcodeDataMatrixReaderGetBarcodeCount returned value.

Return Value

The barcode X position of the top-left corner; relative to the ROI, if any is defined.

This method is used in the "Barcode Recognition" Demo.

Detecting all DataMatrix barcodes in an image and drawing a rectangle around them.
Dim oGdPictureImaging As New GdPicture.GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("") 'Prompt the user to select an image
If imageId <> 0 Then
   If oGdPictureImaging.BarcodeDataMatrixReaderDoScan(ImageID) = GdPictureStatus.OK Then 'Start DataMatrix barcode scanning process
      Dim BarcodeCount As Integer = oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeCount
      If BarcodeCount > 0 Then
         For i As Integer = 1 To BarcodeCount
  "Barcode No: " & Str(i))
  "Value: " & oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeValue(i))
  "Rows: " & Str(oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeRows(i)))
  "Columns: " & Str(oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeColumns(i)))
  "Columns: " & Str(oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeSkewAngle(i)))
         Dim X1, X2, X3, X4, Y1, Y2, Y3, Y4 As Integer
         'LeftArea, TopArea are coordinates used by SetROI()
         For i = 1 To oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeCount
            X1 = oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeX1(i) + LeftArea
            X2 = oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeX2(i) + LeftArea
            X3 = oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeX3(i) + LeftArea
            X4 = oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeX4(i) + LeftArea
            Y1 = oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeY1(i) + TopArea
            Y2 = oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeY2(i) + TopArea
            Y3 = oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeY3(i) + TopArea
            Y4 = oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeY4(i) + TopArea
            oGdPictureImaging.DrawLine(ImageID, X1, Y1, X2, Y2, 1, Color.Red, True)
            oGdPictureImaging.DrawLine(ImageID, X2, Y2, X3, Y3, 1, Color.Red, True)
            oGdPictureImaging.DrawLine(ImageID, X3, Y3, X4, Y4, 1, Color.Red, True)
            oGdPictureImaging.DrawLine(ImageID, X4, Y4, X1, Y1, 1, Color.Red, True)
      Else"No barcode detected !")
      End If
      oGdPictureImaging.BarcodeDataMatrixReaderClear() 'Release detection info from memory
   End If
End If
See Also


GdPictureImaging Class
GdPictureImaging Members