C# Class CSharpImageLibrary.ImageFormats

Provides format functionality
Afficher le fichier Open project: KFreon/CSharpImageLibrary Class Usage Examples

Méthodes publiques

Свойство Type Description
SaveUnsupported List

Méthodes publiques

Méthode Description
DetermineImageType ( Stream imgData ) : SupportedExtensions

Determines image type via headers. Keeps stream position.

FindFormatInString ( string stringWithFormatInIt ) : ImageEngineFormat

Searches for a format within a string. Good for automatic file naming.

GetBlockSize ( ImageEngineFormat format ) : int

Gets block size of DDS format. Number of channels if not compressed. 1 if not a DDS format.

GetCompressedSize ( int numMipmaps, ImageEngineFormat format, int width, int height ) : int

Calculates the compressed size of an image with given parameters.

GetExtensionOfFormat ( ImageEngineFormat format ) : string

Gets file extension of supported surface formats. Doesn't include preceding dot.

GetSupportedExtensions ( bool addDot = false ) : List

Get list of supported extensions in lower case.

GetSupportedExtensionsDescriptions ( ) : List

Get descriptions of supported images. Generally the description as would be seen in a SaveFileDialog.

GetSupportedExtensionsForDialogBox ( ) : List

Get list of filter strings for dialog boxes of the Supported Images.

GetSupportedExtensionsForDialogBoxAsString ( ) : string

Gets list of filter strings for dialog boxes already formatted as string.

GetUncompressedSize ( int topWidth, int topHeight, int numChannels, bool inclMips ) : int

Gets uncompressed size of image with mipmaps given dimensions and number of channels. Assume 8 bits per channel.

IsAlphaPresent ( System.Windows.Media.PixelFormat format ) : bool

Determines if alpha channel COULD be present in given format.

IsBlockCompressed ( ImageEngineFormat format ) : bool

Determines if format is a block compressed format.

IsExtensionSupported ( string filePath, List supported = null ) : bool

Determines if file has a supported extension.

IsFormatMippable ( ImageEngineFormat format ) : bool

Determines if given format supports mipmapping.

MaxNumberOfChannels ( ImageEngineFormat format ) : int

Gets maximum number of channels a format can contain. NOTE: This likely isn't actually the max number. i.e. None exceed four, but some are only one or two channels.

ParseExtension ( string extension ) : SupportedExtensions

Gets file extension from string of extension.

Method Details

DetermineImageType() public static méthode

Determines image type via headers. Keeps stream position.
public static DetermineImageType ( Stream imgData ) : SupportedExtensions
imgData Stream Image data, incl header.
Résultat SupportedExtensions

FindFormatInString() public static méthode

Searches for a format within a string. Good for automatic file naming.
public static FindFormatInString ( string stringWithFormatInIt ) : ImageEngineFormat
stringWithFormatInIt string String containing format somewhere in it.
Résultat ImageEngineFormat

GetBlockSize() public static méthode

Gets block size of DDS format. Number of channels if not compressed. 1 if not a DDS format.
public static GetBlockSize ( ImageEngineFormat format ) : int
format ImageEngineFormat DDS format to test.
Résultat int

GetCompressedSize() public static méthode

Calculates the compressed size of an image with given parameters.
public static GetCompressedSize ( int numMipmaps, ImageEngineFormat format, int width, int height ) : int
numMipmaps int Number of mipmaps in image. JPG etc only have 1.
format ImageEngineFormat Format of image.
width int Width of image (top mip if mip-able)
height int Height of image (top mip if mip-able)
Résultat int

GetExtensionOfFormat() public static méthode

Gets file extension of supported surface formats. Doesn't include preceding dot.
public static GetExtensionOfFormat ( ImageEngineFormat format ) : string
format ImageEngineFormat Format to get file extension for.
Résultat string

GetSupportedExtensions() public static méthode

Get list of supported extensions in lower case.
public static GetSupportedExtensions ( bool addDot = false ) : List
addDot bool Adds preceeding dot to be same as Path.GetExtension.
Résultat List

GetSupportedExtensionsDescriptions() public static méthode

Get descriptions of supported images. Generally the description as would be seen in a SaveFileDialog.
public static GetSupportedExtensionsDescriptions ( ) : List
Résultat List

GetSupportedExtensionsForDialogBox() public static méthode

Get list of filter strings for dialog boxes of the Supported Images.
public static GetSupportedExtensionsForDialogBox ( ) : List
Résultat List

GetSupportedExtensionsForDialogBoxAsString() public static méthode

Gets list of filter strings for dialog boxes already formatted as string.
public static GetSupportedExtensionsForDialogBoxAsString ( ) : string
Résultat string

GetUncompressedSize() public static méthode

Gets uncompressed size of image with mipmaps given dimensions and number of channels. Assume 8 bits per channel.
public static GetUncompressedSize ( int topWidth, int topHeight, int numChannels, bool inclMips ) : int
topWidth int Width of top mipmap.
topHeight int Height of top mipmap.
numChannels int Number of channels in image.
inclMips bool Include size of mipmaps.
Résultat int

IsAlphaPresent() public static méthode

Determines if alpha channel COULD be present in given format.
public static IsAlphaPresent ( System.Windows.Media.PixelFormat format ) : bool
format System.Windows.Media.PixelFormat Format to check alpha in.
Résultat bool

IsBlockCompressed() public static méthode

Determines if format is a block compressed format.
public static IsBlockCompressed ( ImageEngineFormat format ) : bool
format ImageEngineFormat DDS Surface Format.
Résultat bool

IsExtensionSupported() public static méthode

Determines if file has a supported extension.
public static IsExtensionSupported ( string filePath, List supported = null ) : bool
filePath string Path of file to to check.
supported List Optionally list of supported extensions. Good if looping and can initialise supported and pass into this every loop.
Résultat bool

IsFormatMippable() public static méthode

Determines if given format supports mipmapping.
public static IsFormatMippable ( ImageEngineFormat format ) : bool
format ImageEngineFormat Image format to check.
Résultat bool

MaxNumberOfChannels() public static méthode

Gets maximum number of channels a format can contain. NOTE: This likely isn't actually the max number. i.e. None exceed four, but some are only one or two channels.
public static MaxNumberOfChannels ( ImageEngineFormat format ) : int
format ImageEngineFormat Format to channel count.
Résultat int

ParseExtension() public static méthode

Gets file extension from string of extension.
public static ParseExtension ( string extension ) : SupportedExtensions
extension string String containing file extension.
Résultat SupportedExtensions

Property Details

SaveUnsupported public_oe static_oe property

Contains formats not yet capable of saving.
public static List SaveUnsupported
Résultat List