VintaSoft Imaging .NET SDK 15.1: Документация для .NET разработчика
Vintasoft.Imaging Namespace / VintasoftImage Class / CreateImagesBasedOnSourceImageDecoders(VintasoftImage[]) Method
Синтаксис Ремарки Example Требования Смотрите также
В этом разделе
CreateImagesBasedOnSourceImageDecoders(VintasoftImage[]) Метод (VintasoftImage)
В этом разделе
Создает новый массив изображений на основе декодеров исходных изображений.
Синтаксис
'Declaration

Public Shared Function CreateImagesBasedOnSourceImageDecoders( _
ByVal sourceImages
Массив исходных изображений.
() As VintasoftImage _
) As VintasoftImage[]
public static VintasoftImage[] CreateImagesBasedOnSourceImageDecoders(
VintasoftImage[] sourceImages
)

Parameters

sourceImages
Массив исходных изображений.

Return Value

Массив изображений на основе декодеров исходных изображений.
Ремарки

Этот метод можно использовать, когда один и тот же массив объектов VintasoftImage необходимо использовать с разными настройками декодирования (управления цветом), например, необходимо просматривать и напечатаны с различными настройками управления цветом.

Созданные изображения необходимо уничтожить с помощью метода Dispose, если изображения больше не нужны.

Пример

Вот C#/VB.NET код, который демонстрирует, как просматривать одни и те же изображения в двух программах просмотра с разными настройками управления цветом.


''' <summary>
''' View images in 2 image viewers with different output ICC profiles.
''' </summary>
Public Shared Sub ViewImages(images As Vintasoft.Imaging.VintasoftImage(), viewer1 As Vintasoft.Imaging.UI.ImageViewer, outputRgbIccProfile1 As String, viewer2 As Vintasoft.Imaging.UI.ImageViewer, outputRgbIccProfile2 As String)
    AddImagesToViewer(images, viewer1, outputRgbIccProfile1)
    AddImagesToViewer(images, viewer2, outputRgbIccProfile2)
End Sub

''' <summary>
''' Creates new images using decoders of source images and
''' shows new images in specified viewer with specified output ICC profile.
''' </summary>
Private Shared Sub AddImagesToViewer(sourceImages As Vintasoft.Imaging.VintasoftImage(), viewer As Vintasoft.Imaging.UI.ImageViewer, outputRgbIccProfile As String)
    ' create ICC profile
    Dim profile As New Vintasoft.Imaging.ColorManagement.Icc.IccProfile(outputRgbIccProfile)
    ' create new images based on decoder(s) of source images
    Dim images1 As Vintasoft.Imaging.VintasoftImage() = Vintasoft.Imaging.VintasoftImage.CreateImagesBasedOnSourceImageDecoders(sourceImages)
    For i As Integer = 0 To images1.Length - 1
        Dim sourceImage As Vintasoft.Imaging.VintasoftImage = sourceImages(i)
        Dim newImage As Vintasoft.Imaging.VintasoftImage = images1(i)
        ' set new color management settions
        newImage.DecodingSettings = New Vintasoft.Imaging.Codecs.Decoders.DecodingSettings()
        If sourceImage.DecodingSettings IsNot Nothing AndAlso sourceImage.DecodingSettings.ColorManagement IsNot Nothing Then
            newImage.DecodingSettings.ColorManagement = New Vintasoft.Imaging.ColorManagement.ColorManagementDecodeSettings(sourceImage.DecodingSettings.ColorManagement)
        Else
            newImage.DecodingSettings.ColorManagement = New Vintasoft.Imaging.ColorManagement.ColorManagementDecodeSettings()
        End If
        newImage.DecodingSettings.ColorManagement.OutputRgbProfile = profile
    Next
    ' add new images to the viewer
    viewer.Images.AddRange(images1)
End Sub


/// <summary>
/// View images in 2 image viewers with different output ICC profiles.
/// </summary>
public static void ViewImages(
    Vintasoft.Imaging.VintasoftImage[] images,
    Vintasoft.Imaging.UI.ImageViewer viewer1, string outputRgbIccProfile1,
    Vintasoft.Imaging.UI.ImageViewer viewer2, string outputRgbIccProfile2)
{
    AddImagesToViewer(images, viewer1, outputRgbIccProfile1);
    AddImagesToViewer(images, viewer2, outputRgbIccProfile2);
}

/// <summary>
/// Creates new images using decoders of source images and
/// shows new images in specified viewer with specified output ICC profile.
/// </summary>
private static void AddImagesToViewer(
    Vintasoft.Imaging.VintasoftImage[] sourceImages, 
    Vintasoft.Imaging.UI.ImageViewer viewer, string outputRgbIccProfile)
{
    // create ICC profile
    Vintasoft.Imaging.ColorManagement.Icc.IccProfile profile = 
        new Vintasoft.Imaging.ColorManagement.Icc.IccProfile(outputRgbIccProfile);
    // create new images based on decoder(s) of source images
    Vintasoft.Imaging.VintasoftImage[] images1 = 
        Vintasoft.Imaging.VintasoftImage.CreateImagesBasedOnSourceImageDecoders(sourceImages);
    for (int i = 0; i < images1.Length; i++)
    {
        Vintasoft.Imaging.VintasoftImage sourceImage = sourceImages[i];
        Vintasoft.Imaging.VintasoftImage newImage = images1[i];
        // set new color management settions
        newImage.DecodingSettings = new Vintasoft.Imaging.Codecs.Decoders.DecodingSettings();
        if (sourceImage.DecodingSettings != null &&
            sourceImage.DecodingSettings.ColorManagement != null)
            newImage.DecodingSettings.ColorManagement =
                new Vintasoft.Imaging.ColorManagement.ColorManagementDecodeSettings(
                    sourceImage.DecodingSettings.ColorManagement);
        else
            newImage.DecodingSettings.ColorManagement = 
                new Vintasoft.Imaging.ColorManagement.ColorManagementDecodeSettings();
        newImage.DecodingSettings.ColorManagement.OutputRgbProfile = profile;
    }
    // add new images to the viewer
    viewer.Images.AddRange(images1);
}

Требования

Целевые платформы: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

Смотрите также