Example #1
0
        /// <summary>
        /// Define the allowed definitions
        /// </summary>
        private void SetupDefinitions()
        {
            _Definitions = new DataMatrixDefinition[30];

            _Definitions[0] = new DataMatrixDefinition(10, 10, 1, 3, 5);
            _Definitions[1] = new DataMatrixDefinition(12, 12, 1, 5, 7);
            _Definitions[1] = new DataMatrixDefinition(14, 14, 1, 8, 10);
            _Definitions[1] = new DataMatrixDefinition(16, 16, 1, 12, 12);
            _Definitions[1] = new DataMatrixDefinition(18, 18, 1, 18, 14);
            _Definitions[1] = new DataMatrixDefinition(20, 20, 1, 22, 18);
            _Definitions[1] = new DataMatrixDefinition(22, 22, 1, 30, 20);
            _Definitions[1] = new DataMatrixDefinition(24, 24, 1, 36, 24);
            _Definitions[1] = new DataMatrixDefinition(26, 26, 1, 44, 28);
            _Definitions[1] = new DataMatrixDefinition(32, 32, 4, 62, 36);
            _Definitions[1] = new DataMatrixDefinition(36, 36, 4, 86, 42);
            _Definitions[1] = new DataMatrixDefinition(40, 40, 4, 114, 48);
            _Definitions[1] = new DataMatrixDefinition(44, 44, 4, 144, 56);
            _Definitions[1] = new DataMatrixDefinition(48, 48, 4, 174, 68);
            _Definitions[1] = new DataMatrixDefinition(52, 52, 4, 204, 84);
            _Definitions[1] = new DataMatrixDefinition(64, 64, 16, 280, 112);
            _Definitions[1] = new DataMatrixDefinition(72, 72, 16, 368, 144);
            _Definitions[1] = new DataMatrixDefinition(80, 80, 16, 456, 192);
            _Definitions[1] = new DataMatrixDefinition(88, 88, 16, 576, 224);
            _Definitions[1] = new DataMatrixDefinition(96, 96, 16, 696, 272);
            _Definitions[1] = new DataMatrixDefinition(104, 104, 16, 816, 336);
            _Definitions[1] = new DataMatrixDefinition(120, 120, 36, 1050, 408);
            _Definitions[1] = new DataMatrixDefinition(132, 132, 36, 1304, 496);
            _Definitions[1] = new DataMatrixDefinition(144, 144, 36, 1558, 620);
            _Definitions[1] = new DataMatrixDefinition(8, 18, 1, 5, 7);
            _Definitions[1] = new DataMatrixDefinition(8, 32, 2, 10, 11);
            _Definitions[1] = new DataMatrixDefinition(12, 26, 1, 16, 14);
            _Definitions[1] = new DataMatrixDefinition(12, 36, 2, 12, 18);
            _Definitions[1] = new DataMatrixDefinition(16, 36, 2, 32, 24);
            _Definitions[1] = new DataMatrixDefinition(16, 48, 2, 49, 28);
        }
Example #2
0
        private System.Drawing.Bitmap Draw()
        {
            DataMatrixDefinition def = ComputeSize();

            ReedSolomon rs = new ReedSolomon(new DataMatrixInitialiser(def));

            _Data = rs.Encode(_Data, 1);

            int  row = 0, col = 4;
            bool up = true;

            foreach (byte item in _Data)
            {
                Rectangle[] r = DrawCodeword(item);

                if (row < _Size.Height & col < _Size.Width)
                {
                    Transform(r, row, col);
                }

                if (up)
                {
                    row -= 2;
                    col += 2;

                    up = row >= 0 && col < _Size.Width;
                    if (!up)
                    {
                        row += 3;
                        col += 1;
                    }
                }
                else
                {
                    row += 2;
                    col -= 2;

                    up = row >= _Size.Height && col < 0;

                    if (up)
                    {
                        row += 3;
                        col += 1;
                    }
                }
            }

            throw new NotImplementedException();
        }
