[]
        
(Showing Draft Content)

GrapeCity.Documents.Imaging.Windows.GcD2DBitmap

Class GcD2DBitmap

Namespace
GrapeCity.Documents.Imaging.Windows
Assembly
GcDocs.Imaging.Windows.dll

Represents a bitmap that uses the Direct2D system API. Can be used for fast and efficient rendering on Windows systems that support Direct2D.

public class GcD2DBitmap : IImage, IDisposable
Inheritance
object
GcD2DBitmap
Implements
System.IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

GcD2DBitmap()

Initializes a new instance of the GcD2DBitmap class.

public GcD2DBitmap()

GcD2DBitmap(int, int, float, float)

Initializes a new instance of the GcD2DBitmap class and creates the image.

The image content is not initialized and can contain any random data.

public GcD2DBitmap(int pixelWidth, int pixelHeight, float dpiX = 96, float dpiY = 96)

Parameters

pixelWidth int

The width of the image, in pixels.

pixelHeight int

The height of the image, in pixels.

dpiX float

The horizontal dpi of the image.

dpiY float

The vertical dpi of the image.

Properties

D2DDevice

Gets an instance of the Device class.

public Device D2DDevice { get; }

Property Value

Device

D2DFactory

Gets an instance of the Factory1 class.

public Factory1 D2DFactory { get; }

Property Value

Factory1

DeviceContext

Gets an instance of the DeviceContext class.

public DeviceContext DeviceContext { get; }

Property Value

DeviceContext

DpiX

Gets the x-axis DPI resolution.

public float DpiX { get; }

Property Value

float

DpiY

Gets the y-axis DPI resolution.

public float DpiY { get; }

Property Value

float

DWFactory

Gets an instance of the Factory1 class.

The factory becomes available after initializing the font cache (see the SetFontCache(FontCache) method).

public Factory1 DWFactory { get; }

Property Value

Factory1

Graphics

Gets an instance of the GcD2DBitmapGraphics class.

The Graphics becomes available after executing the CreateGraphics(Color?) method.

public GcD2DBitmapGraphics Graphics { get; }

Property Value

GcD2DBitmapGraphics

Height

Gets the height of the image, in DIPs.

public float Height { get; }

Property Value

float

IsDisposed

Gets a value indicating whether the GcD2DBitmap has been disposed of.

public bool IsDisposed { get; }

Property Value

bool

PixelHeight

Gets the pixel height of the image.

public int PixelHeight { get; }

Property Value

int

PixelWidth

Gets the pixel width of the image.

public int PixelWidth { get; }

Property Value

int

Width

Gets the width of the image, in DIPs.

public float Width { get; }

Property Value

float

Methods

ApplyLicenseKey(string)

Applies a license key to an instance of GcWicBitmap.

public void ApplyLicenseKey(string key)

Parameters

key string

The license key to set.

CreateGraphics(Color?)

Creates an instance of the GcD2DBitmapGraphics class.

public GcD2DBitmapGraphics CreateGraphics(Color? backColor = null)

Parameters

backColor System.Drawing.Color?

If not null, specifies the color that is used to initialize the image.

Returns

GcD2DBitmapGraphics

The new instance of GcD2DBitmapGraphics.

CreateImage(int, int, float, float)

Creates an image with the given size and resolution.

The content is not initialized by this method and can contain any random data.

public void CreateImage(int pixelWidth, int pixelHeight, float dpiX, float dpiY)

Parameters

pixelWidth int

The width of the image, in pixels.

pixelHeight int

The height of the image, in pixels.

dpiX float

The horizontal resolution (DPI) of the image.

dpiY float

The vertical resolution (DPI) of the image.

CreateImage(int, int)

Creates an image with the given size and 96 DPI resolution.

public void CreateImage(int pixelWidth, int pixelHeight)

Parameters

pixelWidth int

The width of the image, in pixels.

pixelHeight int

The height of the image, in pixels.

DiscardImage()

Discards the internal image and clears all metadata.

public void DiscardImage()

Dispose()

Cleans up the resources that were used.

public void Dispose()

Dispose(bool)

Performs cleanup operations on managed and unmanaged resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

~GcD2DBitmap()

Performs cleanup operations on unmanaged resources.

protected ~GcD2DBitmap()

Load(Stream, WicContainerFormat, int)

Loads the image from a stream.

public void Load(Stream stream, WicContainerFormat containerFormat = WicContainerFormat.Unknown, int frameIndex = 0)

Parameters

stream System.IO.Stream

The input stream.

containerFormat WicContainerFormat

The image container format; use Unknown to detect the format automatically.

frameIndex int

Index of an image frame to read; pass 0 for image formats not supporting multiple frames.

Load(string, WicContainerFormat, int)

Loads the image from a file.

public void Load(string path, WicContainerFormat containerFormat = WicContainerFormat.Unknown, int frameIndex = 0)

