com.aspose.barcoderecognition
Class BarCodeRegion

java.lang.Object
  extended by com.aspose.barcoderecognition.BarCodeRegion

public final class BarCodeRegion
extends Object

Represents the barcode's region


 Draw edges of the barcode region, then fill it.
 
 [C#]
 BarCodeReader reader;
 reader = new BarCodeReader(@"c:\test.jpg",BarCodeReadType.Code39Standard);
 int counter = 0;
 while(reader.Read())
 {
     Console.WriteLine("BarCode Type: "+reader.GetReadType());
     Console.WriteLine("BarCode CodeText: " + reader.GetCodeText());
     BarCodeRegion region = reader.GetRegion();
     if(region != null)
     {
         Image img = System.Drawing.Image.FromFile(file);
         Graphics g = Graphics.FromImage(img);
         region.DrawBarCodeEdges(g,new Pen(Color.Red,1f));
         img.Save(string.Format(@".\edge_{0}.png" ,counter++));
         region.FillBarCodeRegion(g,Brushes.Green);
         img.Save(string.Format(@".\fill_{0}.png", counter++));
     }
 }
 reader.Close();
 [VB.NET]
 Dim reader As BarCodeReader
 reader = New BarCodeReader("c:\test.jpg", BarCodeReadType.Code39Standard)
 Dim counter As Integer
 While reader.Read()
     counter = counter + 1
     Console.WriteLine("BarCode Type: " + reader.GetReadType().ToString)
     Console.WriteLine("BarCode CodeText: " + reader.GetCodeText())
     Dim region As BarCodeRegion
     region = reader.GetRegion()
     If Not region Is Nothing Then
         Dim img As Image = System.Drawing.Image.FromFile("c:\test.jpg")
         Dim g As Graphics = Graphics.FromImage(img)
         region.DrawBarCodeEdges(g, New Pen(Color.Red, 1.0F))
         img.Save(String.Format(".\edge_{0}.png", counter))
         region.FillBarCodeRegion(g, Brushes.Green)
         img.Save(String.Format(".\fill_{0}.png", counter))
     End If
 End While
 reader.Close()
 


Method Summary
 void drawBarCodeEdges(Graphics2D g, Stroke pen, Paint brush)
           Draws the bar code edges.
 void fillBarCodeRegion(Graphics2D g, Paint brush)
           Fills the bar code region.
 Point2D.Float[] getPoints()
           Gets the points of the region.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPoints

public Point2D.Float[] getPoints()

Gets the points of the region.


drawBarCodeEdges

public void drawBarCodeEdges(Graphics2D g,
                             Stroke pen,
                             Paint brush)

Draws the bar code edges.

Parameters:
g - The graphics.
pen - The pen.

fillBarCodeRegion

public void fillBarCodeRegion(Graphics2D g,
                              Paint brush)

Fills the bar code region.

Parameters:
g - The graphics.
brush - The brush.


Copyright (c) 2002-2012 Aspose Pty Ltd. All Rights Reserved.