internal static StringBuilder AppendRec(this StringBuilder sb, MatrixPoint position, MatrixPoint size)
 {
     return(sb.Append(string.Format(CultureInfo.InvariantCulture.NumberFormat,
                                    "<rect x=\"{0}\" y=\"{1}\" width=\"{2}\" height=\"{3}\"/>",
                                    position.X,
                                    position.Y,
                                    size.X,
                                    size.Y + 0.03)));
 }
 internal static StringBuilder AppendRec(this StringBuilder sb, MatrixPoint position, MatrixPoint size)
 {
     return sb.Append(string.Format(CultureInfo.InvariantCulture.NumberFormat,
         "<rect x=\"{0}\" y=\"{1}\" width=\"{2}\" height=\"{3}\"/>",
         position.X,
         position.Y,
         size.X,
         size.Y + 0.03));
 }
Beispiel #3
0
 internal void CopyTo(TriStateMatrix target, MatrixRectangle sourceArea, MatrixPoint targetPoint, MatrixStatus mstatus)
 {
     for (int j = 0; j < sourceArea.Size.Height; j++)
     {
         for (int i = 0; i < sourceArea.Size.Width; i++)
         {
             bool value = this[sourceArea.Location.X + i, sourceArea.Location.Y + j];
             target[targetPoint.X + i, targetPoint.Y + j, mstatus] = value;
         }
     }
 }
Beispiel #4
0
 private IEnumerable<MatrixPoint> GetAllCoordinatePairs()
 {
     IEnumerable<byte> coordinates = GetPatternCoordinatesByVersion(Version);
     foreach (byte centerX in coordinates)
     {
         foreach (byte centerY in coordinates)
         {
             MatrixPoint location = new MatrixPoint(centerX - 2, centerY - 2);
             yield return location;
         }
     }
 }
Beispiel #5
0
 /// <summary>
 /// Copies to.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="sourceArea">The source area.</param>
 /// <param name="targetPoint">The target point.</param>
 /// <param name="mstatus">The mstatus.</param>
 /// <remarks></remarks>
 internal void CopyTo(TriStateMatrix target, MatrixRectangle sourceArea, MatrixPoint targetPoint,
                      MatrixStatus mstatus)
 {
     for (int j = 0; j < sourceArea.Size.Height; j++)
     {
         for (int i = 0; i < sourceArea.Size.Width; i++)
         {
             bool value = this[sourceArea.Location.X + i, sourceArea.Location.Y + j];
             target[targetPoint.X + i, targetPoint.Y + j, mstatus] = value;
         }
     }
 }
        public override void ApplyTo(TriStateMatrix matrix)
        {
            MatrixSize size = GetSizeOfSquareWithSeparators();

            MatrixPoint leftTopCorner = new MatrixPoint(0, 0);
            this.CopyTo(matrix, new MatrixRectangle(new MatrixPoint(1, 1), size), leftTopCorner, MatrixStatus.NoMask);

            MatrixPoint rightTopCorner = new MatrixPoint(matrix.Width - this.Width + 1, 0);
            this.CopyTo(matrix, new MatrixRectangle(new MatrixPoint(0, 1), size), rightTopCorner, MatrixStatus.NoMask);

            MatrixPoint leftBottomCorner = new MatrixPoint(0, matrix.Width - this.Width + 1);
            this.CopyTo(matrix, new MatrixRectangle(new MatrixPoint(1, 0), size), leftBottomCorner, MatrixStatus.NoMask);
        }
        private IEnumerable <MatrixPoint> GetAllCoordinatePairs()
        {
            IEnumerable <byte> coordinates = GetPatternCoordinatesByVersion(Version);

            foreach (byte centerX in coordinates)
            {
                foreach (byte centerY in coordinates)
                {
                    MatrixPoint location = new MatrixPoint(centerX - 2, centerY - 2);
                    yield return(location);
                }
            }
        }
