Пример #1
0
 public Bitmap EncodeImageMosaic(string val, int dotSize, int margin)
 {
     DmtxImageEncoderOptions options = new DmtxImageEncoderOptions();
     options.MarginSize = margin;
     options.ModuleSize = dotSize;
     return EncodeImageMosaic(val, options);
 }
Пример #2
0
        private Bitmap EncodeImage(string val, DmtxImageEncoderOptions options, bool isMosaic)
        {
            DmtxEncode encode = new DmtxEncode();

            encode.ModuleSize     = options.ModuleSize;
            encode.MarginSize     = options.MarginSize;
            encode.Scheme         = options.Scheme;
            encode.SizeIdxRequest = options.SizeIdx;
            byte[] valAsByteArray = Encoding.ASCII.GetBytes(val);
            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 Bitmap EncodeImage(string val, DmtxImageEncoderOptions options)
 {
     return(EncodeImage(val, options, false));
 }
Пример #4
0
 public Bitmap EncodeImageMosaic(string val, DmtxImageEncoderOptions options)
 {
     return(EncodeImage(val, options, true));
 }
Пример #5
0
 public string EncodeSvgImage(string val, DmtxImageEncoderOptions options)
 {
     DmtxEncode encode = new DmtxEncode();
     encode.ModuleSize = options.ModuleSize;
     encode.MarginSize = options.MarginSize;
     encode.SizeIdxRequest = options.SizeIdx;
     encode.Scheme = options.Scheme;
     byte[] valAsByteArray = Encoding.ASCII.GetBytes(val);
     encode.EncodeDataMatrix(options.ForeColor, options.BackColor, valAsByteArray);
     return EncodeSvgFile(encode, "", options.ModuleSize, options.MarginSize, options.ForeColor, options.BackColor);
 }
Пример #6
0
 public string EncodeSvgImage(string val, int dotSize, int margin, Color foreColor, Color backColor)
 {
     DmtxImageEncoderOptions options = new DmtxImageEncoderOptions();
     options.ModuleSize = dotSize;
     options.MarginSize = margin;
     options.ForeColor = foreColor;
     options.BackColor = backColor;
     return EncodeSvgImage(val, options);
 }
Пример #7
0
 public Bitmap EncodeImageMosaic(string val, DmtxImageEncoderOptions options)
 {
     return EncodeImage(val, options, true);
 }
Пример #8
0
 public Bitmap EncodeImage(string val, DmtxImageEncoderOptions options)
 {
     return EncodeImage(val, options, false);
 }
Пример #9
0
 private Bitmap EncodeImage(string val, DmtxImageEncoderOptions options, bool isMosaic)
 {
     DmtxEncode encode = new DmtxEncode();
     encode.ModuleSize = options.ModuleSize;
     encode.MarginSize = options.MarginSize;
     encode.Scheme = options.Scheme;
     encode.SizeIdxRequest = options.SizeIdx;
     byte[] valAsByteArray = Encoding.ASCII.GetBytes(val);
     if (isMosaic)
     {
         encode.EncodeDataMosaic(valAsByteArray);
     }
     else
     {
         encode.EncodeDataMatrix(options.ForeColor, options.BackColor, valAsByteArray);
     }
     return CopyDataToBitmap(encode.Image.Pxl, encode.Image.Width, encode.Image.Height);
 }