Namespace: PdfSharp.BigGustave
A PNG image. Call Png.Open(Stream, IChunkVisitor) to open from file or bytes.
public class Png
The header data from the PNG image.
public ImageHeader Header { get; }
The width of the image in pixels.
public int Width { get; }
The height of the image in pixels.
public int Height { get; }
Whether the image has an alpha (transparency) layer.
public bool HasAlphaChannel { get; }
Get the palette index at the given column and row (x, y).
public int GetPixelIndex(int x, int y)
x
Int32
The x coordinate (column).
y
Int32
The y coordinate (row).
Int32
The palette index of the pixel at the coordinate.
Remarks:
Pixel values are generated on demand from the underlying data to prevent holding many items in memory at once, so consumers should cache values if they’re going to be looped over many times.
Gets the color palette.
public Palette GetPalette()
Get the pixel at the given column and row (x, y).
public Pixel GetPixel(int x, int y)
x
Int32
The x coordinate (column).
y
Int32
The y coordinate (row).
Pixel
The pixel at the coordinate.
Remarks:
Pixel values are generated on demand from the underlying data to prevent holding many items in memory at once, so consumers should cache values if they’re going to be looped over many times.
Read the PNG image from the stream.
public static Png Open(Stream stream, IChunkVisitor chunkVisitor)
stream
Stream
The stream containing PNG data to be read.
chunkVisitor
IChunkVisitor
Optional: A visitor which is called whenever a chunk is read by the library.
Png
The Png data from the stream.
Read the PNG image from the stream.
public static Png Open(Stream stream, PngOpenerSettings settings)
stream
Stream
The stream containing PNG data to be read.
settings
PngOpenerSettings
Settings to apply when opening the PNG.
Png
The Png data from the stream.
Read the PNG image from the bytes.
public static Png Open(Byte[] bytes, IChunkVisitor chunkVisitor)
bytes
Byte[]
The bytes of the PNG data to be read.
chunkVisitor
IChunkVisitor
Optional: A visitor which is called whenever a chunk is read by the library.
Png
The Png data from the bytes.
Read the PNG image from the bytes.
public static Png Open(Byte[] bytes, PngOpenerSettings settings)
bytes
Byte[]
The bytes of the PNG data to be read.
settings
PngOpenerSettings
Settings to apply when opening the PNG.
Png
The Png data from the bytes.
Read the PNG from the file path.
public static Png Open(string filePath, IChunkVisitor chunkVisitor)
filePath
String
The path to the PNG file to open.
chunkVisitor
IChunkVisitor
Optional: A visitor which is called whenever a chunk is read by the library.
Png
The Png data from the file.
Remarks:
This will open the file to obtain a FileStream so will lock the file during reading.
Read the PNG from the file path.
public static Png Open(string filePath, PngOpenerSettings settings)
filePath
String
The path to the PNG file to open.
settings
PngOpenerSettings
Settings to apply when opening the PNG.
Png
The Png data from the file.
Remarks:
This will open the file to obtain a FileStream so will lock the file during reading.