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)); }
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; } } }
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; } } }
/// <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); } } }
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)); }
internal bool this[MatrixPoint point] { get { return(this[point.X, point.Y]); } set { this[point.X, point.Y] = value; } }
/// <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); }
/// <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); }
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 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;
public MatrixPoint Offset(MatrixPoint offset) => new MatrixPoint(offset.X + X, offset.Y + Y);
internal void CopyTo(TriStateMatrix target, MatrixPoint targetPoint, MatrixStatus mstatus) { CopyTo(target, new MatrixRectangle(new MatrixPoint(0, 0), new MatrixSize(Width, Height)), targetPoint, mstatus); }
public MatrixPoint Offset(MatrixPoint offset) { return(new MatrixPoint(offset.X + this.X, offset.Y + this.Y)); }
public MatrixPoint Offset(MatrixPoint offset) { return new MatrixPoint(offset.X + this.X, offset.Y + this.Y); }
/// <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)); }
/// <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; } }
/// <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; } }
/// <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; } }