Class D2D1
Functions
public static class D2D1
- Inheritance
-
D2D1
- Inherited Members
Fields
DefaultDpi
The default DPI value.
public const float DefaultDpi = 96
Field Value
DefaultFlatteningTolerance
The default tolerance for geometric flattening operations. http://msdn.microsoft.com/en-us/library/windows/desktop/dd370975%28v=vs.85%29.aspx
public const float DefaultFlatteningTolerance = 0.25
Field Value
Methods
ComputeFlatteningTolerance(ref RawMatrix3x2, float, float, float)
Computes the appropriate flattening tolerance to pass to APIs that take a flattening tolerance (for instance,
public static float ComputeFlatteningTolerance(ref RawMatrix3x2 matrix, float dpiX = 96, float dpiY = 96, float maxZoomFactor = 1)
Parameters
matrix
RawMatrix3x2The matrix that will be applied subsequently to the geometry being flattened.
dpiX
floatThe horizontal DPI of the render target that the geometry will be rendered onto (a choice of 96 implies no DPI correction).
dpiY
floatThe vertical DPI of the render target that the geometry will be rendered onto (a choice of 96 implies no DPI correction).
maxZoomFactor
floatThe maximum amount of additional scaling (on top of any scaling implied by the matrix or the DPI) that will be applied to the geometry.
Returns
- float
The flattening tolerance.
ComputeMaximumScaleFactor(ref RawMatrix3x2)
Computes the maximum factor by which a given transform can stretch any vector.
public static float ComputeMaximumScaleFactor(ref RawMatrix3x2 matrix)
Parameters
matrix
RawMatrix3x2The input transform matrix.
Returns
- float
The scale factor.
Remarks
Formally, if M is the input matrix, this method will return the maximum value of |V * M| / |V| for all vectors V, where |.| denotes length.
Note??Since this describes how M affects vectors (rather than points), the translation components (_31 and _32) of M are ignored.?ConvertColorSpace(ColorSpace, ColorSpace, RawColor4)
Converts the given color from one colorspace to another.
public static RawColor4 ConvertColorSpace(ColorSpace sourceColorSpace, ColorSpace destinationColorSpace, RawColor4 color)
Parameters
sourceColorSpace
ColorSpaceThe source color space.
destinationColorSpace
ColorSpaceThe destination color space.
color
RawColor4The source color.
Returns
- RawColor4
The converted color.
CreateDevice(Device, CreationProperties?, Device)
Creates a new Direct2D device associated with the provided DXGI device.
public static void CreateDevice(Device dxgiDevice, CreationProperties? creationProperties, Device d2dDevice)
Parameters
dxgiDevice
DeviceThe DXGI device the Direct2D device is associated with.
creationProperties
CreationProperties?The properties to apply to the Direct2D device.
d2dDevice
DeviceWhen this function returns, contains the address of a reference to a Direct2D device.
Remarks
This function will also create a new Factory1 that can be retrieved through ID2D1Resource::GetFactory.
If the creation properties are not specified, then d2dDevice will inherit its threading mode from dxgiDevice and debug tracing will not be enabled.
CreateDeviceContext(Surface, CreationProperties?, DeviceContext)
Creates a new Direct2D device context associated with a DXGI surface.
public static void CreateDeviceContext(Surface dxgiSurface, CreationProperties? creationProperties, DeviceContext d2dDeviceContext)
Parameters
dxgiSurface
SurfaceThe DXGI surface the Direct2D device context is associated with.
creationProperties
CreationProperties?The properties to apply to the Direct2D device context.
d2dDeviceContext
DeviceContextWhen this function returns, contains the address of a reference to a Direct2D device context.
Remarks
This function will also create a new Factory1 that can be retrieved through ID2D1Resource::GetFactory.
This function will also create a new Device that can be retrieved through ID2D1DeviceContext::GetDevice.
The DXGI device will be specified implicitly through dxgiSurface.
If creationProperties are not specified, the Direct2D device will inherit its threading mode from the DXGI device implied by dxgiSurface and debug tracing will not be enabled.
CreateFactory(FactoryType, Guid, FactoryOptions?, out nint)
Creates a factory object that can be used to create Direct2D resources.
public static void CreateFactory(FactoryType factoryType, Guid riid, FactoryOptions? factoryOptionsRef, out nint iFactoryOut)
Parameters
factoryType
FactoryTypeThe threading model of the factory and the resources it creates.
riid
GuidA reference to the IID of Factory that is obtained by using __uuidof(Factory).
factoryOptionsRef
FactoryOptions?The level of detail provided to the debugging layer.
iFactoryOut
nintWhen this method returns, contains the address to a reference to the new factory.
Remarks
The Factory interface provides the starting point for Direct2D. In general, objects created from a single instance of a factory object can be used with other resources created from that instance, but not with resources created by other factory instances.
GetGradientMeshInteriorPointsFromCoonsPatch(RawVector2, RawVector2, RawVector2, RawVector2, RawVector2, RawVector2, RawVector2, RawVector2, RawVector2, RawVector2, RawVector2, RawVector2, out RawVector2, out RawVector2, out RawVector2, out RawVector2)
Returns the interior points for a gradient mesh patch based on the points defining a Coons patch.
Note??This function is called by the GradientMeshPatchFromCoonsPatch function and is not intended to be used directly.
?public static void GetGradientMeshInteriorPointsFromCoonsPatch(RawVector2 point0Ref, RawVector2 point1Ref, RawVector2 point2Ref, RawVector2 point3Ref, RawVector2 point4Ref, RawVector2 point5Ref, RawVector2 point6Ref, RawVector2 point7Ref, RawVector2 point8Ref, RawVector2 point9Ref, RawVector2 point10Ref, RawVector2 point11Ref, out RawVector2 tensorPoint11Ref, out RawVector2 tensorPoint12Ref, out RawVector2 tensorPoint21Ref, out RawVector2 tensorPoint22Ref)
Parameters
point0Ref
RawVector2No documentation.
point1Ref
RawVector2No documentation.
point2Ref
RawVector2No documentation.
point3Ref
RawVector2No documentation.
point4Ref
RawVector2No documentation.
point5Ref
RawVector2No documentation.
point6Ref
RawVector2No documentation.
point7Ref
RawVector2No documentation.
point8Ref
RawVector2No documentation.
point9Ref
RawVector2No documentation.
point10Ref
RawVector2No documentation.
point11Ref
RawVector2No documentation.
tensorPoint11Ref
RawVector2No documentation.
tensorPoint12Ref
RawVector2No documentation.
tensorPoint21Ref
RawVector2No documentation.
tensorPoint22Ref
RawVector2No documentation.
Remarks
This function is called by the GradientMeshPatchFromCoonsPatch function and is not intended to be used directly.
InvertMatrix(ref RawMatrix3x2)
Tries to invert the specified matrix.
public static RawBool InvertMatrix(ref RawMatrix3x2 matrix)
Parameters
matrix
RawMatrix3x2The matrix to invert.
Returns
- RawBool
true if the matrix was inverted; otherwise, false.
IsMatrixInvertible(ref RawMatrix3x2)
Indicates whether the specified matrix is invertible.
public static RawBool IsMatrixInvertible(ref RawMatrix3x2 matrix)
Parameters
matrix
RawMatrix3x2The matrix to test.
Returns
- RawBool
true if the matrix was inverted; otherwise, false.
MakeRotateMatrix(float, RawVector2, out RawMatrix3x2)
Creates a rotation transformation that rotates by the specified angle about the specified point.
public static void MakeRotateMatrix(float angle, RawVector2 center, out RawMatrix3x2 matrix)
Parameters
angle
floatThe clockwise rotation angle, in degrees.
center
RawVector2The point about which to rotate.
matrix
RawMatrix3x2When this method returns, contains the new rotation transformation. You must allocate storage for this parameter.
Remarks
Rotation occurs in the plane of the 2-D surface.
MakeSkewMatrix(float, float, RawVector2, out RawMatrix3x2)
Creates a skew transformation that has the specified x-axis angle, y-axis angle, and center point.
public static void MakeSkewMatrix(float angleX, float angleY, RawVector2 center, out RawMatrix3x2 matrix)
Parameters
angleX
floatThe x-axis skew angle, which is measured in degrees counterclockwise from the y-axis.
angleY
floatThe y-axis skew angle, which is measured in degrees counterclockwise from the x-axis.
center
RawVector2The center point of the skew operation.
matrix
RawMatrix3x2When this method returns, contains the rotation transformation. You must allocate storate for this parameter.
SinCos(float, out float, out float)
Returns the sine and cosine of an angle.
public static void SinCos(float angle, out float s, out float c)
Parameters
Tan(float)
Returns the tangent of an angle.
public static float Tan(float angle)
Parameters
angle
floatThe angle to calculate the tangent for.
Returns
- float
The tangent of the angle.
Vec3Length(float, float, float)
Returns the length of a 3 dimensional vector.
public static float Vec3Length(float x, float y, float z)
Parameters
x
floatThe x value of the vector.
y
floatThe y value of the vector.
z
floatThe z value of the vector.
Returns
- float
The length of the vector.