[]
        
(Showing Draft Content)

GrapeCity.Documents.DX.Direct2D.DeviceContext

Class DeviceContext

Namespace
GrapeCity.Documents.DX.Direct2D
Assembly
GcDocs.DX.Windows.dll

ID2D1DeviceContext

[Guid("e8f7fe7a-191c-466d-ad95-975678bda998")]
public class DeviceContext : RenderTarget, IDisposable, IUnknown
Inheritance
object
DeviceContext
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

DeviceContext(IntPtr)

Initializes a new instance of the DeviceContext class.

public DeviceContext(IntPtr nativePtr)

Parameters

nativePtr System.IntPtr

The native pointer.

Methods

Create(Device, DeviceContextOptions)

Initializes a new instance of the DeviceContext class using an existing Device.

public static DeviceContext Create(Device device, DeviceContextOptions options)

Parameters

device Device

The device.

options DeviceContextOptions

The options to be applied to the created device context.

Returns

DeviceContext

Remarks

The new device context will not have a selected target bitmap. The caller must create and select a bitmap as the target surface of the context.

Create(Surface, CreationProperties)

Initializes a new instance of the Device class.

public static DeviceContext Create(Surface surface, CreationProperties creationProperties)

Parameters

surface Surface

The surface.

creationProperties CreationProperties

The creation properties.

Returns

DeviceContext

Create(Surface)

Initializes a new instance of the DeviceContext class.

public static DeviceContext Create(Surface surface)

Parameters

surface Surface

The surface.

Returns

DeviceContext

CreateBitmap1(Size2L, IntPtr, int, BitmapProperties1)

HRESULT ID2D1DeviceContext::CreateBitmap([In] D2D_SIZE_U size,[In, Optional] const void* sourceData,[In] unsigned int pitch,[In] const D2D1_BITMAP_PROPERTIES1* bitmapProperties,[Out, Fast] ID2D1Bitmap1** bitmap)

public Bitmap1 CreateBitmap1(Size2L size, IntPtr sourceData, int pitch, BitmapProperties1 bitmapProperties)

Parameters

size Size2L
sourceData System.IntPtr
pitch int
bitmapProperties BitmapProperties1

Returns

Bitmap1

CreateBitmap1FromDxgiSurface(Surface, BitmapProperties1)

HRESULT ID2D1DeviceContext::CreateBitmapFromDxgiSurface([In] IDXGISurface* surface,[In, Optional] const D2D1_BITMAP_PROPERTIES1* bitmapProperties,[Out, Fast] ID2D1Bitmap1** bitmap)

public Bitmap1 CreateBitmap1FromDxgiSurface(Surface surface, BitmapProperties1 bitmapProperties)

Parameters

surface Surface
bitmapProperties BitmapProperties1

Returns

Bitmap1

CreateBitmap1FromWicBitmap(BitmapSource, BitmapProperties1)

HRESULT ID2D1DeviceContext::CreateBitmapFromWicBitmap([In] IWICBitmapSource* wicBitmapSource,[In, Optional] const D2D1_BITMAP_PROPERTIES1* bitmapProperties,[Out] ID2D1Bitmap1** bitmap)

public Bitmap1 CreateBitmap1FromWicBitmap(BitmapSource wicBitmapSource, BitmapProperties1 bitmapProperties)

Parameters

wicBitmapSource BitmapSource
bitmapProperties BitmapProperties1

Returns

Bitmap1

CreateBitmapBrush1(Bitmap, BitmapBrushProperties1?, BrushProperties?)

HRESULT ID2D1DeviceContext::CreateBitmapBrush([In, Optional] ID2D1Bitmap* bitmap,[In, Optional] const D2D1_BITMAP_BRUSH_PROPERTIES1* bitmapBrushProperties,[In, Optional] const D2D1_BRUSH_PROPERTIES* brushProperties,[Out, Fast] ID2D1BitmapBrush1** bitmapBrush)

