Welcome Guest! You need to login or register to make posts.



Go to last post Go to first unread
#1 Posted : Monday, August 23, 2004 9:05:00 PM(UTC)

Rank: Member

Groups: Member
Joined: 4/30/2004(UTC)
Posts: 16

Are barcodes supported by the Aurigma controls and do you have an example of how to implement them?
#2 Posted : Monday, August 23, 2004 11:07:00 PM(UTC)

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 863

Thanks: 2 times
Was thanked: 25 time(s) in 25 post(s)
Unfortunately Graphics Mill does not have barcodes feature implemented. It provides ability to draw filled rectangles (as well as lines of various width), so you can implement this algorithm yourself.

Frankly speaking I am not familiar with barcode algorithm, but I think the idea is a following: each symbol is represented with some unique sequence of lines and gaps of variable width. I believe that these mappings are formalized with some industry standard, so as soon as you find it, you can write something like this:

    Dim objBitmap As New Bitmap
    objBitmap.CreateNew 300, 300, Format24bppRgb
    objBitmap.Graphics.Brush.PrimaryColor = ColorBlack
    Dim str As String
    str = "abc"
    Dim InitialX, InitialY, BarHeight
    InitialX = 20
    InitialY = 10
    BarHeight = 50
    Dim I As Long
    Dim X As Long
    X = InitialX
    For I = 1 To Len(str)
       Select Case Mid(str, I, 1)
        Case "a"
           objBitmap.Graphics.DrawRectangle X, InitialY, 1, BarHeight, True, False
           X = X + 3
           objBitmap.Graphics.DrawRectangle X, InitialY, 3, BarHeight, True, False
           X = X + 8
        Case "b"
           objBitmap.Graphics.DrawRectangle X, InitialY, 2, BarHeight, True, False
           X = X + 5
           objBitmap.Graphics.DrawRectangle X, InitialY, 1, BarHeight, True, False
           X = X + 4
           objBitmap.Graphics.DrawRectangle X, InitialY, 4, BarHeight, True, False
           X = X + 7
       End Select
    Next I

Of course, actual values for X = X + ... and objBitmap.Graphics.DrawRectangle X, InitialY, ..., BarHeight should be defined with a standard.

This is an extremely rough example. On practice, if I implemented this algorithm, I would create a function which draws several lines accepting the following parameters:
  • Bitmap (or even better Graphics)
  • Initial position (X from this sample)
  • Array of line widths and array of gap width (maybe combined - even are lines, odd are gaps).
Of course it should return modified X.

The "map" function I would implement as an array of widths arrays. As index of this array I would use ASCII code of the character that is defined widths array stored at this item. For example symbol "A" will be described with items stored at 65 position, etc. This code would be more easy-to-read and maintain. Besides referring item in array by index will work much faster than Select Case construction.

Probably there some other more efficient implementation available, however at first sight it should be good solution.

Hopefully it will help.

Edited by user Monday, December 24, 2007 5:02:49 PM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.