Beispiel #8
0
        public override void ApplyTo(TriStateMatrix matrix)
        {
            MatrixSize size = GetSizeOfSquareWithSeparators();

            MatrixPoint leftTopCorner = new MatrixPoint(0, 0);

            CopyTo(matrix, new MatrixRectangle(new MatrixPoint(1, 1), size), leftTopCorner, MatrixStatus.NoMask);

            MatrixPoint rightTopCorner = new MatrixPoint(matrix.Width - Width + 1, 0);

            CopyTo(matrix, new MatrixRectangle(new MatrixPoint(0, 1), size), rightTopCorner, MatrixStatus.NoMask);

            MatrixPoint leftBottomCorner = new MatrixPoint(0, matrix.Width - Width + 1);

            CopyTo(matrix, new MatrixRectangle(new MatrixPoint(1, 0), size), leftBottomCorner, MatrixStatus.NoMask);
        }
        internal static StringBuilder AppendSVGTag(this StringBuilder sb, MatrixPoint displaysize, MatrixPoint viewboxSize, GColor background, GColor fill)
        {
#endif


            if (displaysize.X <= 0 || displaysize.Y <= 0)
            {
                return(sb.Append(string.Format(CultureInfo.InvariantCulture.NumberFormat,
                                               "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.2\" baseProfile=\"tiny\" viewBox=\"0 0 {0} {1}\" viewport-fill=\"rgb({2}, {3}, {4})\" viewport-fill-opacity=\"{5}\" fill=\"rgb({6}, {7}, {8})\" fill-opacity=\"{9}\" {10}>",
                                               viewboxSize.X,
                                               viewboxSize.Y,
                                               background.R,
                                               background.G,
                                               background.B,
                                               ConvertAlpha(background.A),
                                               fill.R,
                                               fill.G,
                                               fill.B,
                                               ConvertAlpha(fill.A),
                                               BackgroundStyle(background)
                                               )));
            }
            else
            {
                return(sb.Append(string.Format(CultureInfo.InvariantCulture.NumberFormat,
                                               "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.2\" baseProfile=\"tiny\" viewBox=\"0 0 {0} {1}\" viewport-fill=\"rgb({2}, {3}, {4})\" viewport-fill-opacity=\"{5}\" fill=\"rgb({6}, {7}, {8})\" fill-opacity=\"{9}\" {10} width=\"{11}\" height=\"{12}\">",
                                               viewboxSize.X,
                                               viewboxSize.Y,
                                               background.R,
                                               background.G,
                                               background.B,
                                               ConvertAlpha(background.A),
                                               fill.R,
                                               fill.G,
                                               fill.B,
                                               ConvertAlpha(fill.A),
                                               BackgroundStyle(background),
                                               displaysize.X,
                                               displaysize.Y)));
            }
        }
        /// <summary>
        /// Embed format information to tristatematrix.
        /// Process combination of create info bits, BCH error correction bits calculation, embed towards matrix.
        /// </summary>
        /// <remarks>ISO/IEC 18004:2000 Chapter 8.9 Page 53</remarks>
        internal static void EmbedFormatInformation(this TriStateMatrix triMatrix, ErrorCorrectionLevel errorLevel, Pattern pattern)
        {
            BitList formatInfo = GetFormatInfoBits(errorLevel, pattern);
            int     width      = triMatrix.Width;

            for (int index = 0; index < 15; index++)
            {
                MatrixPoint point = PointForInfo1(index);
                bool        bit   = formatInfo[index];
                triMatrix[point.X, point.Y, MatrixStatus.NoMask] = bit;

                if (index < 7)
                {
                    triMatrix[8, width - 1 - index, MatrixStatus.NoMask] = bit;
                }
                else
                {
                    triMatrix[width - 8 + (index - 7), 8, MatrixStatus.NoMask] = bit;
                }
            }
        }
        internal static StringBuilder AppendSVGTag(this StringBuilder sb, MatrixPoint displaysize, MatrixPoint viewboxSize, GColor background, GColor fill)
        {
#endif
        

            if (displaysize.X <= 0 || displaysize.Y <= 0)
                return sb.Append(string.Format(CultureInfo.InvariantCulture.NumberFormat,
                    "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.2\" baseProfile=\"tiny\" viewBox=\"0 0 {0} {1}\" viewport-fill=\"rgb({2}, {3}, {4})\" viewport-fill-opacity=\"{5}\" fill=\"rgb({6}, {7}, {8})\" fill-opacity=\"{9}\" {10}>",
                    viewboxSize.X,
                    viewboxSize.Y,
                    background.R,
                    background.G,
                    background.B,
                    ConvertAlpha(background.A),
                    fill.R,
                    fill.G,
                    fill.B,
                    ConvertAlpha(fill.A),
                    BackgroundStyle(background)
                    ));
            else
                return sb.Append(string.Format(CultureInfo.InvariantCulture.NumberFormat,
                    "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.2\" baseProfile=\"tiny\" viewBox=\"0 0 {0} {1}\" viewport-fill=\"rgb({2}, {3}, {4})\" viewport-fill-opacity=\"{5}\" fill=\"rgb({6}, {7}, {8})\" fill-opacity=\"{9}\" {10} width=\"{11}\" height=\"{12}\">",
                    viewboxSize.X,
                    viewboxSize.Y,
                    background.R,
                    background.G,
                    background.B,
                    ConvertAlpha(background.A),
                    fill.R,
                    fill.G,
                    fill.B,
                    ConvertAlpha(fill.A),
                    BackgroundStyle(background),
                    displaysize.X,
                    displaysize.Y));
        }