public BitmapBrush1 CreateBitmapBrush1(Bitmap bitmap, BitmapBrushProperties1? bitmapBrushProperties, BrushProperties? brushProperties)

Parameters

bitmap Bitmap
bitmapBrushProperties BitmapBrushProperties1?
brushProperties BrushProperties?

Returns

BitmapBrush1

CreateColorContext(ColorSpace, byte[], int)

HRESULT ID2D1DeviceContext::CreateColorContext([In] D2D1_COLOR_SPACE space,[In, Buffer, Optional] const unsigned char* profile,[In] unsigned int profileSize,[Out, Fast] ID2D1ColorContext** colorContext)

public ColorContext CreateColorContext(ColorSpace space, byte[] rofileRef, int profileSize)

Parameters

space ColorSpace
rofileRef byte[]
profileSize int

Returns

ColorContext

CreateColorContextFromFilename(string)

HRESULT ID2D1DeviceContext::CreateColorContextFromFilename([In] const wchar_t* filename,[Out, Fast] ID2D1ColorContext** colorContext)

public ColorContext CreateColorContextFromFilename(string filename)

Parameters

filename string

Returns

ColorContext

CreateColorContextFromWicColorContext(ColorContext)

HRESULT ID2D1DeviceContext::CreateColorContextFromWicColorContext([In] IWICColorContext* wicColorContext,[Out, Fast] ID2D1ColorContext** colorContext)

public ColorContext CreateColorContextFromWicColorContext(ColorContext wicColorContext)

Parameters

wicColorContext ColorContext

Returns

ColorContext

CreateCommandList()

HRESULT ID2D1DeviceContext::CreateCommandList([Out, Fast] ID2D1CommandList** commandList)

public CommandList CreateCommandList()

Returns

CommandList

CreateEffect(Guid, Effect)

HRESULT ID2D1DeviceContext::CreateEffect([In] const GUID& effectId,[Out, Fast] ID2D1Effect** effect)

public void CreateEffect(Guid effectId, Effect effect)

Parameters

effectId System.Guid
effect Effect

CreateEffect(Guid)

HRESULT ID2D1DeviceContext::CreateEffect([In] const GUID& effectId,[Out, Fast] ID2D1Effect** effect)

public Effect CreateEffect(Guid effectId)

Parameters

effectId System.Guid

Returns

Effect

CreateGradientStopCollection1(GradientStop[], int, ColorSpace, ColorSpace, BufferPrecision, ExtendMode, ColorInterpolationMode)

HRESULT ID2D1DeviceContext::CreateGradientStopCollection([In, Buffer] const D2D1_GRADIENT_STOP* straightAlphaGradientStops,[In] unsigned int straightAlphaGradientStopsCount,[In] D2D1_COLOR_SPACE preInterpolationSpace,[In] D2D1_COLOR_SPACE postInterpolationSpace,[In] D2D1_BUFFER_PRECISION bufferPrecision,[In] D2D1_EXTEND_MODE extendMode,[In] D2D1_COLOR_INTERPOLATION_MODE colorInterpolationMode,[Out, Fast] ID2D1GradientStopCollection1** gradientStopCollection1)

public GradientStopCollection1 CreateGradientStopCollection1(GradientStop[] straightAlphaGradientStops, int straightAlphaGradientStopsCount, ColorSpace preInterpolationSpace, ColorSpace postInterpolationSpace, BufferPrecision bufferPrecision, ExtendMode extendMode, ColorInterpolationMode colorInterpolationMode)

Parameters

straightAlphaGradientStops GradientStop[]
straightAlphaGradientStopsCount int
preInterpolationSpace ColorSpace
postInterpolationSpace ColorSpace
bufferPrecision BufferPrecision
extendMode ExtendMode
colorInterpolationMode ColorInterpolationMode

Returns

GradientStopCollection1

CreateImageBrush(Image, ref ImageBrushProperties, BrushProperties?)

