Namespace: PdfSharp.BigGustave
Used to construct PNG images. Call PngBuilder.Create(Int32, Int32, Boolean) to make a new builder.
public class PngBuilder
Inheritance Object → PngBuilder
Create a builder for a PNG with the given width and size.
public static PngBuilder Create(int width, int height, bool hasAlphaChannel)
width
Int32
height
Int32
hasAlphaChannel
Boolean
Create a builder from a Png.
public static PngBuilder FromPng(Png png)
png
Png
Create a builder from the bytes of the specified PNG image.
public static PngBuilder FromPngBytes(Byte[] png)
png
Byte[]
Create a builder from the bytes in the BGRA32 pixel format. https://docs.microsoft.com/en-us/dotnet/api/system.windows.media.pixelformats.bgra32
public static PngBuilder FromBgra32Pixels(Byte[] data, int width, int height, bool useAlphaChannel)
data
Byte[]
The pixels in BGRA32 format.
width
Int32
The width in pixels.
height
Int32
The height in pixels.
useAlphaChannel
Boolean
Whether to include an alpha channel in the output.
Create a builder from the bytes in the BGRA32 pixel format. https://docs.microsoft.com/en-us/dotnet/api/system.windows.media.pixelformats.bgra32
public static PngBuilder FromBgra32Pixels(Stream data, int width, int height, bool useAlphaChannel)
data
Stream
The pixels in BGRA32 format.
width
Int32
The width in pixels.
height
Int32
The height in pixels.
useAlphaChannel
Boolean
Whether to include an alpha channel in the output.
Sets the RGB pixel value for the given column (x) and row (y).
public PngBuilder SetPixel(byte r, byte g, byte b, int x, int y)
r
Byte
g
Byte
b
Byte
x
Int32
y
Int32
Set the pixel value for the given column (x) and row (y).
public PngBuilder SetPixel(Pixel pixel, int x, int y)
pixel
Pixel
x
Int32
y
Int32
Allows you to store arbitrary text data in the “iTXt” international textual data chunks of the generated PNG image.
public PngBuilder StoreText(string keyword, string text)
keyword
String
A keyword identifying the text data between 1-79 characters in length.
Must not start with, end with, or contain consecutive whitespace characters.
Only characters in the range 32 - 126 and 161 - 255 are permitted.
text
String
The text data to store. Encoded as UTF-8 that may not contain zero (0) bytes but can be zero-length.
Get the bytes of the PNG file for this builder.
public Byte[] Save(SaveOptions options)
options
SaveOptions
Write the PNG file bytes to the provided stream.
public void Save(Stream outputStream, SaveOptions options)
outputStream
Stream
options
SaveOptions