Class PNGCanvas
Canvas for generating a PNG file.
The resulting PNG file can be retrieved using ToByteArray().
Inherited Members
Namespace: Codecrete.SwissQRBill.Windows
Assembly: Codecrete.SwissQRBill.Windows.dll
Syntax
public class PNGCanvas : BitmapCanvas, ICanvas, IDisposable
Constructors
| Improve this Doc View SourcePNGCanvas(Double, Double, Single, String)
Creates a new canvas.
Declaration
public PNGCanvas(double width, double height, float dpi, string fontFamilyList)
Parameters
Type | Name | Description |
---|---|---|
System.Double | width | Width of resulting PNG file, in mm |
System.Double | height | Height of resulting PNG file, in mm |
System.Single | dpi | Resolution of PNG file, in dpi (pixels per inch) |
System.String | fontFamilyList | A list font family names, separated by comma (same syntax as for CSS). The first font family will be used. |
Methods
| Improve this Doc View SourceSaveAs(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 |
---|---|---|
System.String | path | The path (file name) to write to. |
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 |
---|---|
System.Byte[] |
Overrides
| Improve this Doc View SourceWriteTo(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 |
---|---|---|
System.IO.Stream | stream | The stream to write to. |