HRESULT ID2D1DeviceContext::CreateImageBrush([In, Optional] ID2D1Image* image,[In] const D2D1_IMAGE_BRUSH_PROPERTIES* imageBrushProperties,[In, Optional] const D2D1_BRUSH_PROPERTIES* brushProperties,[Out, Fast] ID2D1ImageBrush** imageBrush)

public ImageBrush CreateImageBrush(Image image, ref ImageBrushProperties imageBrushProperties, BrushProperties? brushProperties)

Parameters

image Image
imageBrushProperties ImageBrushProperties
brushProperties BrushProperties?

Returns

ImageBrush

DrawBitmap(Bitmap, RectF?, float, InterpolationMode, RectF?, Matrix4x4?)

void ID2D1DeviceContext::DrawBitmap([In] ID2D1Bitmap* bitmap,[In, Optional] const D2D_RECT_F* destinationRectangle,[In] float opacity,[In] D2D1_INTERPOLATION_MODE interpolationMode,[In, Optional] const D2D_RECT_F* sourceRectangle,[In, Optional] const D2D_MATRIX_4X4_F* perspectiveTransform)

public void DrawBitmap(Bitmap bitmap, RectF? destinationRectangle, float opacity, InterpolationMode interpolationMode, RectF? sourceRectangle, Matrix4x4? perspectiveTransformRef)

Parameters

bitmap Bitmap
destinationRectangle RectF?
opacity float
interpolationMode InterpolationMode
sourceRectangle RectF?
perspectiveTransformRef Matrix4x4?

DrawBitmap(Bitmap, float, InterpolationMode, Matrix4x4)

Draws the bitmap.

public void DrawBitmap(Bitmap bitmap, float opacity, InterpolationMode interpolationMode, Matrix4x4 perspectiveTransformRef)

Parameters

bitmap Bitmap

The bitmap.

opacity float

The opacity.

interpolationMode InterpolationMode

The interpolation mode.

perspectiveTransformRef Matrix4x4

The perspective transform ref.

DrawBitmap(Bitmap, float, InterpolationMode, RectF, Matrix4x4)

Draws the bitmap.

public void DrawBitmap(Bitmap bitmap, float opacity, InterpolationMode interpolationMode, RectF sourceRectangle, Matrix4x4 perspectiveTransformRef)

Parameters

bitmap Bitmap

The bitmap.

opacity float

The opacity.

interpolationMode InterpolationMode

The interpolation mode.

sourceRectangle RectF

The source rectangle.

perspectiveTransformRef Matrix4x4

The perspective transform ref.

DrawBitmap(Bitmap, float, InterpolationMode)

Draws the bitmap.

public void DrawBitmap(Bitmap bitmap, float opacity, InterpolationMode interpolationMode)

Parameters

bitmap Bitmap

The bitmap.

opacity float

The opacity.

interpolationMode InterpolationMode

The interpolation mode.

DrawGdiMetafile(GdiMetafile, Point2F?)

void ID2D1DeviceContext::DrawGdiMetafile([In] ID2D1GdiMetafile* gdiMetafile,[In, Optional] const D2D_POINT_2F* targetOffset)

public void DrawGdiMetafile(GdiMetafile gdiMetafile, Point2F? targetOffset)

Parameters

gdiMetafile GdiMetafile
targetOffset Point2F?

DrawGlyphRun(Point2F, GlyphRun, GlyphRunDescription, Brush, MeasuringMode)

void ID2D1DeviceContext::DrawGlyphRun([In] D2D_POINT_2F baselineOrigin,[In] const DWRITE_GLYPH_RUN* glyphRun,[In, Optional] const DWRITE_GLYPH_RUN_DESCRIPTION* glyphRunDescription,[In] ID2D1Brush* foregroundBrush,[In] DWRITE_MEASURING_MODE measuringMode)

