Beispiel #1
0
        /// <summary>
        /// extern reachable encode methode
        /// </summary>
        /// <returns> combind a DimCodeReturnValue by using childclass's methods</returns>
        public DimCodeEncoderItem Encode(string input, VisualEncoderSettings settings)
        {
            input = EnrichInput(input, settings);

            if (VerifyInput(input, settings))
            {
                var pureBitmap = GenerateBitmap(input, settings);
                var preBitmap  = GeneratePresentationBitmap(pureBitmap, settings);
                return(new DimCodeEncoderItem
                {
                    Legend = GetLegend(input, settings),
                    PureBitmap = ImageToByteArray(pureBitmap),
                    PresentationBitmap = ImageToByteArray(preBitmap)
                });
            }
            return(null);
        }
Beispiel #2
0
 /// <summary>
 ///  each child should override this to tell the enduser what is wrong by using the caller.GuiLogMessage
 /// </summary>
 /// <param name="input"></param>
 /// <param name="settings"></param>
 /// <returns>has to return true if no error occurred</returns>
 protected virtual bool VerifyInput(string input, VisualEncoderSettings settings)
 {
     return(true);
 }
Beispiel #3
0
 /// <summary>
 /// the origin encode methode each child should override with the dim-code's specific encode methode.
 /// </summary>
 /// <param name="input"></param>
 /// <param name="settings"></param>
 /// <returns>returns the image of the dim-Code</returns>
 protected virtual Image GenerateBitmap(string input, VisualEncoderSettings settings)
 {
     throw new NotImplementedException();
 }
Beispiel #4
0
 /// <summary>
 /// the legend has to explain the corresponding colors in the presentation Bitmap, generated by child classes
 /// </summary>
 /// <param name="input"></param>
 /// <param name="settings"></param>
 /// <returns></returns>
 protected virtual List <LegendItem> GetLegend(string input, VisualEncoderSettings settings)
 {
     throw new NotImplementedException();
 }
Beispiel #5
0
 /// <summary>
 /// enrich the prue Bitmap with colors to explain certain areas of the DimCode
 /// </summary>
 /// <param name="pureBitmap"></param>
 /// <param name="settings"></param>
 /// <returns></returns>
 protected virtual Image GeneratePresentationBitmap(Image pureBitmap, VisualEncoderSettings settings)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
 // this may be some kind of integrity check value, or, if your code has a fixed size ,some pad
 /// <summary>
 /// gives the child class the ability to enrich the input before validating.
 /// </summary>
 /// <param name="input"></param>
 /// <param name="settings"></param>
 /// <returns>enriched Input</returns>
 protected virtual string EnrichInput(string input, VisualEncoderSettings settings)
 {
     return(input);
 }