В этом разделе
Содержит статические свойства и методы, которые позволяют получить список доступных кодеков (пара декодер-кодер) и добавить новый кодек в список доступных кодеков.
Объектная модель
Синтаксис
'Declaration
Public MustInherit NotInheritable Class AvailableCodecs
public static class AvailableCodecs
public __gc abstract __sealed class AvailableCodecs
public ref class AvailableCodecs abstract sealed
Пример
Вот пример, показывающий, как получить информацию о доступных кодеках:
''' <summary>
''' Shows detailed information about available codecs.
''' </summary>
Public Shared Sub ShowAvailableCodecsInfo()
For Each codec As Vintasoft.Imaging.Codecs.Codec In Vintasoft.Imaging.Codecs.AvailableCodecs.Codecs
Dim codecInfo As String = ""
If codec.CanCreateDecoder AndAlso codec.CanCreateEncoder Then
codecInfo = "decoder, encoder"
ElseIf codec.CanCreateDecoder Then
codecInfo = "decoder"
ElseIf codec.CanCreateEncoder Then
codecInfo = "encoder"
End If
System.Console.WriteLine(String.Format("{0} codec ({1}):", codec.Name, codecInfo))
System.Console.Write(" File extensions:")
For i As Integer = 0 To codec.FileExtensions.Length - 1
System.Console.Write(String.Format(" *{0}", codec.FileExtensions(i).ToLowerInvariant()))
Next
System.Console.WriteLine()
Next
End Sub
' This code example produces the following output:
Raw codec (decoder):
File extensions: *.nef *.nrw *.cr2 *.crw *.dng
Tiff codec (decoder, encoder):
File extensions: *.tif *.tiff
Gif codec (decoder, encoder):
File extensions: *.gif
Png codec (decoder, encoder):
File extensions: *.png
Jpeg codec (decoder, encoder):
File extensions: *.jpg *.jpeg
Bmp codec (decoder, encoder):
File extensions: *.bmp
Pdf codec (decoder, encoder):
File extensions: *.pdf
Jbig2 codec (decoder, encoder):
File extensions: *.jb2 *.jbig2
Jpeg2000 codec (decoder, encoder):
File extensions: *.jp2 *.jpc *.j2k *.j2c
Dicom codec (decoder):
File extensions: *.dcm *.dic *.acr
Docx codec (decoder):
File extensions: *.docx
Wmf codec (decoder):
File extensions: *.wmf
Emf codec (decoder):
File extensions: *.emf
Icon codec (decoder):
File extensions: *.ico *.cur
Jpeg-LS codec (decoder):
File extensions: *.jls
Pcx codec (decoder, encoder):
File extensions: *.pcx
/// <summary>
/// Shows detailed information about available codecs.
/// </summary>
public static void ShowAvailableCodecsInfo()
{
foreach (Vintasoft.Imaging.Codecs.Codec codec in Vintasoft.Imaging.Codecs.AvailableCodecs.Codecs)
{
string codecInfo = "";
if (codec.CanCreateDecoder && codec.CanCreateEncoder)
codecInfo = "decoder, encoder";
else if (codec.CanCreateDecoder)
codecInfo = "decoder";
else if (codec.CanCreateEncoder)
codecInfo = "encoder";
System.Console.WriteLine(string.Format("{0} codec ({1}):", codec.Name, codecInfo));
System.Console.Write(" File extensions:");
for (int i = 0; i < codec.FileExtensions.Length; i++)
{
System.Console.Write(string.Format(" *{0}", codec.FileExtensions[i].ToLowerInvariant()));
}
System.Console.WriteLine();
}
}
/* This code example produces the following output:
Raw codec (decoder):
File extensions: *.nef *.nrw *.cr2 *.crw *.dng
Tiff codec (decoder, encoder):
File extensions: *.tif *.tiff
Gif codec (decoder, encoder):
File extensions: *.gif
Png codec (decoder, encoder):
File extensions: *.png
Jpeg codec (decoder, encoder):
File extensions: *.jpg *.jpeg
Bmp codec (decoder, encoder):
File extensions: *.bmp
Pdf codec (decoder, encoder):
File extensions: *.pdf
Jbig2 codec (decoder, encoder):
File extensions: *.jb2 *.jbig2
Jpeg2000 codec (decoder, encoder):
File extensions: *.jp2 *.jpc *.j2k *.j2c
Dicom codec (decoder):
File extensions: *.dcm *.dic *.acr
Docx codec (decoder):
File extensions: *.docx
Wmf codec (decoder):
File extensions: *.wmf
Emf codec (decoder):
File extensions: *.emf
Icon codec (decoder):
File extensions: *.ico *.cur
Jpeg-LS codec (decoder):
File extensions: *.jls
Pcx codec (decoder, encoder):
File extensions: *.pcx
*/
Иерархия наследования
System.Object
 Vintasoft.Imaging.Codecs.AvailableCodecs
Требования
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
Смотрите также