public void DrawGlyphRun(Point2F baselineOrigin, GlyphRun glyphRun, GlyphRunDescription glyphRunDescription, Brush foregroundBrush, MeasuringMode measuringMode)

Parameters

baselineOrigin Point2F
glyphRun GlyphRun
glyphRunDescription GlyphRunDescription
foregroundBrush Brush
measuringMode MeasuringMode

DrawGlyphRun(Point2F, IntPtr, IntPtr, Brush, MeasuringMode)

void ID2D1DeviceContext::DrawGlyphRun([In] D2D_POINT_2F baselineOrigin,[In] const DWRITE_GLYPH_RUN* glyphRun,[In, Optional] const DWRITE_GLYPH_RUN_DESCRIPTION* glyphRunDescription,[In] ID2D1Brush* foregroundBrush,[In] DWRITE_MEASURING_MODE measuringMode)

public void DrawGlyphRun(Point2F baselineOrigin, IntPtr glyphRun, IntPtr glyphRunDescription, Brush foregroundBrush, MeasuringMode measuringMode)

Parameters

baselineOrigin Point2F
glyphRun System.IntPtr
glyphRunDescription System.IntPtr
foregroundBrush Brush
measuringMode MeasuringMode

DrawImage(Effect, InterpolationMode, CompositeMode)

Draws an image to the device context.

public void DrawImage(Effect effect, InterpolationMode interpolationMode = InterpolationMode.Linear, CompositeMode compositeMode = CompositeMode.SourceOver)

Parameters

effect Effect
interpolationMode InterpolationMode
compositeMode CompositeMode

DrawImage(Effect, Point2F, InterpolationMode, CompositeMode)

Draws an image to the device context.

public void DrawImage(Effect effect, Point2F targetOffset, InterpolationMode interpolationMode = InterpolationMode.Linear, CompositeMode compositeMode = CompositeMode.SourceOver)

Parameters

effect Effect
targetOffset Point2F
interpolationMode InterpolationMode
compositeMode CompositeMode

DrawImage(Image, InterpolationMode, CompositeMode)

Draws an image to the device context.

public void DrawImage(Image image, InterpolationMode interpolationMode = InterpolationMode.Linear, CompositeMode compositeMode = CompositeMode.SourceOver)

Parameters

image Image
interpolationMode InterpolationMode
compositeMode CompositeMode

DrawImage(Image, Point2F, InterpolationMode, CompositeMode)

Draws an image to the device context.

public void DrawImage(Image image, Point2F targetOffset, InterpolationMode interpolationMode = InterpolationMode.Linear, CompositeMode compositeMode = CompositeMode.SourceOver)

Parameters

image Image
targetOffset Point2F
interpolationMode InterpolationMode
compositeMode CompositeMode

DrawImage(Image, Point2F?, RectF?, InterpolationMode, CompositeMode)

void ID2D1DeviceContext::DrawImage([In] ID2D1Image* image,[In, Optional] const D2D_POINT_2F* targetOffset,[In, Optional] const D2D_RECT_F* imageRectangle,[In] D2D1_INTERPOLATION_MODE interpolationMode,[In] D2D1_COMPOSITE_MODE compositeMode)

public void DrawImage(Image image, Point2F? targetOffset, RectF? imageRectangle, InterpolationMode interpolationMode, CompositeMode compositeMode)

Parameters

image Image
targetOffset Point2F?
imageRectangle RectF?
interpolationMode InterpolationMode
compositeMode CompositeMode

FillOpacityMask(Bitmap, Brush, RectF?, RectF?)

void ID2D1DeviceContext::FillOpacityMask([In] ID2D1Bitmap* opacityMask,[In] ID2D1Brush* brush,[In, Optional] const D2D_RECT_F* destinationRectangle,[In, Optional] const D2D_RECT_F* sourceRectangle)

public void FillOpacityMask(Bitmap opacityMask, Brush brush, RectF? destinationRectangle, RectF? sourceRectangle)

Parameters

