예제 #1
0
        public string EncodeSvgImage(string val, DmtxImageEncoderOptions options)
        {
            DmtxEncode encode = new DmtxEncode
            {
                ModuleSize     = options.ModuleSize,
                MarginSize     = options.MarginSize,
                SizeIdxRequest = options.SizeIdx,
                Scheme         = options.Scheme
            };

            byte[] valAsByteArray = GetRawDataAndSetEncoding(val, options, encode);

            encode.EncodeDataMatrix(options.ForeColor, options.BackColor, valAsByteArray);

            return(EncodeSvgFile(encode, "", options.ModuleSize, options.MarginSize, options.ForeColor, options.BackColor));
        }
예제 #2
0
        private Bitmap EncodeImage(string val, DmtxImageEncoderOptions options, bool isMosaic)
        {
            DmtxEncode encode = new DmtxEncode
            {
                ModuleSize     = options.ModuleSize,
                MarginSize     = options.MarginSize,
                SizeIdxRequest = options.SizeIdx
            };

            byte[] valAsByteArray = GetRawDataAndSetEncoding(val, options, encode);
            if (isMosaic)
            {
                encode.EncodeDataMosaic(valAsByteArray);
            }
            else
            {
                encode.EncodeDataMatrix(options.ForeColor, options.BackColor, valAsByteArray);
            }
            return(CopyDataToBitmap(encode.Image.Pxl, encode.Image.Width, encode.Image.Height));
        }
예제 #3
0
        public bool[,] EncodeRawData(string val, DmtxImageEncoderOptions options)
        {
            DmtxEncode encode = new DmtxEncode
            {
                ModuleSize     = 1,
                MarginSize     = 0,
                SizeIdxRequest = options.SizeIdx,
                Scheme         = options.Scheme
            };

            //options.Scheme = DmtxScheme.DmtxSchemeText;
            //encode.Scheme = DmtxScheme.DmtxSchemeText;

            //převod z UTF-8 do Win1250 - kvůli diakritice
            val = Encoding.GetEncoding(1250).GetString(Encoding.GetEncoding("UTF-8").GetBytes(val));

            byte[] valAsByteArray = GetRawDataAndSetEncoding(val, options, encode);

            encode.EncodeDataMatrixRaw(valAsByteArray);

            return(encode.RawData);
        }
예제 #4
0
 public Bitmap EncodeImageMosaic(string val, DmtxImageEncoderOptions options)
 {
     return(EncodeImage(val, options, true));
 }
예제 #5
0
 public Bitmap EncodeImage(string val, DmtxImageEncoderOptions options)
 {
     return(EncodeImage(val, options, false));
 }