C# Class CSharpImageLibrary.ImageEngineImage

Represents an image. Can use Windows codecs if available.
Inheritance: IDisposable
Afficher le fichier Open project: KFreon/CSharpImageLibrary Class Usage Examples

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
GetWPFBitmap ( MipMap mip, int maxDimension, bool ShowAlpha ) : System.Windows.Media.Imaging.BitmapSource

Method Details

Dispose() public méthode

Releases resources used by mipmap MemoryStreams.
public Dispose ( ) : void
Résultat void

GetWPFBitmap() public méthode

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.
Résultat System.Windows.Media.Imaging.BitmapSource

ImageEngineImage() public méthode

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.
Résultat CSharpImageLibrary.DDS

ImageEngineImage() public méthode

Creates image from mipmap.
public ImageEngineImage ( MipMap mip ) : CSharpImageLibrary.DDS
mip MipMap Mipmap to use as source.
Résultat CSharpImageLibrary.DDS

ImageEngineImage() public méthode

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.
Résultat CSharpImageLibrary.DDS

ImageEngineImage() public méthode

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.
Résultat CSharpImageLibrary.DDS

Load() public méthode

public Load ( Stream stream, int maxDimension ) : void
stream Stream
maxDimension int
Résultat void

Resize() public méthode

Scales top mipmap and DESTROYS ALL OTHERS.
public Resize ( double scale ) : void
scale double Scaling factor.
Résultat void

Resize() public méthode

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.
Résultat void

Save() public méthode

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.
Résultat System.Threading.Tasks.Task

Save() public méthode

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.
Résultat byte[]

Save() public méthode

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.
Résultat void

ToString() public méthode

Gets string representation of ImageEngineImage.
public ToString ( ) : string
Résultat string