Table of Contents

Class ImageSourceFromWic

Namespace
SharpDX.Direct2D1
Assembly
SharpDX.Direct2D1.dll
[Guid("77395441-1c8f-4555-8683-f50dab0fe792")]
public class ImageSourceFromWic : ImageSource
Inheritance
ImageSourceFromWic
Inherited Members

Constructors

ImageSourceFromWic(DeviceContext2, BitmapSource, ImageSourceLoadingOptions, AlphaMode)

Initializes a new instance of the ImageSourceFromWic.

public ImageSourceFromWic(DeviceContext2 context2, BitmapSource wicBitmapSource, ImageSourceLoadingOptions loadingOptions, AlphaMode alphaMode)

Parameters

context2 DeviceContext2
wicBitmapSource BitmapSource
loadingOptions ImageSourceLoadingOptions
alphaMode AlphaMode

ImageSourceFromWic(nint)

public ImageSourceFromWic(nint nativePtr)

Parameters

nativePtr nint

Properties

Source

Retrieves the underlying bitmap image source from the Windows Imaging Component (WIC).

public BitmapSource Source { get; }

Property Value

BitmapSource

Methods

EnsureCached(RawRectangle?)

Ensures that a specified region of the image source cache is populated. This method can be used to minimize glitches by performing expensive work to populate caches outside of a rendering loop. This method can also be used to speculatively load image data before it is needed by drawing routines.

public void EnsureCached(RawRectangle? rectangleToFill)

Parameters

rectangleToFill RawRectangle?

Specifies the region of the image, in pixels, that should be populated in the cache. By default, this is the entire extent of the image.

Remarks

This API loads image data into caches of image sources, if that data was not already cached. It does not trim pre-existing caches, if any. More areas within the cache can be populated than actually requested.

?

The provided region must be constructed to include the scale with which the image source will subsequently be drawn. These coordinates must be provided in local coordinates. This means that they must be adjusted prior to calling the API according to the DPI and other relevant transforms, which can include the world transform and brush transforms.

This operation is only supported when the image source has been initialized using the D2D1_IMAGE_SOURCE_LOADING_OPTIONS_CACHE_ON_DEMAND option.

TrimCache(RawRectangle?)

This method trims the populated regions of the image source cache to just the specified rectangle.

public void TrimCache(RawRectangle? rectangleToPreserve)

Parameters

rectangleToPreserve RawRectangle?

Specifies the region of the image, in pixels, which should be preserved in the image source cache. Regions which are outside of the rectangle are evicted from the cache. By default, this is an empty rectangle, meaning that the entire image is evicted from the cache.

Remarks

The provided region must be constructed to include the scale at which the image source will be drawn at. These coordinates must be provided in local coordinates. This means that they must be adjusted prior to calling the API according to the DPI and other relevant transforms, which can include the world transform and brush transforms.

?

This method will fail if on-demand caching was not requested when the image source was created.

?

As with ID2D1Device::ClearResources, the caller can need to subsequently issue a D3D flush before memory usage is reduced.

This operation is only supported when the image source has been initialized using the D2D1_IMAGE_SOURCE_LOADING_OPTIONS_CACHE_ON_DEMAND option.

Operators

explicit operator ImageSourceFromWic(nint)

public static explicit operator ImageSourceFromWic(nint nativePtr)

Parameters

nativePtr nint

Returns

ImageSourceFromWic