Beispiel #12
0
 internal bool this[MatrixPoint point]
 {
     get { return(this[point.X, point.Y]); }
     set { this[point.X, point.Y] = value; }
 }
Beispiel #13
0
 /// <summary>
 /// Copies to.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="targetPoint">The target point.</param>
 /// <param name="mstatus">The mstatus.</param>
 /// <remarks></remarks>
 internal void CopyTo(TriStateMatrix target, MatrixPoint targetPoint, MatrixStatus mstatus)
 {
     CopyTo(target, new MatrixRectangle(new MatrixPoint(0, 0), new MatrixSize(Width, Height)), targetPoint,
            mstatus);
 }
Beispiel #14
0
 /// <summary>
 /// Offsets the specified offset.
 /// </summary>
 /// <param name="offset">The offset.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public MatrixPoint Offset(MatrixPoint offset)
 {
     return new MatrixPoint(offset.X + X, offset.Y + Y);
 }
Beispiel #15
0
 internal static TriStateMatrix Embed(this TriStateMatrix matrix, BitMatrix stencil, MatrixPoint location)
 {
     stencil.CopyTo(matrix, location, MatrixStatus.NoMask);
     return(matrix);
 }
 internal static StringBuilder AppendSVGTag(this StringBuilder sb, MatrixPoint displaysize, MatrixPoint viewboxSize, Color background, Color fill)
 {
 internal static StringBuilder AppendSVGTag(this StringBuilder sb, MatrixPoint displaysize, MatrixPoint viewboxSize, Color background, Color fill)
 {
 internal static TriStateMatrix Embed(this TriStateMatrix matrix,BitMatrix stencil, MatrixPoint location)
 {
     stencil.CopyTo(matrix, location, MatrixStatus.NoMask);
     return matrix;
 }
 internal bool this[MatrixPoint point]
 {
     get => this[point.X, point.Y];
     set => this[point.X, point.Y] = value;
Beispiel #20
0
 public MatrixPoint Offset(MatrixPoint offset) => new MatrixPoint(offset.X + X, offset.Y + Y);
Beispiel #21
0
 internal void CopyTo(TriStateMatrix target, MatrixPoint targetPoint, MatrixStatus mstatus)
 {
     CopyTo(target, new MatrixRectangle(new MatrixPoint(0, 0), new MatrixSize(Width, Height)), targetPoint, mstatus);
 }
Beispiel #22
0
 public MatrixPoint Offset(MatrixPoint offset)
 {
     return(new MatrixPoint(offset.X + this.X, offset.Y + this.Y));
 }
Beispiel #23
0
 public MatrixPoint Offset(MatrixPoint offset)
 {
     return new MatrixPoint(offset.X + this.X, offset.Y + this.Y);
 }
Beispiel #24
0
 /// <summary>
 /// Offsets the specified offset.
 /// </summary>
 /// <param name="offset">The offset.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public MatrixPoint Offset(MatrixPoint offset)
 {
     return(new MatrixPoint(offset.X + X, offset.Y + Y));
 }
Beispiel #25
0
 /// <summary>
 /// Gets or sets the <see cref="QrCode.Web.Encoder.MatrixStatus"/> with the specified point.
 /// </summary>
 /// <remarks></remarks>
 internal MatrixStatus this[MatrixPoint point]
 {
     get { return this[point.X, point.Y]; }
     set { this[point.X, point.Y] = value; }
 }
Beispiel #26
0
 /// <summary>
 /// Gets or sets the <see cref="QrCode.Web.Encoder.MatrixStatus"/> with the specified point.
 /// </summary>
 /// <remarks></remarks>
 internal MatrixStatus this[MatrixPoint point]
 {
     get { return(this[point.X, point.Y]); }
     set { this[point.X, point.Y] = value; }
 }
Beispiel #27
0
 /// <summary>
 /// Gets or sets the <see cref="System.Boolean"/> with the specified point.
 /// </summary>
 /// <remarks></remarks>
 internal bool this[MatrixPoint point]
 {
     get { return this[point.X, point.Y]; }
     set { this[point.X, point.Y] = value; }
 }