Class D2D1Factory
Creates Direct2D resources.
Implements
Inherited Members
Namespace: JeremyAnsel.DirectX.D2D1
Assembly: JeremyAnsel.DirectX.D2D1.dll
Syntax
[SecurityCritical]
public class D2D1Factory : DXComObject, IDisposable
Constructors
| Edit this page View SourceD2D1Factory(nint)
Initializes a new instance of the D2D1Factory class.
Declaration
public D2D1Factory(nint comPtr)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | comPtr |
Fields
| Edit this page View SourceD2D1FactoryGuid
The interface GUID.
Declaration
public static readonly Guid D2D1FactoryGuid
Field Value
| Type | Description |
|---|---|
| Guid |
Methods
| Edit this page View SourceCreate(D2D1FactoryType)
Creates a factory object that can be used to create Direct2D resources.
Declaration
public static D2D1Factory Create(D2D1FactoryType factoryType)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1FactoryType | factoryType | The threading model of the factory and the resources it creates. |
Returns
| Type | Description |
|---|---|
| D2D1Factory | The new factory. |
Create(D2D1FactoryType, D2D1DebugLevel)
Creates a factory object that can be used to create Direct2D resources.
Declaration
public static D2D1Factory Create(D2D1FactoryType factoryType, D2D1DebugLevel debugLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1FactoryType | factoryType | The threading model of the factory and the resources it creates. |
| D2D1DebugLevel | debugLevel | The level of detail provided to the debugging layer. |
Returns
| Type | Description |
|---|---|
| D2D1Factory | The new factory. |
Create(D2D1FactoryType, in D2D1FactoryOptions)
Creates a factory object that can be used to create Direct2D resources.
Declaration
public static D2D1Factory Create(D2D1FactoryType factoryType, in D2D1FactoryOptions factoryOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1FactoryType | factoryType | The threading model of the factory and the resources it creates. |
| D2D1FactoryOptions | factoryOptions | The level of detail provided to the debugging layer. |
Returns
| Type | Description |
|---|---|
| D2D1Factory | The new factory. |
CreateDCRenderTarget(in D2D1RenderTargetProperties)
Creates a render target that draws to a Windows Graphics Device Interface (GDI) device context.
Declaration
public D2D1DCRenderTarget CreateDCRenderTarget(in D2D1RenderTargetProperties renderTargetProperties)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1RenderTargetProperties | renderTargetProperties | The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering. |
Returns
| Type | Description |
|---|---|
| D2D1DCRenderTarget | The D2D1DCRenderTarget created by the method. |
CreateDrawingStateBlock()
Creates an D2D1DrawingStateBlock that can be used with the SaveDrawingState(D2D1DrawingStateBlock?) and RestoreDrawingState(D2D1DrawingStateBlock?) methods of a render target.
Declaration
public D2D1DrawingStateBlock CreateDrawingStateBlock()
Returns
| Type | Description |
|---|---|
| D2D1DrawingStateBlock | The new drawing state block created by this method. |
CreateDrawingStateBlock(in D2D1DrawingStateDescription)
Creates an D2D1DrawingStateBlock that can be used with the SaveDrawingState(D2D1DrawingStateBlock?) and RestoreDrawingState(D2D1DrawingStateBlock?) methods of a render target.
Declaration
public D2D1DrawingStateBlock CreateDrawingStateBlock(in D2D1DrawingStateDescription drawingStateDescription)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1DrawingStateDescription | drawingStateDescription | A structure that contains antialiasing, transform, and tags information. |
Returns
| Type | Description |
|---|---|
| D2D1DrawingStateBlock | The new drawing state block created by this method. |
CreateDrawingStateBlock(in D2D1DrawingStateDescription, DWriteRenderingParams?)
Creates an D2D1DrawingStateBlock that can be used with the SaveDrawingState(D2D1DrawingStateBlock?) and RestoreDrawingState(D2D1DrawingStateBlock?) methods of a render target.
Declaration
public D2D1DrawingStateBlock CreateDrawingStateBlock(in D2D1DrawingStateDescription drawingStateDescription, DWriteRenderingParams? textRenderingParams)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1DrawingStateDescription | drawingStateDescription | A structure that contains antialiasing, transform, and tags information. |
| DWriteRenderingParams | textRenderingParams | Optional text parameters that indicate how text should be rendered. |
Returns
| Type | Description |
|---|---|
| D2D1DrawingStateBlock | The new drawing state block created by this method. |
CreateDrawingStateBlock(DWriteRenderingParams?)
Creates an D2D1DrawingStateBlock that can be used with the SaveDrawingState(D2D1DrawingStateBlock?) and RestoreDrawingState(D2D1DrawingStateBlock?) methods of a render target.
Declaration
public D2D1DrawingStateBlock CreateDrawingStateBlock(DWriteRenderingParams? textRenderingParams)
Parameters
| Type | Name | Description |
|---|---|---|
| DWriteRenderingParams | textRenderingParams | Optional text parameters that indicate how text should be rendered. |
Returns
| Type | Description |
|---|---|
| D2D1DrawingStateBlock | The new drawing state block created by this method. |
CreateDxgiSurfaceRenderTarget(DxgiSurface?, in D2D1RenderTargetProperties)
Creates a render target that draws to a DirectX Graphics Infrastructure (DXGI) surface.
Declaration
public D2D1RenderTarget CreateDxgiSurfaceRenderTarget(DxgiSurface? dxgiSurface, in D2D1RenderTargetProperties renderTargetProperties)
Parameters
| Type | Name | Description |
|---|---|---|
| DxgiSurface | dxgiSurface | The DxgiSurface to which the render target will draw. |
| D2D1RenderTargetProperties | renderTargetProperties | The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering. |
Returns
| Type | Description |
|---|---|
| D2D1RenderTarget | The D2D1RenderTarget object created by this method. |
CreateDxgiSurfaceRenderTarget(DxgiSurface1?, in D2D1RenderTargetProperties)
Creates a render target that draws to a DirectX Graphics Infrastructure (DXGI) surface.
Declaration
public D2D1RenderTarget CreateDxgiSurfaceRenderTarget(DxgiSurface1? dxgiSurface, in D2D1RenderTargetProperties renderTargetProperties)
Parameters
| Type | Name | Description |
|---|---|---|
| DxgiSurface1 | dxgiSurface | The DxgiSurface1 to which the render target will draw. |
| D2D1RenderTargetProperties | renderTargetProperties | The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering. |
Returns
| Type | Description |
|---|---|
| D2D1RenderTarget | The D2D1RenderTarget object created by this method. |
CreateDxgiSurfaceRenderTarget(DxgiSurface2?, in D2D1RenderTargetProperties)
Creates a render target that draws to a DirectX Graphics Infrastructure (DXGI) surface.
Declaration
public D2D1RenderTarget CreateDxgiSurfaceRenderTarget(DxgiSurface2? dxgiSurface, in D2D1RenderTargetProperties renderTargetProperties)
Parameters
| Type | Name | Description |
|---|---|---|
| DxgiSurface2 | dxgiSurface | The DxgiSurface2 to which the render target will draw. |
| D2D1RenderTargetProperties | renderTargetProperties | The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering. |
Returns
| Type | Description |
|---|---|
| D2D1RenderTarget | The D2D1RenderTarget object created by this method. |
CreateDxgiSurfaceRenderTarget(DxgiSurface3?, in D2D1RenderTargetProperties)
Creates a render target that draws to a DirectX Graphics Infrastructure (DXGI) surface.
Declaration
public D2D1RenderTarget CreateDxgiSurfaceRenderTarget(DxgiSurface3? dxgiSurface, in D2D1RenderTargetProperties renderTargetProperties)
Parameters
| Type | Name | Description |
|---|---|---|
| DxgiSurface3 | dxgiSurface | The DxgiSurface3 to which the render target will draw. |
| D2D1RenderTargetProperties | renderTargetProperties | The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering. |
Returns
| Type | Description |
|---|---|
| D2D1RenderTarget | The D2D1RenderTarget object created by this method. |
CreateEllipseGeometry(in D2D1Ellipse)
Creates an D2D1EllipseGeometry.
Declaration
public D2D1EllipseGeometry CreateEllipseGeometry(in D2D1Ellipse ellipse)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1Ellipse | ellipse | A value that describes the center point, x-radius, and y-radius of the ellipse geometry. |
Returns
| Type | Description |
|---|---|
| D2D1EllipseGeometry | The ellipse geometry created by this method. |
CreateGeometryGroup(D2D1FillMode, D2D1Geometry[]?)
Creates an D2D1GeometryGroup, which is an object that holds other geometries.
Declaration
public D2D1GeometryGroup CreateGeometryGroup(D2D1FillMode fillMode, D2D1Geometry[]? geometries)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1FillMode | fillMode | A value that specifies the rule that a composite shape uses to determine whether a given point is part of the geometry. |
| D2D1Geometry[] | geometries | An array containing the geometry objects to add to the geometry group. |
Returns
| Type | Description |
|---|---|
| D2D1GeometryGroup | The geometry group created by this method. |
CreateGeometryGroup(D2D1FillMode, ReadOnlySpan<D2D1Geometry>)
Creates an D2D1GeometryGroup, which is an object that holds other geometries.
Declaration
public D2D1GeometryGroup CreateGeometryGroup(D2D1FillMode fillMode, ReadOnlySpan<D2D1Geometry> geometries)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1FillMode | fillMode | A value that specifies the rule that a composite shape uses to determine whether a given point is part of the geometry. |
| ReadOnlySpan<D2D1Geometry> | geometries | An array containing the geometry objects to add to the geometry group. |
Returns
| Type | Description |
|---|---|
| D2D1GeometryGroup | The geometry group created by this method. |
CreateHwndRenderTarget(in D2D1RenderTargetProperties, in D2D1HwndRenderTargetProperties)
Creates an D2D1HwndRenderTarget, a render target that renders to a window.
Declaration
public D2D1HwndRenderTarget CreateHwndRenderTarget(in D2D1RenderTargetProperties renderTargetProperties, in D2D1HwndRenderTargetProperties hwndRenderTargetProperties)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1RenderTargetProperties | renderTargetProperties | The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering. |
| D2D1HwndRenderTargetProperties | hwndRenderTargetProperties | The window handle, initial size (in pixels), and present options. |
Returns
| Type | Description |
|---|---|
| D2D1HwndRenderTarget | The D2D1HwndRenderTarget object created by this method. |
CreatePathGeometry()
Creates an empty D2D1PathGeometry.
Declaration
public D2D1PathGeometry CreatePathGeometry()
Returns
| Type | Description |
|---|---|
| D2D1PathGeometry | The path geometry created by this method. |
CreateRectangleGeometry(in D2D1RectF)
Creates an D2D1RectangleGeometry.
Declaration
public D2D1RectangleGeometry CreateRectangleGeometry(in D2D1RectF rectangle)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1RectF | rectangle | The coordinates of the rectangle geometry. |
Returns
| Type | Description |
|---|---|
| D2D1RectangleGeometry | The rectangle geometry created by this method. |
CreateRoundedRectangleGeometry(in D2D1RoundedRect)
Creates an D2D1RoundedRectangleGeometry.
Declaration
public D2D1RoundedRectangleGeometry CreateRoundedRectangleGeometry(in D2D1RoundedRect roundedRectangle)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1RoundedRect | roundedRectangle | The coordinates and corner radii of the rounded rectangle geometry. |
Returns
| Type | Description |
|---|---|
| D2D1RoundedRectangleGeometry | The rounded rectangle geometry created by this method. |
CreateStrokeStyle(in D2D1StrokeStyleProperties, ReadOnlySpan<float>)
Creates an D2D1StrokeStyle that describes start cap, dash pattern, and other features of a stroke.
Declaration
public D2D1StrokeStyle CreateStrokeStyle(in D2D1StrokeStyleProperties strokeStyleProperties, ReadOnlySpan<float> dashes)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1StrokeStyleProperties | strokeStyleProperties | A structure that describes the stroke's line cap, dash offset, and other details of a stroke. |
| ReadOnlySpan<float> | dashes | An array whose elements are set to the length of each dash and space in the dash pattern. The first element sets the length of a dash, the second element sets the length of a space, the third element sets the length of a dash, and so on. The length of each dash and space in the dash pattern is the product of the element value in the array and the stroke width. |
Returns
| Type | Description |
|---|---|
| D2D1StrokeStyle | The stroke style created by this method. |
CreateStrokeStyle(in D2D1StrokeStyleProperties, float[]?)
Creates an D2D1StrokeStyle that describes start cap, dash pattern, and other features of a stroke.
Declaration
public D2D1StrokeStyle CreateStrokeStyle(in D2D1StrokeStyleProperties strokeStyleProperties, float[]? dashes)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1StrokeStyleProperties | strokeStyleProperties | A structure that describes the stroke's line cap, dash offset, and other details of a stroke. |
| float[] | dashes | An array whose elements are set to the length of each dash and space in the dash pattern. The first element sets the length of a dash, the second element sets the length of a space, the third element sets the length of a dash, and so on. The length of each dash and space in the dash pattern is the product of the element value in the array and the stroke width. |
Returns
| Type | Description |
|---|---|
| D2D1StrokeStyle | The stroke style created by this method. |
CreateTransformedGeometry(D2D1Geometry?, in D2D1Matrix3X2F)
Transforms the specified geometry and stores the result as an D2D1TransformedGeometry object.
Declaration
public D2D1TransformedGeometry CreateTransformedGeometry(D2D1Geometry? sourceGeometry, in D2D1Matrix3X2F transform)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1Geometry | sourceGeometry | The geometry to transform. |
| D2D1Matrix3X2F | transform | The transformation to apply. |
Returns
| Type | Description |
|---|---|
| D2D1TransformedGeometry | The new transformed geometry object. |
CreateWicBitmapRenderTarget(DXComObject, in D2D1RenderTargetProperties)
Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap.
Declaration
public D2D1RenderTarget CreateWicBitmapRenderTarget(DXComObject target, in D2D1RenderTargetProperties renderTargetProperties)
Parameters
| Type | Name | Description |
|---|---|---|
| DXComObject | target | The bitmap that receives the rendering output of the render target. |
| D2D1RenderTargetProperties | renderTargetProperties | The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering. |
Returns
| Type | Description |
|---|---|
| D2D1RenderTarget | The D2D1RenderTarget object created by this method. |
CreateWicBitmapRenderTarget(nint, in D2D1RenderTargetProperties)
Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap.
Declaration
public D2D1RenderTarget CreateWicBitmapRenderTarget(nint target, in D2D1RenderTargetProperties renderTargetProperties)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | target | The bitmap that receives the rendering output of the render target. |
| D2D1RenderTargetProperties | renderTargetProperties | The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering. |
Returns
| Type | Description |
|---|---|
| D2D1RenderTarget | The D2D1RenderTarget object created by this method. |
GetDesktopDpi(out float, out float)
Retrieves the current desktop dots per inch (DPI). To refresh this value, call ReloadSystemMetrics().
Declaration
public void GetDesktopDpi(out float dpiX, out float dpiY)
Parameters
| Type | Name | Description |
|---|---|---|
| float | dpiX | The horizontal DPI of the desktop. |
| float | dpiY | The vertical DPI of the desktop. |
ReloadSystemMetrics()
Forces the factory to refresh any system defaults that it might have changed since factory creation.
Declaration
public void ReloadSystemMetrics()