VectSharp 2.5.0
A light library for C# vector graphics
Loading...
Searching...
No Matches
VectSharp.RasterImage Class Reference

Represents a raster image, created from raw pixel data. Consider using the derived classes included in the NuGet package "VectSharp.MuPDFUtils" if you need to load a raster image from a file or a Stream. More...

Inheritance diagram for VectSharp.RasterImage:

Public Member Functions

 RasterImage (IntPtr pixelData, int width, int height, bool hasAlpha, bool interpolate)
 Creates a new RasterImage instance from the specified pixel data in RGB or RGBA format. More...
 
 RasterImage (ref DisposableIntPtr pixelData, int width, int height, bool hasAlpha, bool interpolate)
 Creates a new RasterImage instance from the specified pixel data in RGB or RGBA format. More...
 
 RasterImage (byte[] data, int width, int height, PixelFormats pixelFormat, bool interpolate)
 Creates a new RasterImage instance copying the specified pixel data. More...
 
void ClearPNGCache ()
 Disposes the PNGStream. Also useful if is is necessary to regenerate it, e.g. because the underlying image pixel data has changed. More...
 
void Dispose ()
 

Properties

IntPtr ImageDataAddress [get]
 The memory address of the image pixel data. More...
 
IDisposable DataHolder [get]
 An IDisposable that will be disposed when the image is disposed. More...
 
string Id [get]
 A univocal identifier for this image. More...
 
bool HasAlpha [get]
 Determines whether the image has an alpha channel. More...
 
int Width [get]
 The width in pixels of the image. More...
 
int Height [get]
 The height in pixels of the image. More...
 
bool Interpolate [get]
 Determines whether the image should be interpolated when it is resized. More...
 
MemoryStream PNGStream [get]
 Contains a representation of the image in PNG format. Generated at the first access and cached until the image is disposed. More...
 

Detailed Description

Represents a raster image, created from raw pixel data. Consider using the derived classes included in the NuGet package "VectSharp.MuPDFUtils" if you need to load a raster image from a file or a Stream.

Definition at line 98 of file RasterImage.cs.

Constructor & Destructor Documentation

◆ RasterImage() [1/3]

VectSharp.RasterImage.RasterImage ( IntPtr  pixelData,
int  width,
int  height,
bool  hasAlpha,
bool  interpolate 
)

Creates a new RasterImage instance from the specified pixel data in RGB or RGBA format.

Parameters
pixelDataThe address of the image pixel data in RGB or RGBA format.
widthThe width in pixels of the image.
heightThe height in pixels of the image.
hasAlphatrue if the image is in RGBA format, false if it is in RGB format.
interpolateWhether the image should be interpolated when it is resized.

Definition at line 170 of file RasterImage.cs.

◆ RasterImage() [2/3]

VectSharp.RasterImage.RasterImage ( ref DisposableIntPtr  pixelData,
int  width,
int  height,
bool  hasAlpha,
bool  interpolate 
)

Creates a new RasterImage instance from the specified pixel data in RGB or RGBA format.

Parameters
pixelDataThe address of the image pixel data in RGB or RGBA format wrapped in a DisposableIntPtr. The RasterImage will take ownership of this memory.
widthThe width in pixels of the image.
heightThe height in pixels of the image.
hasAlphatrue if the image is in RGBA format, false if it is in RGB format.
interpolateWhether the image should be interpolated when it is resized.

Definition at line 188 of file RasterImage.cs.

◆ RasterImage() [3/3]

VectSharp.RasterImage.RasterImage ( byte[]  data,
int  width,
int  height,
PixelFormats  pixelFormat,
bool  interpolate 
)

Creates a new RasterImage instance copying the specified pixel data.

Parameters
dataThe image pixel data that will be copied.
widthThe width in pixels of the image.
heightThe height in pixels of the image.
pixelFormatThe format of the pixel data.
interpolateWhether the image should be interpolated when it is resized.

Definition at line 207 of file RasterImage.cs.

Member Function Documentation

◆ ClearPNGCache()

void VectSharp.RasterImage.ClearPNGCache ( )

Disposes the PNGStream. Also useful if is is necessary to regenerate it, e.g. because the underlying image pixel data has changed.

Definition at line 261 of file RasterImage.cs.

◆ Dispose()

void VectSharp.RasterImage.Dispose ( )

Definition at line 295 of file RasterImage.cs.

Property Documentation

◆ DataHolder

IDisposable VectSharp.RasterImage.DataHolder
get

An IDisposable that will be disposed when the image is disposed.

Definition at line 108 of file RasterImage.cs.

◆ HasAlpha

bool VectSharp.RasterImage.HasAlpha
get

Determines whether the image has an alpha channel.

Definition at line 118 of file RasterImage.cs.

◆ Height

int VectSharp.RasterImage.Height
get

The height in pixels of the image.

Definition at line 128 of file RasterImage.cs.

◆ Id

string VectSharp.RasterImage.Id
get

A univocal identifier for this image.

Definition at line 113 of file RasterImage.cs.

◆ ImageDataAddress

IntPtr VectSharp.RasterImage.ImageDataAddress
get

The memory address of the image pixel data.

Definition at line 103 of file RasterImage.cs.

◆ Interpolate

bool VectSharp.RasterImage.Interpolate
get

Determines whether the image should be interpolated when it is resized.

Definition at line 133 of file RasterImage.cs.

◆ PNGStream

MemoryStream VectSharp.RasterImage.PNGStream
get

Contains a representation of the image in PNG format. Generated at the first access and cached until the image is disposed.

Definition at line 140 of file RasterImage.cs.

◆ Width

int VectSharp.RasterImage.Width
get

The width in pixels of the image.

Definition at line 123 of file RasterImage.cs.


The documentation for this class was generated from the following file: