Пример #1
0
        internal override void Initialize(string text, bool showText, int angle, float zoom)
        {
            base.Initialize(text, showText, angle, zoom);

            if (SymbolSize == DatamatrixSymbolSize.Auto)
            {
                width  = 0;
                height = 0;
            }
            else
            {
                DmParams dmParams = dmSizes[(int)SymbolSize - 1];
                width  = dmParams.width;
                height = dmParams.height;
            }

            Generate(Text);
        }
Пример #2
0
        private void Draw(byte[] data, int dataSize, DmParams dm)
        {
            int i, j, p, x, y, xs, ys, z;
            int xByte = (dm.width + 7) / 8;

            for (int k = 0; k < image.Length; ++k)
            {
                image[k] = 0;
            }
            //alignment patterns
            //dotted horizontal line
            for (i = 0; i < dm.height; i += dm.heightSection)
            {
                for (j = 0; j < dm.width; j += 2)
                {
                    SetBit(j, i, xByte);
                }
            }
            //solid horizontal line
            for (i = dm.heightSection - 1; i < dm.height; i += dm.heightSection)
            {
                for (j = 0; j < dm.width; ++j)
                {
                    SetBit(j, i, xByte);
                }
            }
            //solid vertical line
            for (i = 0; i < dm.width; i += dm.widthSection)
            {
                for (j = 0; j < dm.height; ++j)
                {
                    SetBit(i, j, xByte);
                }
            }
            //dotted vertical line
            for (i = dm.widthSection - 1; i < dm.width; i += dm.widthSection)
            {
                for (j = 1; j < dm.height; j += 2)
                {
                    SetBit(i, j, xByte);
                }
            }
            p = 0;
            for (ys = 0; ys < dm.height; ys += dm.heightSection)
            {
                for (y = 1; y < dm.heightSection - 1; ++y)
                {
                    for (xs = 0; xs < dm.width; xs += dm.widthSection)
                    {
                        for (x = 1; x < dm.widthSection - 1; ++x)
                        {
                            z = place[p++];
                            if (z == 1 || (z > 1 && ((data[z / 8 - 1] & 0xff) & (128 >> (z % 8))) != 0))
                            {
                                SetBit(x + xs, y + ys, xByte);
                            }
                        }
                    }
                }
            }
        }
Пример #3
0
 private void Draw(byte[] data, int dataSize, DmParams dm) {
     int i, j, p, x, y, xs, ys, z;
     int xByte = (dm.width + ws * 2 + 7) / 8;
     for (int k = 0; k < image.Length; ++k)
         image[k] = 0;
     //alignment patterns
     //dotted horizontal line
     for (i = ws; i < dm.height + ws; i += dm.heightSection) {
         for (j = ws; j < dm.width + ws; j += 2) {
             SetBit(j, i, xByte);
         }
     }
     //solid horizontal line
     for (i = dm.heightSection - 1 + ws; i < dm.height + ws; i += dm.heightSection) {
         for (j = ws; j < dm.width + ws; ++j) {
             SetBit(j, i, xByte);
         }
     }
     //solid vertical line
     for (i = ws; i < dm.width + ws; i += dm.widthSection) {
         for (j = ws; j < dm.height + ws; ++j) {
             SetBit(i, j, xByte);
         }
     }
     //dotted vertical line
     for (i = dm.widthSection - 1 + ws; i < dm.width + ws; i += dm.widthSection) {
         for (j = 1 + ws; j < dm.height + ws; j += 2) {
             SetBit(i, j, xByte);
         }
     }
     p = 0;
     for (ys = 0; ys < dm.height; ys += dm.heightSection) {
         for (y = 1; y < dm.heightSection - 1; ++y) {
             for (xs = 0; xs < dm.width; xs += dm.widthSection) {
                 for (x = 1; x < dm.widthSection - 1; ++x) {
                     z = place[p++];
                     if (z == 1 || (z > 1 && ((data[z/8-1] & 0xff) & (128 >> (z%8))) != 0))
                         SetBit(x + xs + ws, y + ys + ws, xByte);
                 }
             }
         }
     }
 }
Пример #4
0
        private void Draw(byte[] data, int dataSize, DmParams dm)
        {
            int i;
            int j;
            int p;
            int x;
            int y;
            int xs;
            int ys;
            int z;
            int xByte = (dm.width + ws * 2 + 7) / 8;

            iText.IO.Util.JavaUtil.Fill(image, (byte)0);
            //alignment patterns
            //dotted horizontal line
            for (i = ws; i < dm.height + ws; i += dm.heightSection)
            {
                for (j = ws; j < dm.width + ws; j += 2)
                {
                    SetBit(j, i, xByte);
                }
            }
            //solid horizontal line
            for (i = dm.heightSection - 1 + ws; i < dm.height + ws; i += dm.heightSection)
            {
                for (j = ws; j < dm.width + ws; ++j)
                {
                    SetBit(j, i, xByte);
                }
            }
            //solid vertical line
            for (i = ws; i < dm.width + ws; i += dm.widthSection)
            {
                for (j = ws; j < dm.height + ws; ++j)
                {
                    SetBit(i, j, xByte);
                }
            }
            //dotted vertical line
            for (i = dm.widthSection - 1 + ws; i < dm.width + ws; i += dm.widthSection)
            {
                for (j = 1 + ws; j < dm.height + ws; j += 2)
                {
                    SetBit(i, j, xByte);
                }
            }
            p = 0;
            for (ys = 0; ys < dm.height; ys += dm.heightSection)
            {
                for (y = 1; y < dm.heightSection - 1; ++y)
                {
                    for (xs = 0; xs < dm.width; xs += dm.widthSection)
                    {
                        for (x = 1; x < dm.widthSection - 1; ++x)
                        {
                            z = place[p++];
                            if (z == 1 || z > 1 && (data[z / 8 - 1] & 0xff & 128 >> z % 8) != 0)
                            {
                                SetBit(x + xs + ws, y + ys + ws, xByte);
                            }
                        }
                    }
                }
            }
        }