ID2D1DeviceContext interface
Represents a set of state and command buffers that are used to render to a target.
The device context can render to a target bitmap or a command list.
When to implement
Custom implementations are not supported.
Members
The ID2D1DeviceContext interface inherits from ID2D1RenderTarget. ID2D1DeviceContext also has these types of members:
Methods
The ID2D1DeviceContext interface has these methods.
| Method | Description |
|---|---|
| CreateBitmap | Overloaded. Creates a bitmap that can be used as a target surface, for reading back to the CPU, or as a source for the DrawBitmap and ID2D1BitmapBrush APIs. In addition, color context information can be passed to the bitmap. |
| CreateBitmapBrush | Overloaded. Creates a bitmap brush, the input image is a Direct2D bitmap object. |
| CreateBitmapFromDxgiSurface | Overloaded. Creates a bitmap from a DXGI surface that can be set as a target surface or have additional color context information specified. |
| CreateBitmapFromWicBitmap | Overloaded. Creates a Direct2D bitmap by copying a WIC bitmap. |
| CreateColorContext |
Creates a color context. |
| CreateColorContextFromFilename |
Creates a color context by loading it from the specified filename. The profile bytes are the contents of the file specified by Filename. |
| CreateColorContextFromWicColorContext |
Creates a color context from an IWICColorContext. The D2D1ColorContext space of the resulting context varies, see Remarks for more info. |
| CreateCommandList |
Creates a ID2D1CommandList object. |
| CreateEffect |
Creates an effect for the specified class ID. |
| CreateGradientStopCollection |
Creates a gradient stop collection, enabling the gradient to contain color channels with values outside of [0,1] and also enabling rendering to a high-color render target with interpolation in sRGB space. |
| CreateImageBrush | Overloaded. Creates an image brush. The input image can be any type of image, including a bitmap, effect, or a command list. |
| DrawBitmap | Overloaded. Draws a bitmap to the render target. |
| DrawGdiMetafile | Overloaded. Draw a metafile to the device context. |
| DrawGlyphRun |
Draws a series of glyphs to the device context. |
| DrawImage | Overloaded. Draws an image to the device context. |
| FillOpacityMask | Overloaded. Fill using the alpha channel of the supplied opacity mask bitmap. The brush opacity will be modulated by the mask. The render target antialiasing mode must be set to aliased. |
| GetDevice |
Gets the device associated with a device context. |
| GetEffectInvalidRectangleCount |
Gets the number of invalid output rectangles that have accumulated on the effect. |
| GetEffectInvalidRectangles |
Gets the invalid rectangles that have accumulated since the last time the effect was drawn and EndDraw was then called on the device context. |
| GetEffectRequiredInputRectangles |
Returns the input rectangles that are required to be supplied by the caller to produce the given output rectangle. |
| GetGlyphRunWorldBounds |
Gets the world-space bounds in DIPs of the glyph run using the device context DPI. |
| GetImageLocalBounds |
Gets the bounds of an image without the world transform of the context applied. |
| GetImageWorldBounds |
Gets the bounds of an image with the world transform of the context applied. |
| GetPrimitiveBlend |
Returns the currently set primitive blend used by the device context. |
| GetRenderingControls |
Gets the rendering controls that have been applied to the context. |
| GetTarget |
Gets the target currently associated with the device context. |
| GetUnitMode |
Gets the mode that is being used to interpret values by the device context. |
| InvalidateEffectInputRectangle |
This indicates that a portion of an effect's input is invalid. This method can be called many times. |
| IsBufferPrecisionSupported |
Indicates whether the buffer precision is supported by the underlying Direct3D device. |
| IsDxgiFormatSupported |
Indicates whether the format is supported by the device context. |
| PushLayer |
Push a layer onto the clip and layer stack of the device context. |
| SetPrimitiveBlend |
Changes the primitive blend mode that is used for all rendering operations in the device context. |
| SetRenderingControls |
Sets the rendering controls for the given device context. |
| SetTarget |
The bitmap or command list to which the Direct2D device context will now render. |
| SetUnitMode |
Sets what units will be used to interpret values passed into the device context. |
Remarks
Any resource created from a device context can be shared with any other resource created from a device context when both contexts are created on the same device.
Requirements
|
Minimum supported client |
Windows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | Windows Store apps] |
|
Minimum supported phone |
Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps] |
|
Header |
|
|
DLL |
|
See also
- ID2D1RenderTarget
- Devices and Device Contexts
- D2D1CreateDeviceContext
- ID2D1Device::CreateDeviceContext