C# Класс CSharpImageLibrary.ImageEngineImage

Represents an image. Can use Windows codecs if available.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Dispose ( ) : void

Releases resources used by mipmap MemoryStreams.

GetWPFBitmap ( int maxDimension, bool ShowAlpha = false, int mipIndex ) : System.Windows.Media.Imaging.BitmapSource

Creates a WPF Bitmap from largest mipmap. Does NOT require that image remains alive.

ImageEngineImage ( MemoryStream stream, int maxDimension ) : CSharpImageLibrary.DDS

Creates an image supporting many formats including DDS.

ImageEngineImage ( MipMap mip ) : CSharpImageLibrary.DDS

Creates image from mipmap.

ImageEngineImage ( byte imageData, int maxDimension ) : CSharpImageLibrary.DDS

Creates an image supporting many formats including DDS.

ImageEngineImage ( string path, int maxDimension ) : CSharpImageLibrary.DDS

Creates an image supporting many formats including DDS.

Load ( Stream stream, int maxDimension ) : void
Resize ( double scale ) : void

Scales top mipmap and DESTROYS ALL OTHERS.

Resize ( int DesiredDimension ) : void

Resizes image. If single mip, scales to DesiredDimension. If multiple mips, finds closest mip and scales it (if required). DESTROYS ALL OTHER MIPS.

Save ( string destination, ImageEngineFormat format, MipHandling GenerateMips, int desiredMaxDimension, int mipToSave, bool removeAlpha = true, List customMasks = null ) : System.Threading.Tasks.Task

Saves image in specified format to file. If file exists, it will be overwritten.

Save ( ImageEngineFormat format, MipHandling GenerateMips, int desiredMaxDimension, int mipToSave, bool removeAlpha = true, List customMasks = null ) : byte[]

Saves fully formatted image in specified format to byte array.

Save ( Stream destination, ImageEngineFormat format, MipHandling GenerateMips, int desiredMaxDimension, int mipToSave, bool removeAlpha = true, List customMasks = null ) : void

Saves image in specified format to stream. Stream position not reset before or after.

ToString ( ) : string

Gets string representation of ImageEngineImage.

Приватные методы

Метод Описание
GetWPFBitmap ( MipMap mip, int maxDimension, bool ShowAlpha ) : System.Windows.Media.Imaging.BitmapSource

Описание методов

Dispose() публичный Метод

Releases resources used by mipmap MemoryStreams.
public Dispose ( ) : void
Результат void

GetWPFBitmap() публичный Метод

Creates a WPF Bitmap from largest mipmap. Does NOT require that image remains alive.
public GetWPFBitmap ( int maxDimension, bool ShowAlpha = false, int mipIndex ) : System.Windows.Media.Imaging.BitmapSource
maxDimension int Resizes image or uses a mipmap if available. Overrides mipIndex if specified.
ShowAlpha bool True = flattens alpha, directly affecting RGB.
mipIndex int Index of mipmap to retrieve. Overridden by maxDimension if it's specified.
Результат System.Windows.Media.Imaging.BitmapSource

ImageEngineImage() публичный Метод

Creates an image supporting many formats including DDS.
public ImageEngineImage ( MemoryStream stream, int maxDimension ) : CSharpImageLibrary.DDS
stream System.IO.MemoryStream Stream containing image.
maxDimension int Max dimension of created image. Useful for mipmapped images, otherwise resized.
Результат CSharpImageLibrary.DDS

ImageEngineImage() публичный Метод

Creates image from mipmap.
public ImageEngineImage ( MipMap mip ) : CSharpImageLibrary.DDS
mip MipMap Mipmap to use as source.
Результат CSharpImageLibrary.DDS

ImageEngineImage() публичный Метод

Creates an image supporting many formats including DDS.
public ImageEngineImage ( byte imageData, int maxDimension ) : CSharpImageLibrary.DDS
imageData byte Fully formatted image data, not just pixels.
maxDimension int Max dimension of created image. Useful for mipmapped images, otherwise resized.
Результат CSharpImageLibrary.DDS

ImageEngineImage() публичный Метод

Creates an image supporting many formats including DDS.
public ImageEngineImage ( string path, int maxDimension ) : CSharpImageLibrary.DDS
path string Path to image.
maxDimension int Max dimension of created image. Useful for mipmapped images, otherwise resized.
Результат CSharpImageLibrary.DDS

Load() публичный Метод

public Load ( Stream stream, int maxDimension ) : void
stream Stream
maxDimension int
Результат void

Resize() публичный Метод

Scales top mipmap and DESTROYS ALL OTHERS.
public Resize ( double scale ) : void
scale double Scaling factor.
Результат void

Resize() публичный Метод

Resizes image. If single mip, scales to DesiredDimension. If multiple mips, finds closest mip and scales it (if required). DESTROYS ALL OTHER MIPS.
public Resize ( int DesiredDimension ) : void
DesiredDimension int Desired size of images largest dimension.
Результат void

Save() публичный Метод

Saves image in specified format to file. If file exists, it will be overwritten.
public Save ( string destination, ImageEngineFormat format, MipHandling GenerateMips, int desiredMaxDimension, int mipToSave, bool removeAlpha = true, List customMasks = null ) : System.Threading.Tasks.Task
destination string File to save to.
format ImageEngineFormat Desired image format.
GenerateMips MipHandling Determines how mipmaps are handled during saving.
desiredMaxDimension int Maximum size for saved image. Resizes if required, but uses mipmaps if available.
mipToSave int Index of mipmap to save as single image.
removeAlpha bool True = Alpha removed. False = Uses threshold value and alpha values to mask RGB FOR DXT1 ONLY, otherwise removes completely.
customMasks List Custom user defined masks for colours.
Результат System.Threading.Tasks.Task

Save() публичный Метод

Saves fully formatted image in specified format to byte array.
public Save ( ImageEngineFormat format, MipHandling GenerateMips, int desiredMaxDimension, int mipToSave, bool removeAlpha = true, List customMasks = null ) : byte[]
format ImageEngineFormat Format to save as.
GenerateMips MipHandling Determines how mipmaps are handled during saving.
desiredMaxDimension int Maximum size for saved image. Resizes if required, but uses mipmaps if available.
mipToSave int Index of mipmap to save directly.
removeAlpha bool True = Alpha removed. False = Uses threshold value and alpha values to mask RGB FOR DXT1, otherwise completely removed.
customMasks List Custom user defined masks for colours.
Результат byte[]

Save() публичный Метод

Saves image in specified format to stream. Stream position not reset before or after.
public Save ( Stream destination, ImageEngineFormat format, MipHandling GenerateMips, int desiredMaxDimension, int mipToSave, bool removeAlpha = true, List customMasks = null ) : void
destination Stream Stream to write to at current position.
format ImageEngineFormat Format to save to.
GenerateMips MipHandling Determines how mipmaps are handled during saving.
desiredMaxDimension int Maximum dimension of saved image. Keeps aspect.
mipToSave int Specifies a mipmap to save within the whole.
removeAlpha bool True = removes alpha. False = Uses threshold value and alpha values to mask RGB FOR DXT1 ONLY, otherwise removes completely.
customMasks List Custom user defined masks for DDS colours.
Результат void

ToString() публичный Метод

Gets string representation of ImageEngineImage.
public ToString ( ) : string
Результат string