C# Class Axiom.Media.PixelConverter

A class to convert/copy pixels of the same or different formats
Datei anzeigen Open project: WolfgangSt/axiom Class Usage Examples

Protected Properties

Property Type Description
IndexedPixelFormats Axiom.Media.PixelFormatDescription[]
UnindexedPixelFormats Axiom.Media.PixelFormatDescription[]

Public Methods

Method Description
BulkPixelConversion ( IntPtr srcBytes, int srcOffset, PixelFormat srcFormat, IntPtr dstBytes, int dstOffset, PixelFormat dstFormat, int count ) : void

Convert consecutive pixels from one format to another. No dithering or filtering is being done. Converting from RGB to luminance takes the R channel. In case the source and destination format match, just a copy is done.

BulkPixelConversion ( PixelBox src, PixelBox dst ) : void

Convert pixels from one format to another. No dithering or filtering is being done. Converting from RGB to luminance takes the R channel.

The source and destination boxes must have the same dimensions. In case the source and destination format match, a plain copy is done.

GetDescriptionFor ( PixelFormat format ) : Axiom.Media.PixelFormatDescription
Initialize ( ) : void
PackColor ( ColorEx color, PixelFormat format, IntPtr dest ) : void

Pack a color value to memory

PackColor ( float r, float g, float b, float a, PixelFormat format, IntPtr dest ) : void

Pack a color value to memory

PackColor ( uint r, uint g, uint b, uint a, PixelFormat format, IntPtr dest ) : void

Pack a color value to memory

UnpackColor ( PixelFormat pf, IntPtr src ) : ColorEx

Unpack a color value from memory

UnpackColor ( byte &r, byte &g, byte &b, byte &a, PixelFormat pf, IntPtr src ) : void

Unpack a color value from memory

This function returns the color components in 8 bit precision, this will lose precision when coming from A2R10G10B10 or floating point formats.

UnpackColor ( float &r, float &g, float &b, float &a, PixelFormat pf, IntPtr src ) : void

Unpack a color value from memory

Method Details

BulkPixelConversion() public static method

Convert consecutive pixels from one format to another. No dithering or filtering is being done. Converting from RGB to luminance takes the R channel. In case the source and destination format match, just a copy is done.
public static BulkPixelConversion ( IntPtr srcBytes, int srcOffset, PixelFormat srcFormat, IntPtr dstBytes, int dstOffset, PixelFormat dstFormat, int count ) : void
srcBytes System.IntPtr Pointer to source region
srcOffset int
srcFormat PixelFormat Pixel format of source region
dstBytes System.IntPtr Pointer to destination region
dstOffset int
dstFormat PixelFormat Pixel format of destination region
count int
return void

BulkPixelConversion() public static method

Convert pixels from one format to another. No dithering or filtering is being done. Converting from RGB to luminance takes the R channel.
The source and destination boxes must have the same dimensions. In case the source and destination format match, a plain copy is done.
public static BulkPixelConversion ( PixelBox src, PixelBox dst ) : void
src PixelBox PixelBox containing the source pixels, pitches and format
dst PixelBox PixelBox containing the destination pixels, pitches and format
return void

GetDescriptionFor() public static method

public static GetDescriptionFor ( PixelFormat format ) : Axiom.Media.PixelFormatDescription
format PixelFormat
return Axiom.Media.PixelFormatDescription

Initialize() public static method

public static Initialize ( ) : void
return void

PackColor() public static method

Pack a color value to memory
public static PackColor ( ColorEx color, PixelFormat format, IntPtr dest ) : void
color Axiom.Core.ColorEx The color
format PixelFormat Pixel format in which to write the color
dest System.IntPtr Destination memory location
return void

PackColor() public static method

Pack a color value to memory
public static PackColor ( float r, float g, float b, float a, PixelFormat format, IntPtr dest ) : void
r float /// The four color components, range 0.0f to 1.0f /// (an exception to this case exists for floating point pixel /// formats, which don't clamp to 0.0f..1.0f) ///
g float /// The four color components, range 0.0f to 1.0f /// (an exception to this case exists for floating point pixel /// formats, which don't clamp to 0.0f..1.0f) ///
b float /// The four color components, range 0.0f to 1.0f /// (an exception to this case exists for floating point pixel /// formats, which don't clamp to 0.0f..1.0f) ///
a float /// The four color components, range 0.0f to 1.0f /// (an exception to this case exists for floating point pixel /// formats, which don't clamp to 0.0f..1.0f) ///
format PixelFormat Pixelformat in which to write the color
dest System.IntPtr Destination memory location
return void

PackColor() public static method

Pack a color value to memory
public static PackColor ( uint r, uint g, uint b, uint a, PixelFormat format, IntPtr dest ) : void
r uint Red component, range 0x00 to 0xFF
g uint Green component, range 0x00 to 0xFF
b uint Blue component, range 0x00 to 0xFF
a uint Alpha component, range 0x00 to 0xFF
format PixelFormat Pixelformat in which to write the color
dest System.IntPtr Destination memory location
return void

UnpackColor() public static method

Unpack a color value from memory
public static UnpackColor ( PixelFormat pf, IntPtr src ) : ColorEx
pf PixelFormat Pixelformat in which to read the color
src System.IntPtr Source memory location
return Axiom.Core.ColorEx

UnpackColor() public static method

Unpack a color value from memory
This function returns the color components in 8 bit precision, this will lose precision when coming from A2R10G10B10 or floating point formats.
public static UnpackColor ( byte &r, byte &g, byte &b, byte &a, PixelFormat pf, IntPtr src ) : void
r byte The color is returned here (as byte)
g byte The color is returned here (as byte)
b byte The color is returned here (as byte)
a byte The color is returned here (as byte)
pf PixelFormat Pixelformat in which to read the color
src System.IntPtr Source memory location
return void

UnpackColor() public static method

Unpack a color value from memory
public static UnpackColor ( float &r, float &g, float &b, float &a, PixelFormat pf, IntPtr src ) : void
r float The color is returned here (as float)
g float The color is returned here (as float)
b float The color is returned here (as float)
a float The color is returned here (as float)
pf PixelFormat Pixelformat in which to read the color
src System.IntPtr Source memory location
return void

Property Details

IndexedPixelFormats protected_oe static_oe property

protected static PixelFormatDescription[],Axiom.Media IndexedPixelFormats
return Axiom.Media.PixelFormatDescription[]

UnindexedPixelFormats protected_oe static_oe property

Pixel format database
protected static PixelFormatDescription[],Axiom.Media UnindexedPixelFormats
return Axiom.Media.PixelFormatDescription[]