C# Класс CSharpImageLibrary.ImageFormats

Provides format functionality
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
SaveUnsupported List

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

Метод Описание
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.

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

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

Determines image type via headers. Keeps stream position.
public static DetermineImageType ( Stream imgData ) : SupportedExtensions
imgData Stream Image data, incl header.
Результат SupportedExtensions

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

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.
Результат ImageEngineFormat

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

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.
Результат int

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

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)
Результат int

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

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.
Результат string

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

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.
Результат List

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

Get descriptions of supported images. Generally the description as would be seen in a SaveFileDialog.
public static GetSupportedExtensionsDescriptions ( ) : List
Результат List

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

Get list of filter strings for dialog boxes of the Supported Images.
public static GetSupportedExtensionsForDialogBox ( ) : List
Результат List

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

Gets list of filter strings for dialog boxes already formatted as string.
public static GetSupportedExtensionsForDialogBoxAsString ( ) : string
Результат string

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

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.
Результат int

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

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.
Результат bool

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

Determines if format is a block compressed format.
public static IsBlockCompressed ( ImageEngineFormat format ) : bool
format ImageEngineFormat DDS Surface Format.
Результат bool

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

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.
Результат bool

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

Determines if given format supports mipmapping.
public static IsFormatMippable ( ImageEngineFormat format ) : bool
format ImageEngineFormat Image format to check.
Результат bool

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

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.
Результат int

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

Gets file extension from string of extension.
public static ParseExtension ( string extension ) : SupportedExtensions
extension string String containing file extension.
Результат SupportedExtensions

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

SaveUnsupported публичное статическое свойство

Contains formats not yet capable of saving.
public static List SaveUnsupported
Результат List