opacityMask Bitmap
brush Brush
destinationRectangle RectF?
sourceRectangle RectF?

FillOpacityMask(Bitmap, Brush)

No documentation.

public void FillOpacityMask(Bitmap opacityMask, Brush brush)

Parameters

opacityMask Bitmap

No documentation.

brush Brush

No documentation.

GetDevice()

void ID2D1DeviceContext::GetDevice([Out] ID2D1Device** device)

public Device GetDevice()

Returns

Device

GetEffectInvalidRectangleCount(Effect)

HRESULT ID2D1DeviceContext::GetEffectInvalidRectangleCount([In] ID2D1Effect* effect,[Out] unsigned int* rectangleCount)

public int GetEffectInvalidRectangleCount(Effect effect)

Parameters

effect Effect

Returns

int

GetEffectInvalidRectangles(Effect, RectF[], int)

HRESULT ID2D1DeviceContext::GetEffectInvalidRectangles([In] ID2D1Effect* effect,[Out, Buffer] D2D_RECT_F* rectangles,[In] unsigned int rectanglesCount)

public void GetEffectInvalidRectangles(Effect effect, RectF[] rectangles, int rectanglesCount)

Parameters

effect Effect
rectangles RectF[]
rectanglesCount int

GetEffectInvalidRectangles(Effect)

Gets the effect invalid rectangles.

public RectF[] GetEffectInvalidRectangles(Effect effect)

Parameters

effect Effect

The effect.

Returns

RectF[]

GetEffectRequiredInputRectangles(Effect, EffectInputDescription[])

Gets the effect required input rectangles.

public RectF[] GetEffectRequiredInputRectangles(Effect renderEffect, EffectInputDescription[] inputDescriptions)

Parameters

renderEffect Effect

The render effect.

inputDescriptions EffectInputDescription[]

The input descriptions.

Returns

RectF[]

GetEffectRequiredInputRectangles(Effect, RectF, EffectInputDescription[])

Gets the effect required input rectangles.

public RectF[] GetEffectRequiredInputRectangles(Effect renderEffect, RectF renderImageRectangle, EffectInputDescription[] inputDescriptions)

Parameters

renderEffect Effect

The render effect.

renderImageRectangle RectF

The render image rectangle.

inputDescriptions EffectInputDescription[]

The input descriptions.

Returns

RectF[]

GetEffectRequiredInputRectangles(Effect, RectF?, EffectInputDescription[], RectF[], int)

HRESULT ID2D1DeviceContext::GetEffectRequiredInputRectangles([In] ID2D1Effect* renderEffect,[In, Optional] const D2D_RECT_F* renderImageRectangle,[In, Buffer] const D2D1_EFFECT_INPUT_DESCRIPTION* inputDescriptions,[Out, Buffer] D2D_RECT_F* requiredInputRects,[In] unsigned int inputCount)

public void GetEffectRequiredInputRectangles(Effect renderEffect, RectF? renderImageRectangle, EffectInputDescription[] inputDescriptions, RectF[] requiredInputRects, int inputCount)

Parameters

renderEffect Effect
renderImageRectangle RectF?
inputDescriptions EffectInputDescription[]
requiredInputRects RectF[]
inputCount int

GetGlyphRunWorldBounds(Point2F, GlyphRun, MeasuringMode)

HRESULT ID2D1DeviceContext::GetGlyphRunWorldBounds([In] D2D_POINT_2F baselineOrigin,[In] const DWRITE_GLYPH_RUN* glyphRun,[In] DWRITE_MEASURING_MODE measuringMode,[Out] D2D_RECT_F* bounds)

public RectF GetGlyphRunWorldBounds(Point2F baselineOrigin, GlyphRun glyphRun, MeasuringMode measuringMode)

Parameters

baselineOrigin Point2F
glyphRun GlyphRun
measuringMode MeasuringMode

Returns

RectF

GetImageLocalBounds(Image)