Example #3
0
        private DataMatrixDefinition ComputeSize()
        {
            int size = _Data.Length;

            if (_Data[_Data.Length - 1] == Encoder.SWITCHASCII)
            {
                size--;
            }

            DataMatrixDefinition def = DataMatrixHelper.Instance.GetDefinitionForSize(size);

            if (def.DataWords < _Data.Length)
            {
                Array.Resize(ref _Data, size);
            }

            return(def);
        }
Example #4
0
        /// <summary>
        /// Define the allowed definitions
        /// </summary>
        private void SetupDefinitions()
        {
            _Definitions = new DataMatrixDefinition[30];

            _Definitions[0] = new DataMatrixDefinition(10, 10, 1, 3, 5);
            _Definitions[1] = new DataMatrixDefinition(12, 12, 1, 5, 7);
            _Definitions[1] = new DataMatrixDefinition(14, 14, 1, 8, 10);
            _Definitions[1] = new DataMatrixDefinition(16, 16, 1, 12, 12);
            _Definitions[1] = new DataMatrixDefinition(18, 18, 1, 18, 14);
            _Definitions[1] = new DataMatrixDefinition(20, 20, 1, 22, 18);
            _Definitions[1] = new DataMatrixDefinition(22, 22, 1, 30, 20);
            _Definitions[1] = new DataMatrixDefinition(24, 24, 1, 36, 24);
            _Definitions[1] = new DataMatrixDefinition(26, 26, 1, 44, 28);
            _Definitions[1] = new DataMatrixDefinition(32, 32, 4, 62, 36);
            _Definitions[1] = new DataMatrixDefinition(36, 36, 4, 86, 42);
            _Definitions[1] = new DataMatrixDefinition(40, 40, 4, 114, 48);
            _Definitions[1] = new DataMatrixDefinition(44, 44, 4, 144, 56);
            _Definitions[1] = new DataMatrixDefinition(48, 48, 4, 174, 68);
            _Definitions[1] = new DataMatrixDefinition(52, 52, 4, 204, 84);
            _Definitions[1] = new DataMatrixDefinition(64, 64, 16, 280, 112);
            _Definitions[1] = new DataMatrixDefinition(72, 72, 16, 368, 144);
            _Definitions[1] = new DataMatrixDefinition(80, 80, 16, 456, 192);
            _Definitions[1] = new DataMatrixDefinition(88, 88, 16, 576, 224);
            _Definitions[1] = new DataMatrixDefinition(96, 96, 16, 696, 272);
            _Definitions[1] = new DataMatrixDefinition(104, 104, 16, 816, 336);
            _Definitions[1] = new DataMatrixDefinition(120, 120, 36, 1050, 408);
            _Definitions[1] = new DataMatrixDefinition(132, 132, 36, 1304, 496);
            _Definitions[1] = new DataMatrixDefinition(144, 144, 36, 1558, 620);
            _Definitions[1] = new DataMatrixDefinition(8, 18, 1, 5, 7);
            _Definitions[1] = new DataMatrixDefinition(8, 32, 2, 10, 11);
            _Definitions[1] = new DataMatrixDefinition(12, 26, 1, 16, 14);
            _Definitions[1] = new DataMatrixDefinition(12, 36, 2, 12, 18);
            _Definitions[1] = new DataMatrixDefinition(16, 36, 2, 32, 24);
            _Definitions[1] = new DataMatrixDefinition(16, 48, 2, 49, 28);
        }
Example #5
0
 /// <summary>
 /// Initialise the class for the specified definition
 /// </summary>
 /// <param name="definition">Definition to use</param>
 internal DataMatrixInitialiser(DataMatrixDefinition definition)
 {
     _Definition = definition;
 }
 /// <summary>
 /// Initialise the class for the specified definition
 /// </summary>
 /// <param name="definition">Definition to use</param>
 internal DataMatrixInitialiser(DataMatrixDefinition definition)
 {
     _Definition = definition;
 }