C# Class 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.
Inheritance: DisposableObject
Afficher le fichier Open project: mono-soc-2011/axiom Class Usage Examples

Protected Properties

Свойство Type Description
bufPtr System.IntPtr
buffer byte[]
bufferPinnedHandle System.Runtime.InteropServices.GCHandle
depth int
flags ImageFlags
format PixelFormat
height int
numMipMaps int
size int
width int

Méthodes publiques

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

Méthodes protégées

Méthode Description
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 ); }

Method Details

ApplyGamma() public static méthode

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

ApplyGamma() public static méthode

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

CalculateSize() public static méthode

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
Résultat int

CropImage() public méthode

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
Résultat Image

FlipAroundX() public méthode

Flips this image around the X axis. This will invalidate any
public FlipAroundX ( ) : void
Résultat void

FromDynamicImage() public méthode

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

FromDynamicImage() public méthode

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

FromDynamicImage() public méthode

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
Résultat Image

FromFile() public static méthode

Loads an image file from the file system.
public static FromFile ( string fileName ) : Image
fileName string Full path to the image file on disk.
Résultat Image

FromRawStream() public static méthode

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

FromRawStream() public static méthode

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

FromStream() public static méthode

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

GetColorAt() public méthode

public GetColorAt ( int x, int y, int z ) : ColorEx
x int
y int
z int
Résultat Axiom.Core.ColorEx

GetPixelBox() public méthode

Get a PixelBox encapsulating the image data of a mipmap
public GetPixelBox ( int face, int mipmap ) : PixelBox
face int
mipmap int
Résultat PixelBox

HasFlag() public méthode

Checks if the specified flag is set on this image.
public HasFlag ( ImageFlags flag ) : bool
flag ImageFlags The flag to check for.
Résultat bool

Image() public méthode

public Image ( ) : System
Résultat System

Resize() public méthode

Resize a 2D image, applying the appropriate filter.
public Resize ( int width, int height ) : void
width int
height int
Résultat void

Resize() public méthode

Resize a 2D image, applying the appropriate filter.
public Resize ( int width, int height, ImageFilter filter ) : void
width int
height int
filter ImageFilter
Résultat void

Save() public méthode

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

Scale() public static méthode

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

Scale() public static méthode

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

SetBuffer() protected méthode

protected SetBuffer ( byte newBuffer ) : void
newBuffer byte
Résultat void

dispose() protected méthode

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

Property Details

bufPtr protected_oe property

This is the pointer to the contents of buffer.
protected IntPtr,System bufPtr
Résultat System.IntPtr

buffer protected_oe property

Byte array containing the image data.
protected byte[] buffer
Résultat byte[]

bufferPinnedHandle protected_oe property

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
Résultat System.Runtime.InteropServices.GCHandle

depth protected_oe property

Depth of the image
protected int depth
Résultat int

flags protected_oe property

Additional features on this image.
protected ImageFlags flags
Résultat ImageFlags

format protected_oe property

Image format.
protected PixelFormat format
Résultat PixelFormat

height protected_oe property

Width of the image (in pixels).
protected int height
Résultat int

numMipMaps protected_oe property

Number of mip maps in this image.
protected int numMipMaps
Résultat int

size protected_oe property

Size of the image buffer.
protected int size
Résultat int

width protected_oe property

Width of the image (in pixels).
protected int width
Résultat int