Show / Hide Table of Contents

Class PNGCanvas

Canvas for generating a PNG file.

The resulting PNG file can be retrieved using ToByteArray().

Inheritance
object
AbstractCanvas
SystemDrawingCanvas
BitmapCanvas
PNGCanvas
Implements
ICanvas
IDisposable
Inherited Members
BitmapCanvas.ToBitmap()
BitmapCanvas.Dispose(bool)
SystemDrawingCanvas.InitGraphics(Graphics, bool, float)
SystemDrawingCanvas.SetOffset(float, float)
SystemDrawingCanvas.Close()
SystemDrawingCanvas.SetTransformation(double, double, double, double, double)
SystemDrawingCanvas.StartPath()
SystemDrawingCanvas.CloseSubpath()
SystemDrawingCanvas.MoveTo(double, double)
SystemDrawingCanvas.LineTo(double, double)
SystemDrawingCanvas.AddRectangle(double, double, double, double)
SystemDrawingCanvas.CubicCurveTo(double, double, double, double, double, double)
SystemDrawingCanvas.FillPath(int, bool)
SystemDrawingCanvas.StrokePath(double, int, LineStyle, bool)
SystemDrawingCanvas.PutText(string, double, double, int, bool)
AbstractCanvas.MmToPt
AbstractCanvas.FontMetrics
AbstractCanvas.SetupFontMetrics(string)
AbstractCanvas.PutTextLines(string[], double, double, int, double)
AbstractCanvas.Ascender(int)
AbstractCanvas.Descender(int)
AbstractCanvas.LineHeight(int)
AbstractCanvas.TextWidth(string, int, bool)
AbstractCanvas.SplitLines(string, double, int)
AbstractCanvas.Dispose()
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Codecrete.SwissQRBill.Windows
Assembly: Codecrete.SwissQRBill.Windows.dll
Syntax
public class PNGCanvas : BitmapCanvas, ICanvas, IDisposable

Constructors

| Edit this page View Source

PNGCanvas(double, double, float, string)

Creates a new canvas.

Declaration
public PNGCanvas(double width, double height, float dpi, string fontFamilyList)
Parameters
Type Name Description
double width

Width of resulting PNG file, in mm

double height

Height of resulting PNG file, in mm

float dpi

Resolution of PNG file, in dpi (pixels per inch)

string fontFamilyList

A list font family names, separated by comma (same syntax as for CSS). The first font family will be used.

Methods

| Edit this page View Source

SaveAs(string)

Writes the resulting graphics as a PNG image to the specified file path.

The canvas can no longer be used for drawing after calling this method.

Declaration
public void SaveAs(string path)
Parameters
Type Name Description
string path

The path (file name) to write to.

| Edit this page View Source

ToByteArray()

Returns the result as a GDI+ bitmap.

The caller must take ownership of the bitmap and dispose it.

This method can only be called once. Thereafter, it is no longer possible to call any drawing methods or to call it a second time.

Declaration
public override byte[] ToByteArray()
Returns
Type Description
byte[]
Overrides
SystemDrawingCanvas.ToByteArray()
| Edit this page View Source

WriteTo(Stream)

Writes the resulting graphics as a PNG image to the specified stream.

The canvas can no longer be used for drawing after calling this method.

Declaration
public void WriteTo(Stream stream)
Parameters
Type Name Description
Stream stream

The stream to write to.

Implements

ICanvas
IDisposable
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX