VintaSoft Imaging .NET SDK 15.2: Документация для .NET разработчика
Vintasoft.Imaging Namespace / VintasoftImageGdiExtensions Class / OpenGraphics(VintasoftImage) Method
Синтаксис Exceptions Example Требования Смотрите также
В этом разделе
OpenGraphics(VintasoftImage) Метод (VintasoftImageGdiExtensions)
В этом разделе
Открывает новый System.Drawing.Graphics для этого изображения.
Синтаксис
'Declaration

<ExtensionAttribute()>
Public Shared Function OpenGraphics( _
ByVal image
Изображение.
As VintasoftImage _
) As System.Drawing.Graphics
[Extension()]
public static System.Drawing.Graphics OpenGraphics(
VintasoftImage image
)

Parameters

image
Изображение.

Return Value

Новый System.Drawing.Graphics для этого изображения.
Исключения
ИсключениеОписание
Выбрасывается, если для параметра IsImageDataLocked установлено значение true.
Выбрасывается, если графический объект не может быть создан для изображения, т.е. изображение является изображением палитры.
Пример

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


' open the original image
Using originalImage As New Vintasoft.Imaging.VintasoftImage("c:\original-image.tif")
    ' open the overlay image
    Using overlayImage As New Vintasoft.Imaging.VintasoftImage("c:\overlay-image.tif")
        Dim g As System.Drawing.Graphics = Vintasoft.Imaging.VintasoftImageGdiExtensions.OpenGraphics(originalImage)
        ' draw the overlay image on the original image
        Vintasoft.Imaging.VintasoftImageGdiExtensions.Draw(overlayImage, g, New System.Drawing.Rectangle(300, 400, 500, 600), New System.Drawing.Rectangle(1000, 200, 1000, 700))
    End Using

    ' close Graphics of the overlay image
    Vintasoft.Imaging.VintasoftImageGdiExtensions.CloseGraphics(originalImage)

    ' save original image
    originalImage.Save("c:\processed-image.tif")
End Using


// open the original image
using (Vintasoft.Imaging.VintasoftImage originalImage =
    new Vintasoft.Imaging.VintasoftImage(@"c:\original-image.tif"))
{
    // open the overlay image
    using (Vintasoft.Imaging.VintasoftImage overlayImage =
        new Vintasoft.Imaging.VintasoftImage(@"c:\overlay-image.tif"))
    {
        System.Drawing.Graphics g = Vintasoft.Imaging.VintasoftImageGdiExtensions.OpenGraphics(originalImage);
        // draw the overlay image on the original image
        Vintasoft.Imaging.VintasoftImageGdiExtensions.Draw(overlayImage, g,
                            new System.Drawing.Rectangle(300, 400, 500, 600),
                            new System.Drawing.Rectangle(1000, 200, 1000, 700));
    }

    // close Graphics of the overlay image
    Vintasoft.Imaging.VintasoftImageGdiExtensions.CloseGraphics(originalImage);

    // save original image
    originalImage.Save(@"c:\processed-image.tif");
}

Требования

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

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