Exemple #1
0
        private static Bitmap GenerateBitmap(string barcodeText, int hscale, int vscale)
        {
            Pdf417lib pd = new Pdf417lib();
            pd.setText(barcodeText);
            pd.Options = Pdf417lib.PDF417_INVERT_BITMAP;
            pd.paintCode();
            Bitmap bitmap = new Bitmap(pd.BitColumns * hscale, pd.CodeRows * vscale);
            Graphics g = Graphics.FromImage(bitmap);
            sbyte[] bits = pd.OutBits;

            int cols = (pd.BitColumns - 1) / 8 + 1;

            int row = -1;
            int bitcol = 0;
            for (int i = 0; i < bits.Length; ++i)
            {
                if ((i % cols) == 0)
                {
                    row++;
                    bitcol = 0;
                }
                int value = bits[i];
                for (int j = 7; j >= 0; j--)
                {
                    int mask = (int)Math.Pow(2, j);
                    if ((value & mask) != 0)
                        g.FillRectangle(Brushes.White, bitcol * hscale, row * vscale, hscale, vscale);
                    else
                        g.FillRectangle(Brushes.Black, bitcol * hscale, row * vscale, hscale, vscale);
                    bitcol++;
                    if (bitcol == pd.BitColumns)
                        break;
                }
            }
            g.Dispose();

            return bitmap;
        }
Exemple #2
0
 private void InitBlock(Pdf417lib enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
     //UPGRADE_ISSUE: Class hierarchy differences between 'java.util.ArrayList' and 'System.Collections.ArrayList' may cause compilation errors. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1186"'
     list = new System.Collections.ArrayList();
 }
Exemple #3
0
 private void InitBlock(Pdf417lib enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }
Exemple #4
0
 public SegmentList(Pdf417lib enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Exemple #5
0
 public Segment(Pdf417lib enclosingInstance, char type, int start, int end)
 {
     InitBlock(enclosingInstance);
     this.type = type;
     this.start = start;
     this.end = end;
 }