Parameters

path string

The file path to the image.

containerFormat WicContainerFormat

The image container format; use Unknown to detect the format automatically.

frameIndex int

Index of an image frame to read; pass 0 for image formats not supporting multiple frames.

Save(Stream, WicContainerFormat, BaseOptions)

Saves the image to a stream using the specified format and options.

public void Save(Stream stream, WicContainerFormat format, BaseOptions options = null)

Parameters

stream System.IO.Stream

The output stream.

format WicContainerFormat

The container format that determines the image encoder.

options BaseOptions

The options for the specified image encoder.

Save(string, WicContainerFormat, BaseOptions)

Saves the image to a file using the specified format and options.

public void Save(string fileName, WicContainerFormat format, BaseOptions options = null)

Parameters

fileName string

The output file name.

format WicContainerFormat

The container format that determines the image encoder.

options BaseOptions

The options for the specified image encoder.

SaveAsBmp(Stream, BmpOptions)

Saves the image to a stream in BMP format.

public void SaveAsBmp(Stream stream, BmpOptions options = null)

Parameters

stream System.IO.Stream

The output stream.

options BmpOptions

The options for the BMP image encoder.

SaveAsBmp(string, BmpOptions)

Saves the image to a file in BMP format.

public void SaveAsBmp(string fileName, BmpOptions options = null)

Parameters

fileName string

The output file name.

options BmpOptions

The options for the BMP image encoder.

SaveAsGif(Stream, GifOptions)

Saves the image to a stream in GIF format.

public void SaveAsGif(Stream stream, GifOptions options = null)

Parameters

stream System.IO.Stream

The output stream.

options GifOptions

The options for the GIF image encoder.

SaveAsGif(string, GifOptions)

Saves the image to a file in GIF format.

public void SaveAsGif(string fileName, GifOptions options = null)

Parameters

fileName string

The output file name.

options GifOptions

The options for the GIF image encoder.

SaveAsJpeg(Stream, JpegOptions)

Saves the image to a stream in JPEG format.

public void SaveAsJpeg(Stream stream, JpegOptions options = null)

Parameters

stream System.IO.Stream

The output stream.

options JpegOptions

The options for the JPEG image encoder.

SaveAsJpeg(string, JpegOptions)

Saves the image to a file in JPEG format.

public void SaveAsJpeg(string fileName, JpegOptions options = null)

Parameters

fileName string

The output file name.

options JpegOptions

The options for the JPEG image encoder.

SaveAsJpegXR(Stream, JpegXROptions)

Saves the image to a stream in JPEG XR format.

public void SaveAsJpegXR(Stream stream, JpegXROptions options = null)

Parameters

stream System.IO.Stream

The output stream.

options JpegXROptions

The options for the JPEG XR image encoder.

SaveAsJpegXR(string, JpegXROptions)

Saves the image to a file in JPEG XR format.

public void SaveAsJpegXR(string fileName, JpegXROptions options = null)

Parameters

fileName string

The output file name.

options JpegXROptions

The options for the JPEG XR image encoder.

SaveAsPng(Stream, PngOptions)

Saves the image to a stream in PNG format.

public void SaveAsPng(Stream stream, PngOptions options = null)

Parameters

stream System.IO.Stream

The output stream.

options PngOptions

The options for the PNG image encoder.

SaveAsPng(string, PngOptions)

Saves the image to a file in PNG format.

public void SaveAsPng(string fileName, PngOptions options = null)

Parameters

fileName string

The output file name.

options PngOptions

The options for the PNG image encoder.

SaveAsTiff(Stream, TiffOptions)

Saves the image to a stream in TIFF format.

public void SaveAsTiff(Stream stream, TiffOptions options = null)

Parameters

stream System.IO.Stream

The output stream.

options TiffOptions

The options for the TIFF image encoder.

SaveAsTiff(string, TiffOptions)

Saves the image to a file in TIFF format.

public void SaveAsTiff(string fileName, TiffOptions options = null)

Parameters

fileName string

The output file name.

options TiffOptions

The options for the TIFF image encoder.

SetFontCache(FontCache)

Assigns a shared instance of the GrapeCity.Documents.Imaging.Windows.GcD2DBitmap.FontCache class to be used by this bitmap.

public void SetFontCache(FontCache fontCache)

Parameters

fontCache FontCache

SetLicenseKey(string)

Sets the license key.

public static void SetLicenseKey(string key)

Parameters

key string

The license key to set.

ToGcBitmap()

Copies the image buffer to a new GcBitmap.

public GcBitmap ToGcBitmap()

Returns

GcBitmap

ToGcBitmap(GcBitmap)

Copies the image buffer to an existing instance of GcBitmap.

public void ToGcBitmap(GcBitmap bmp)

Parameters

bmp GcBitmap

The destination GcBitmap object.