Code samples

Code samples for VintaSoft Barcode .NET SDK. Here you can request a code sample.

Board index < VintaSoft Barcode < VintaSoft Barcode .NET SDK Discussions < Code samples

We are migrating to new forums engine, no new registration or posting currently available. TIA for your patience.

Console: Read barcodes from an image if image data is stored in an unmanaged memory.



Console: Read barcodes from an image if image data is stored in an unmanaged memory.

Post by Alex »

Here is C# example that shows how to read barcodes from image if image data are stored in an unmanaged memory:
/// <summary>
/// Reads barcodes from an image. Image data are stored in an unmanaged memory.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="stride">The stride.</param>
/// <param name="format">The format.</param>
/// <param name="pixelDataScan0">The Scan0 pointer to pixel data.</param>
public static Vintasoft.Barcode.IBarcodeInfo[] ReadBarcodes(Vintasoft.Barcode.BarcodeReader reader, int width, int height, int stride, System.Drawing.Imaging.PixelFormat format, IntPtr pixelDataScan0)
{
    using (System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(width, height, stride, format, pixelDataScan0))
    {
        // read barcodes 
        return reader.ReadBarcodes(bitmap);
    }
}


Page 1 from 1: 1