Class D2D1Factory
Creates Direct2D resources.
Inherited Members
Namespace: JeremyAnsel.DirectX.D2D1
Assembly: JeremyAnsel.DirectX.D2D1.dll
Syntax
public sealed class D2D1Factory : IDisposable, ID2D1Releasable
Properties
| Edit this page View SourceHandle
Gets an handle representing the D2D1 object interface.
Declaration
public object Handle { get; }
Property Value
| Type | Description |
|---|---|
| object |
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, D2D1FactoryOptions)
Creates a factory object that can be used to create Direct2D resources.
Declaration
public static D2D1Factory? Create(D2D1FactoryType factoryType, 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(D2D1RenderTargetProperties)
Creates a render target that draws to a Windows Graphics Device Interface (GDI) device context.
Declaration
public D2D1DCRenderTarget? CreateDCRenderTarget(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(D2D1DrawingStateDescription)
Creates an D2D1DrawingStateBlock that can be used with the SaveDrawingState(D2D1DrawingStateBlock?) and RestoreDrawingState(D2D1DrawingStateBlock?) methods of a render target.
Declaration
public D2D1DrawingStateBlock? CreateDrawingStateBlock(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(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(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?, D2D1RenderTargetProperties)
Creates a render target that draws to a DirectX Graphics Infrastructure (DXGI) surface.
Declaration
public D2D1RenderTarget? CreateDxgiSurfaceRenderTarget(DxgiSurface? dxgiSurface, 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?, D2D1RenderTargetProperties)
Creates a render target that draws to a DirectX Graphics Infrastructure (DXGI) surface.
Declaration
public D2D1RenderTarget? CreateDxgiSurfaceRenderTarget(DxgiSurface1? dxgiSurface, 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?, D2D1RenderTargetProperties)
Creates a render target that draws to a DirectX Graphics Infrastructure (DXGI) surface.
Declaration
public D2D1RenderTarget? CreateDxgiSurfaceRenderTarget(DxgiSurface2? dxgiSurface, 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?, D2D1RenderTargetProperties)
Creates a render target that draws to a DirectX Graphics Infrastructure (DXGI) surface.
Declaration
public D2D1RenderTarget? CreateDxgiSurfaceRenderTarget(DxgiSurface3? dxgiSurface, 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(D2D1Ellipse)
Creates an D2D1EllipseGeometry.
Declaration
public D2D1EllipseGeometry? CreateEllipseGeometry(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. |
CreateHwndRenderTarget(D2D1RenderTargetProperties, D2D1HwndRenderTargetProperties)
Creates an D2D1HwndRenderTarget, a render target that renders to a window.
Declaration
public D2D1HwndRenderTarget? CreateHwndRenderTarget(D2D1RenderTargetProperties renderTargetProperties, 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(D2D1RectF)
Creates an D2D1RectangleGeometry.
Declaration
public D2D1RectangleGeometry? CreateRectangleGeometry(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(D2D1RoundedRect)
Creates an D2D1RoundedRectangleGeometry.
Declaration
public D2D1RoundedRectangleGeometry? CreateRoundedRectangleGeometry(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(D2D1StrokeStyleProperties, float[]?)
Creates an D2D1StrokeStyle that describes start cap, dash pattern, and other features of a stroke.
Declaration
public D2D1StrokeStyle? CreateStrokeStyle(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?, D2D1Matrix3X2F)
Transforms the specified geometry and stores the result as an D2D1TransformedGeometry object.
Declaration
public D2D1TransformedGeometry? CreateTransformedGeometry(D2D1Geometry? sourceGeometry, 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(object?, D2D1RenderTargetProperties)
Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap.
Declaration
public D2D1RenderTarget? CreateWicBitmapRenderTarget(object? target, D2D1RenderTargetProperties renderTargetProperties)
Parameters
| Type | Name | Description |
|---|---|---|
| object | 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. |
Dispose()
Immediately releases the unmanaged resources used by the D2D1Factory object.
Declaration
public void Dispose()
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. |
Release()
Releases the managed reference to the COM D2D1 interface.
Declaration
public void Release()
ReloadSystemMetrics()
Forces the factory to refresh any system defaults that it might have changed since factory creation.
Declaration
public void ReloadSystemMetrics()
ToBoolean()
Gets a boolean indicating if the handle is not null.
Declaration
public bool ToBoolean()
Returns
| Type | Description |
|---|---|
| bool | A boolean |
Operators
| Edit this page View Sourceimplicit operator bool(D2D1Factory?)
Gets a boolean indicating if the handle is not null.
Declaration
public static implicit operator bool(D2D1Factory? value)
Parameters
| Type | Name | Description |
|---|---|---|
| D2D1Factory | value | A D2D1 object. |
Returns
| Type | Description |
|---|---|
| bool | A boolean |