/// <summary> /// Determines whether the specified string can be used as data in the DataMatrix. /// </summary> /// <param name="text">The code to be checked.</param> protected override void CheckCode(string text) { if (text == null) { throw new ArgumentNullException("text"); } DataMatrixImage mImage = new DataMatrixImage(Text, Encoding, Rows, Columns); mImage.Iec16022Ecc200(Columns, Rows, Encoding, Text.Length, Text, 0, 0, 0); }
/// <summary> /// Renders the matrix code. /// </summary> protected internal override void Render(XGraphics gfx, XBrush brush, XPoint position) { XGraphicsState state = gfx.Save(); switch (this.direction) { case CodeDirection.RightToLeft: gfx.RotateAtTransform(180, position); break; case CodeDirection.TopToBottom: gfx.RotateAtTransform(90, position); break; case CodeDirection.BottomToTop: gfx.RotateAtTransform(-90, position); break; } XPoint pos = position + CodeBase.CalcDistance(this.anchor, AnchorType.TopLeft, this.size); if (this.matrixImage == null) { this.matrixImage = DataMatrixImage.GenerateMatrixImage(Text, Encoding, Rows, Columns); } if (QuietZone > 0) { XSize sizeWithZone = new XSize(this.size.width, this.size.height); sizeWithZone.width = sizeWithZone.width / (Columns + 2 * QuietZone) * Columns; sizeWithZone.height = sizeWithZone.height / (Rows + 2 * QuietZone) * Rows; XPoint posWithZone = new XPoint(pos.X, pos.Y); posWithZone.X += size.width / (Columns + 2 * QuietZone) * QuietZone; posWithZone.Y += size.height / (Rows + 2 * QuietZone) * QuietZone; gfx.DrawRectangle(XBrushes.White, pos.x, pos.y, size.width, size.height); gfx.DrawImage(matrixImage, posWithZone.x, posWithZone.y, sizeWithZone.width, sizeWithZone.height); } else { gfx.DrawImage(matrixImage, pos.x, pos.y, this.size.width, this.size.height); } gfx.Restore(state); }
public static XImage GenerateMatrixImage(string text, string encoding, int rows, int columns) { DataMatrixImage dataMatrixImage = new DataMatrixImage(text, encoding, rows, columns); return dataMatrixImage.DrawMatrix(); }
/// <summary> /// Determines whether the specified string can be used as data in the DataMatrix. /// </summary> /// <param name="text">The code to be checked.</param> protected override void CheckCode(string text) { if (text == null) throw new ArgumentNullException("text"); DataMatrixImage mImage = new DataMatrixImage(Text, Encoding, Rows, Columns); mImage.Iec16022Ecc200(Columns, Rows, Encoding, Text.Length, Text, 0, 0, 0); }
public static XImage GenerateMatrixImage(string text, string encoding, int rows, int columns) { DataMatrixImage dataMatrixImage = new DataMatrixImage(text, encoding, rows, columns); return(dataMatrixImage.DrawMatrix()); }