Ejemplo n.º 1
0
 private static bool CheckFormat(string format, out IBitMatrixDrawer drawer, out ITripMatrixDrawer textDrawer)
 {
     textDrawer = new GraphicsTextDrawer();
     if (format == null)
     {
         LogError("Format required.");
         drawer = null;
         return(false);
     }
     if (format.Equals("svg", StringComparison.OrdinalIgnoreCase))
     {
         drawer = new SvgDrawer();
         return(true);
     }
     if (format.Equals("gif", StringComparison.OrdinalIgnoreCase))
     {
         drawer = new Rgb24BitmapDrawer();
         return(true);
     }
     if (format.Equals("png", StringComparison.OrdinalIgnoreCase))
     {
         drawer = new GraphicsDrawer();
         return(true);
     }
     if (format.Equals("txt", StringComparison.OrdinalIgnoreCase))
     {
         textDrawer = new GraphicsTextDrawer();
         drawer     = new GraphicsDrawer();
         return(true);
     }
     LogError("Format not supported.");
     drawer     = null;
     textDrawer = null;
     return(false);
 }
Ejemplo n.º 2
0
 public QRAnimationCreator(
     IQRCodeEncoder qrCodeEncoder,
     IBinarizer binarizer, ITriparizer triparizer, IColorizer colorizer, IMerger merger,
     IBitMatrixDrawer bitMatrixDrawer, ITripMatrixDrawer tripMatrixDrawer,
     Func <IReadOnlyList <IRgb24BitmapFrame>, IRgb24BitmapBase> frameMerger)
     : base(qrCodeEncoder, binarizer, triparizer, colorizer, merger, bitMatrixDrawer, tripMatrixDrawer)
 {
     FrameMerger = frameMerger;
 }
Ejemplo n.º 3
0
 public QRArtCreator(
     IQRCodeEncoder qrCodeEncoder,
     IBinarizer binarizer, ITriparizer triparizer, IColorizer colorizer, IMerger merger,
     IBitMatrixDrawer bitMatrixDrawer, ITripMatrixDrawer tripMatrixDrawer)
 {
     if (qrCodeEncoder == null)
     {
         throw new ArgumentNullException(nameof(qrCodeEncoder));
     }
     if (binarizer == null)
     {
         throw new ArgumentNullException(nameof(binarizer));
     }
     if (colorizer == null)
     {
         throw new ArgumentNullException(nameof(colorizer));
     }
     if (triparizer == null)
     {
         throw new ArgumentNullException(nameof(triparizer));
     }
     if (merger == null)
     {
         throw new ArgumentNullException(nameof(merger));
     }
     if (bitMatrixDrawer == null)
     {
         throw new ArgumentNullException(nameof(bitMatrixDrawer));
     }
     QRCodeEncoder    = qrCodeEncoder;
     Binarizer        = binarizer;
     Triparizer       = triparizer;
     Colorizer        = colorizer;
     Merger           = merger;
     BitMatrixDrawer  = bitMatrixDrawer;
     TripMatrixDrawer = tripMatrixDrawer;
 }
Ejemplo n.º 4
0
        private static bool CheckFormatAnimation(string format, out IBitMatrixDrawer drawer, out ITripMatrixDrawer textDrawer)
        {
            textDrawer = null;
            if (format == null)
            {
                LogError("Format required.");
                drawer = null;
                return(false);
            }
            if (format.Equals("gif", StringComparison.OrdinalIgnoreCase))
            {
                // drawer = new GraphicsDrawer();
                drawer = new Rgb24BitmapDrawer();
                return(true);
            }
            LogError("Only gif format is supported for animated QR code.");
            drawer = null;

            return(false);
        }