C# Класс Axiom.Media.Image

Class representing an image file.
The Image class usually holds uncompressed image data and is the only object that can be loaded in a texture. Image objects handle image data decoding themselves by the means of locating the correct ICodec implementation for each data type.
Наследование: DisposableObject
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
bufPtr System.IntPtr
buffer byte[]
bufferPinnedHandle System.Runtime.InteropServices.GCHandle
depth int
flags ImageFlags
format PixelFormat
height int
numMipMaps int
size int
width int

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

Метод Описание
ApplyGamma ( IntPtr bufPtr, float gamma, int size, int bpp ) : void

Variant of ApplyGamma that operates on an unmanaged chunk of memory

ApplyGamma ( byte buffer, float gamma, int size, int bpp ) : void

Performs gamma adjustment on this image.

Basic algo taken from Titan Engine, copyright (c) 2000 Ignacio Castano Iguado.

CalculateSize ( int mipmaps, int faces, int width, int height, int depth, PixelFormat format ) : int
CropImage ( Image source, uint offsetX, uint offsetY, int width, int height ) : Image

Little utility function that crops an image (Doesn't alter the source image, returns a cropped representation)

FlipAroundX ( ) : void

Flips this image around the X axis. This will invalidate any

FromDynamicImage ( byte buffer, int width, int height, PixelFormat format ) : Image

Loads raw image data from a byte array.

FromDynamicImage ( byte buffer, int width, int height, int depth, PixelFormat format ) : Image

Loads raw image data from a byte array.

FromDynamicImage ( byte buffer, int width, int height, int depth, PixelFormat format, bool autoDelete, int numFaces, int numMipMaps ) : Image
FromFile ( string fileName ) : Image

Loads an image file from the file system.

FromRawStream ( Stream stream, int width, int height, PixelFormat format ) : Image

Loads raw image data from memory.

FromRawStream ( Stream stream, int width, int height, int depth, PixelFormat format ) : Image

Loads raw image data from memory.

FromStream ( Stream stream, string type ) : Image

Loads an image from a stream.

This method allows loading an image from a stream, which is helpful for when images are being decompressed from an archive into a stream, which needs to be loaded as is.

GetColorAt ( int x, int y, int z ) : ColorEx
GetPixelBox ( int face, int mipmap ) : PixelBox

Get a PixelBox encapsulating the image data of a mipmap

HasFlag ( ImageFlags flag ) : bool

Checks if the specified flag is set on this image.

Image ( ) : System
Resize ( int width, int height ) : void

Resize a 2D image, applying the appropriate filter.

Resize ( int width, int height, ImageFilter filter ) : void

Resize a 2D image, applying the appropriate filter.

Save ( String filename ) : void

Saves the Image as a file

The codec used to save the file is determined by the extension of the filename passed in Invalid or unrecognized extensions will throw an exception.

Scale ( PixelBox src, PixelBox dst ) : void

Scale a 1D, 2D or 3D image volume.

This function can do pixel format conversion in the process. dst and src can point to the same PixelBox object without any problem

Scale ( PixelBox src, PixelBox scaled, ImageFilter filter ) : void

Scale a 1D, 2D or 3D image volume.

This function can do pixel format conversion in the process. dst and src can point to the same PixelBox object without any problem

Защищенные методы

Метод Описание
SetBuffer ( byte newBuffer ) : void
dispose ( bool disposeManagedResources ) : void

Class level dispose method

When implementing this method in an inherited class the following template should be used; protected override void dispose( bool disposeManagedResources ) { if ( !isDisposed ) { if ( disposeManagedResources ) { // Dispose managed resources. } // There are no unmanaged resources to release, but // if we add them, they need to be released here. } isDisposed = true; // If it is available, make the call to the // base class's Dispose(Boolean) method base.dispose( disposeManagedResources ); }

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

ApplyGamma() публичный статический метод

Variant of ApplyGamma that operates on an unmanaged chunk of memory
public static ApplyGamma ( IntPtr bufPtr, float gamma, int size, int bpp ) : void
bufPtr System.IntPtr
gamma float
size int
bpp int
Результат void

ApplyGamma() публичный статический метод

Performs gamma adjustment on this image.
Basic algo taken from Titan Engine, copyright (c) 2000 Ignacio Castano Iguado.
public static ApplyGamma ( byte buffer, float gamma, int size, int bpp ) : void
buffer byte
gamma float
size int
bpp int
Результат void

CalculateSize() публичный статический метод

public static CalculateSize ( int mipmaps, int faces, int width, int height, int depth, PixelFormat format ) : int
mipmaps int
faces int
width int
height int
depth int
format PixelFormat
Результат int

CropImage() публичный метод

Little utility function that crops an image (Doesn't alter the source image, returns a cropped representation)
public CropImage ( Image source, uint offsetX, uint offsetY, int width, int height ) : Image
source Image The source image
offsetX uint The X offset from the origin
offsetY uint The Y offset from the origin
width int The width to crop to
height int The height to crop to
Результат Image

FlipAroundX() публичный метод

Flips this image around the X axis. This will invalidate any
public FlipAroundX ( ) : void
Результат void

FromDynamicImage() публичный метод

Loads raw image data from a byte array.
public FromDynamicImage ( byte buffer, int width, int height, PixelFormat format ) : Image
buffer byte Raw image buffer.
width int Width of this image data (in pixels).
height int Height of this image data (in pixels).
format PixelFormat Pixel format used in this texture.
Результат Image

FromDynamicImage() публичный метод

Loads raw image data from a byte array.
public FromDynamicImage ( byte buffer, int width, int height, int depth, PixelFormat format ) : Image
buffer byte Raw image buffer.
width int Width of this image data (in pixels).
height int Height of this image data (in pixels).
depth int
format PixelFormat Pixel format used in this texture.
Результат Image

FromDynamicImage() публичный метод

public FromDynamicImage ( byte buffer, int width, int height, int depth, PixelFormat format, bool autoDelete, int numFaces, int numMipMaps ) : Image
buffer byte
width int
height int
depth int
format PixelFormat
autoDelete bool
numFaces int
numMipMaps int
Результат Image

FromFile() публичный статический метод

Loads an image file from the file system.
public static FromFile ( string fileName ) : Image
fileName string Full path to the image file on disk.
Результат Image

FromRawStream() публичный статический метод

Loads raw image data from memory.
public static FromRawStream ( Stream stream, int width, int height, PixelFormat format ) : Image
stream Stream Stream containing the raw image data.
width int Width of this image data (in pixels).
height int Height of this image data (in pixels).
format PixelFormat Pixel format used in this texture.
Результат Image

FromRawStream() публичный статический метод

Loads raw image data from memory.
public static FromRawStream ( Stream stream, int width, int height, int depth, PixelFormat format ) : Image
stream Stream Stream containing the raw image data.
width int Width of this image data (in pixels).
height int Height of this image data (in pixels).
depth int
format PixelFormat Pixel format used in this texture.
Результат Image

FromStream() публичный статический метод

Loads an image from a stream.
This method allows loading an image from a stream, which is helpful for when images are being decompressed from an archive into a stream, which needs to be loaded as is.
public static FromStream ( Stream stream, string type ) : Image
stream Stream Stream serving as the data source.
type string /// Type (i.e. file format) of image. Used to decide which image decompression codec to use. ///
Результат Image

GetColorAt() публичный метод

public GetColorAt ( int x, int y, int z ) : ColorEx
x int
y int
z int
Результат Axiom.Core.ColorEx

GetPixelBox() публичный метод

Get a PixelBox encapsulating the image data of a mipmap
public GetPixelBox ( int face, int mipmap ) : PixelBox
face int
mipmap int
Результат PixelBox

HasFlag() публичный метод

Checks if the specified flag is set on this image.
public HasFlag ( ImageFlags flag ) : bool
flag ImageFlags The flag to check for.
Результат bool

Image() публичный метод

public Image ( ) : System
Результат System

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

Resize a 2D image, applying the appropriate filter.
public Resize ( int width, int height ) : void
width int
height int
Результат void

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

Resize a 2D image, applying the appropriate filter.
public Resize ( int width, int height, ImageFilter filter ) : void
width int
height int
filter ImageFilter
Результат void

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

Saves the Image as a file
The codec used to save the file is determined by the extension of the filename passed in Invalid or unrecognized extensions will throw an exception.
public Save ( String filename ) : void
filename String Filename to save as
Результат void

Scale() публичный статический метод

Scale a 1D, 2D or 3D image volume.
This function can do pixel format conversion in the process. dst and src can point to the same PixelBox object without any problem
public static Scale ( PixelBox src, PixelBox dst ) : void
src PixelBox PixelBox containing the source pointer, dimensions and format
dst PixelBox PixelBox containing the destination pointer, dimensions and format
Результат void

Scale() публичный статический метод

Scale a 1D, 2D or 3D image volume.
This function can do pixel format conversion in the process. dst and src can point to the same PixelBox object without any problem
public static Scale ( PixelBox src, PixelBox scaled, ImageFilter filter ) : void
src PixelBox PixelBox containing the source pointer, dimensions and format
scaled PixelBox PixelBox containing the destination pointer, dimensions and format
filter ImageFilter Which filter to use
Результат void

SetBuffer() защищенный метод

protected SetBuffer ( byte newBuffer ) : void
newBuffer byte
Результат void

dispose() защищенный метод

Class level dispose method
When implementing this method in an inherited class the following template should be used; protected override void dispose( bool disposeManagedResources ) { if ( !isDisposed ) { if ( disposeManagedResources ) { // Dispose managed resources. } // There are no unmanaged resources to release, but // if we add them, they need to be released here. } isDisposed = true; // If it is available, make the call to the // base class's Dispose(Boolean) method base.dispose( disposeManagedResources ); }
protected dispose ( bool disposeManagedResources ) : void
disposeManagedResources bool True if Unmanaged resources should be released.
Результат void

Описание свойств

bufPtr защищенное свойство

This is the pointer to the contents of buffer.
protected IntPtr,System bufPtr
Результат System.IntPtr

buffer защищенное свойство

Byte array containing the image data.
protected byte[] buffer
Результат byte[]

bufferPinnedHandle защищенное свойство

This allows me to pin the buffer, so that I can return PixelBox objects representing subsets of this image. Since the PixelBox does not own the data, and has an IntPtr, I need to pin the internal buffer here.
protected GCHandle,System.Runtime.InteropServices bufferPinnedHandle
Результат System.Runtime.InteropServices.GCHandle

depth защищенное свойство

Depth of the image
protected int depth
Результат int

flags защищенное свойство

Additional features on this image.
protected ImageFlags flags
Результат ImageFlags

format защищенное свойство

Image format.
protected PixelFormat format
Результат PixelFormat

height защищенное свойство

Width of the image (in pixels).
protected int height
Результат int

numMipMaps защищенное свойство

Number of mip maps in this image.
protected int numMipMaps
Результат int

size защищенное свойство

Size of the image buffer.
protected int size
Результат int

width защищенное свойство

Width of the image (in pixels).
protected int width
Результат int