HRESULT ID2D1DeviceContext::GetImageLocalBounds([In] ID2D1Image* image,[Out] D2D_RECT_F* localBounds)

public RectF GetImageLocalBounds(Image image)

Parameters

image Image

Returns

RectF

GetImageWorldBounds(Image)

HRESULT ID2D1DeviceContext::GetImageWorldBounds([In] ID2D1Image* image,[Out] D2D_RECT_F* worldBounds)

public RectF GetImageWorldBounds(Image image)

Parameters

image Image

Returns

RectF

GetPrimitiveBlend()

D2D1_PRIMITIVE_BLEND ID2D1DeviceContext::GetPrimitiveBlend()

public PrimitiveBlend GetPrimitiveBlend()

Returns

PrimitiveBlend

GetRenderingControls()

void ID2D1DeviceContext::GetRenderingControls([Out] D2D1_RENDERING_CONTROLS* renderingControls)

public RenderingControls GetRenderingControls()

Returns

RenderingControls

GetTarget()

void ID2D1DeviceContext::GetTarget([Out, Optional] ID2D1Image** image)

public Image GetTarget()

Returns

Image

GetUnitMode()

D2D1_UNIT_MODE ID2D1DeviceContext::GetUnitMode()

public UnitMode GetUnitMode()

Returns

UnitMode

InvalidateEffectInputRectangle(Effect, int, RectF)

HRESULT ID2D1DeviceContext::InvalidateEffectInputRectangle([In] ID2D1Effect* effect,[In] unsigned int input,[In] const D2D_RECT_F* inputRectangle)

public void InvalidateEffectInputRectangle(Effect effect, int input, RectF inputRectangle)

Parameters

effect Effect
input int
inputRectangle RectF

IsBufferPrecisionSupported(BufferPrecision)

BOOL ID2D1DeviceContext::IsBufferPrecisionSupported([In] D2D1_BUFFER_PRECISION bufferPrecision)

public bool IsBufferPrecisionSupported(BufferPrecision bufferPrecision)

Parameters

bufferPrecision BufferPrecision

Returns

bool

IsDxgiFormatSupported(Format)

BOOL ID2D1DeviceContext::IsDxgiFormatSupported([In] DXGI_FORMAT format)

public bool IsDxgiFormatSupported(Format format)

Parameters

format Format

Returns

bool

PushLayer(ref LayerParameters1, Layer)

void ID2D1DeviceContext::PushLayer([In] const D2D1_LAYER_PARAMETERS1* layerParameters,[In, Optional] ID2D1Layer* layer)

public void PushLayer(ref LayerParameters1 layerParameters, Layer layer = null)

Parameters

layerParameters LayerParameters1
layer Layer

SetPrimitiveBlend(PrimitiveBlend)

void ID2D1DeviceContext::SetPrimitiveBlend([In] D2D1_PRIMITIVE_BLEND primitiveBlend)

public void SetPrimitiveBlend(PrimitiveBlend primitiveBlend)

Parameters

primitiveBlend PrimitiveBlend

SetRenderingControls(RenderingControls)

void ID2D1DeviceContext::SetRenderingControls([In] const D2D1_RENDERING_CONTROLS* renderingControls)

public void SetRenderingControls(RenderingControls renderingControls)

Parameters

renderingControls RenderingControls

SetTarget(Image)

void ID2D1DeviceContext::SetTarget([In, Optional] ID2D1Image* image)

public void SetTarget(Image image)

Parameters

image Image

SetUnitMode(UnitMode)

void ID2D1DeviceContext::SetUnitMode([In] D2D1_UNIT_MODE unitMode)

public void SetUnitMode(UnitMode unitMode)

Parameters

unitMode UnitMode

Operators

explicit operator DeviceContext(IntPtr)

Performs an explicit conversion from System.IntPtr to DeviceContext.

public static explicit operator DeviceContext(IntPtr nativePointer)

Parameters

nativePointer System.IntPtr

Returns

DeviceContext