C# Класс SharpDX.Direct2D1.RenderTarget

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
DrawBitmap ( Bitmap bitmap, float opacity, BitmapInterpolationMode interpolationMode ) : void

Draws the specified bitmap after scaling it to the size of the specified rectangle.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawBitmap}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawBitmap ( Bitmap bitmap, float opacity, BitmapInterpolationMode interpolationMode, RawRectangleF sourceRectangle ) : void

Draws the specified bitmap after scaling it to the size of the specified rectangle.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawBitmap}}) failed, check the result returned by the EndDraw() or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawBitmap ( SharpDX bitmap, RawRectangleF destinationRectangle, float opacity, SharpDX interpolationMode ) : void

Draws the specified bitmap after scaling it to the size of the specified rectangle.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawBitmap}}) failed, check the result returned by the EndDraw() or Flush() methods.

DrawEllipse ( SharpDX.Direct2D1.Ellipse ellipse, Brush brush ) : void

Draws the outline of the specified ellipse using the specified stroke style.

The {{DrawEllipse}} method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawEllipse) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawEllipse ( SharpDX.Direct2D1.Ellipse ellipse, Brush brush, float strokeWidth ) : void

Draws the outline of the specified ellipse using the specified stroke style.

The {{DrawEllipse}} method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawEllipse) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawGeometry ( SharpDX.Direct2D1.Geometry geometry, Brush brush ) : void

Draws the outline of the specified geometry.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGeometry) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawGeometry ( SharpDX.Direct2D1.Geometry geometry, Brush brush, float strokeWidth ) : void

Draws the outline of the specified geometry.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGeometry) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawLine ( RawVector2 point0, RawVector2 point1, Brush brush ) : void

Draws a line between the specified points.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawLine) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawLine ( RawVector2 point0, RawVector2 point1, Brush brush, float strokeWidth ) : void

Draws a line between the specified points.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawLine) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawRectangle ( RawRectangleF rect, Brush brush ) : void

Draws the outline of a rectangle that has the specified dimensions.

When this method fails, it does not return an error code. To determine whether a drawing method (such as {{DrawRectangle}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) method.

DrawRectangle ( RawRectangleF rect, Brush brush, float strokeWidth ) : void

Draws the outline of a rectangle that has the specified dimensions and stroke style.

When this method fails, it does not return an error code. To determine whether a drawing method (such as {{DrawRectangle}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) method.

DrawRoundedRectangle ( RoundedRectangle roundedRect, Brush brush ) : void

Draws the outline of the specified rounded rectangle.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawRoundedRectangle}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawRoundedRectangle ( RoundedRectangle roundedRect, Brush brush, float strokeWidth ) : void

Draws the outline of the specified rounded rectangle.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawRoundedRectangle}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawRoundedRectangle ( RoundedRectangle roundedRect, Brush brush, float strokeWidth, SharpDX.Direct2D1.StrokeStyle strokeStyle ) : void

Draws the outline of the specified rounded rectangle using the specified stroke style.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawRoundedRectangle}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawText ( string text, SharpDX.DirectWrite.TextFormat textFormat, RawRectangleF layoutRect, Brush defaultForegroundBrush ) : void

Draws the specified text using the format information provided by an T:SharpDX.DirectWrite.TextFormat object.

To create an T:SharpDX.DirectWrite.TextFormat object, create an T:SharpDX.DirectWrite.Factory and call its {{CreateTextFormat}} method. This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawText}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawText ( string text, SharpDX.DirectWrite.TextFormat textFormat, RawRectangleF layoutRect, Brush defaultForegroundBrush, DrawTextOptions options ) : void

Draws the specified text using the format information provided by an T:SharpDX.DirectWrite.TextFormat object.

To create an T:SharpDX.DirectWrite.TextFormat object, create an T:SharpDX.DirectWrite.Factory and call its {{CreateTextFormat}} method. This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawText}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawText ( string text, SharpDX.DirectWrite.TextFormat textFormat, RawRectangleF layoutRect, Brush defaultForegroundBrush, DrawTextOptions options, MeasuringMode measuringMode ) : void

Draws the specified text using the format information provided by an T:SharpDX.DirectWrite.TextFormat object.

To create an T:SharpDX.DirectWrite.TextFormat object, create an T:SharpDX.DirectWrite.Factory and call its {{CreateTextFormat}} method. This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawText}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

DrawTextLayout ( RawVector2 origin, TextLayout textLayout, Brush defaultForegroundBrush ) : void

Draws the formatted text described by the specified T:SharpDX.DirectWrite.TextLayout object.

When drawing the same text repeatedly, using the DrawTextLayout method is more efficient than using the {{DrawText}} method because the text doesn't need to be formatted and the layout processed with each call. This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawTextLayout) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

EndDraw ( ) : void

Ends drawing operations on the render target and indicates the current error state and associated tags.

Drawing operations can only be issued between a {{BeginDraw}} and EndDraw call.BeginDraw and EndDraw are use to indicate that a render target is in use by the Direct2D system. Different implementations of SharpDX.Direct2D1.RenderTarget might behave differently when {{BeginDraw}} is called. An SharpDX.Direct2D1.BitmapRenderTarget may be locked between BeginDraw/EndDraw calls, a DXGI surface render target might be acquired on BeginDraw and released on EndDraw, while an WindowRenderTarget may begin batching at BeginDraw and may present on EndDraw, for example. The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval operations can be performed even outside of {{BeginDraw}}/EndDraw. After {{BeginDraw}} is called, a render target will normally build up a batch of rendering commands, but defer processing of these commands until either an internal buffer is full, the {{Flush}} method is called, or until EndDraw is called. The EndDraw method causes any batched drawing operations to complete, and then returns an HRESULT indicating the success of the operations and, optionally, the tag state of the render target at the time the error occurred. The EndDraw method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing HRESULT. If EndDraw is called without a matched call to {{BeginDraw}}, it returns an error indicating that BeginDraw must be called before EndDraw. Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and returns an appropriate HRESULT and error information when EndDraw is called.

EndDraw ( long &tag1, long &tag2 ) : void

Ends drawing operations on the render target and indicates the current error state and associated tags.

Drawing operations can only be issued between a BeginDraw and EndDraw call.

BeginDraw and EndDraw are use to indicate that a render target is in use by the Direct2D system. Different implementations of SharpDX.Direct2D1.RenderTarget might behave differently when BeginDraw is called. An SharpDX.Direct2D1.BitmapRenderTarget may be locked between BeginDraw/EndDraw calls, a DXGI surface render target might be acquired on BeginDraw and released on EndDraw, while an SharpDX.Direct2D1.WindowRenderTarget may begin batching at BeginDraw and may present on EndDraw, for example.

The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval operations can be performed even outside of BeginDraw/EndDraw.

After BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing of these commands until either an internal buffer is full, the Flush method is called, or until EndDraw is called. The EndDraw method causes any batched drawing operations to complete, and then returns an SharpDX.Result indicating the success of the operations and, optionally, the tag state of the render target at the time the error occurred. The EndDraw method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing SharpDX.Result.

If EndDraw is called without a matched call to BeginDraw, it returns an error indicating that BeginDraw must be called before EndDraw. Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and returns an appropriate SharpDX.Result and error information when EndDraw is called.

FillGeometry ( SharpDX geometry, SharpDX brush ) : void

Paints the interior of the specified geometry.

If the opacityBrush parameter is not NULL, the alpha value of each pixel of the mapped opacityBrush is used to determine the resulting opacity of each corresponding pixel of the geometry. Only the alpha value of each color in the brush is used for this processing; all other color information is ignored. The alpha value specified by the brush is multiplied by the alpha value of the geometry after the geometry has been painted by brush. When this method fails, it does not return an error code. To determine whether a drawing operation (such as FillGeometry) failed, check the result returned by the EndDraw() or Flush() method.

FillOpacityMask ( Bitmap opacityMask, Brush brush, OpacityMaskContent content ) : void

Applies the opacity mask described by the specified bitmap to a brush and uses that brush to paint a region of the render target.

For this method to work properly, the render target must be using the F:SharpDX.Direct2D1.AntialiasMode.Aliased antialiasing mode. You can set the antialiasing mode by calling the M:SharpDX.Direct2D1.RenderTarget.SetAntialiasMode(SharpDX.Direct2D1.AntialiasMode) method. This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{FillOpacityMask}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

FillRoundedRectangle ( RoundedRectangle roundedRect, Brush brush ) : void

Paints the interior of the specified rounded rectangle.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{FillRoundedRectangle}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.

Flush ( ) : void

Executes all pending drawing commands.

This command does not flush the device that is associated with the render target. Calling this method resets the error state of the render target.

RenderTarget ( Factory factory, SharpDX.DXGI.Surface dxgiSurface, SharpDX.Direct2D1.RenderTargetProperties properties ) : System

Creates a render target that draws to a DirectX Graphics Infrastructure (DXGI) surface.

To write to a Direct3D surface, you obtain an SharpDX.DXGI.Surface and pass it to the {{CreateDxgiSurfaceRenderTarget}} method to create a DXGI surface render target; you can then use the DXGI surface render target to draw 2-D content to the DXGI surface. A DXGI surface render target is a type of SharpDX.Direct2D1.RenderTarget. Like other Direct2D render targets, you can use it to create resources and issue drawing commands. The DXGI surface render target and the DXGI surface must use the same DXGI format. If you specify the {{DXGI_FORMAT_UNKOWN}} format when you create the render target, it will automatically use the surface's format.The DXGI surface render target does not perform DXGI surface synchronization. To work with Direct2D, the Direct3D device that provides the SharpDX.DXGI.Surface must be created with the D3D10_CREATE_DEVICE_BGRA_SUPPORT flag.For more information about creating and using DXGI surface render targets, see the {{Direct2D and Direct3D Interoperability Overview}}.When you create a render target and hardware acceleration is available, you allocate resources on the computer's GPU. By creating a render target once and retaining it as long as possible, you gain performance benefits. Your application should create render targets once and hold onto them for the life of the application or until the render target's {{EndDraw}} method returns the {{D2DERR_RECREATE_TARGET}} error. When you receive this error, you need to recreate the render target (and any resources it created).

Описание методов

DrawBitmap() публичный Метод

Draws the specified bitmap after scaling it to the size of the specified rectangle.
This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawBitmap}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawBitmap ( Bitmap bitmap, float opacity, BitmapInterpolationMode interpolationMode ) : void
bitmap Bitmap The bitmap to render.
opacity float A value between 0.0f and 1.0f, inclusive, that specifies an opacity value to apply to the bitmap; this value is multiplied against the alpha values of the bitmap's contents. The default value is 1.0f.
interpolationMode BitmapInterpolationMode The interpolation mode to use if the bitmap is scaled or rotated by the drawing operation. The default value is .
Результат void

DrawBitmap() публичный Метод

Draws the specified bitmap after scaling it to the size of the specified rectangle.
This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawBitmap}}) failed, check the result returned by the EndDraw() or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawBitmap ( Bitmap bitmap, float opacity, BitmapInterpolationMode interpolationMode, RawRectangleF sourceRectangle ) : void
bitmap Bitmap The bitmap to render.
opacity float A value between 0.0f and 1.0f, inclusive, that specifies an opacity value to apply to the bitmap; this value is multiplied against the alpha values of the bitmap's contents. The default value is 1.0f.
interpolationMode BitmapInterpolationMode The interpolation mode to use if the bitmap is scaled or rotated by the drawing operation. The default value is .
sourceRectangle RawRectangleF The size and position, in device-independent pixels in the bitmap's coordinate space, of the area within the bitmap to be drawn; NULL to draw the entire bitmap.
Результат void

DrawBitmap() публичный Метод

Draws the specified bitmap after scaling it to the size of the specified rectangle.
This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawBitmap}}) failed, check the result returned by the EndDraw() or Flush() methods.
public DrawBitmap ( SharpDX bitmap, RawRectangleF destinationRectangle, float opacity, SharpDX interpolationMode ) : void
bitmap SharpDX The bitmap to render.
destinationRectangle RawRectangleF The size and position, in device-independent pixels in the render target's coordinate space, of the area to which the bitmap is drawn; NULL to draw the selected portion of the bitmap at the origin of the render target. If the rectangle is specified but not well-ordered, nothing is drawn, but the render target does not enter an error state.
opacity float A value between 0.0f and 1.0f, inclusive, that specifies an opacity value to apply to the bitmap; this value is multiplied against the alpha values of the bitmap's contents. The default value is 1.0f.
interpolationMode SharpDX The interpolation mode to use if the bitmap is scaled or rotated by the drawing operation. The default value is .
Результат void

DrawEllipse() публичный Метод

Draws the outline of the specified ellipse using the specified stroke style.
The {{DrawEllipse}} method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawEllipse) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawEllipse ( SharpDX.Direct2D1.Ellipse ellipse, Brush brush ) : void
ellipse SharpDX.Direct2D1.Ellipse The position and radius of the ellipse to draw, in device-independent pixels.
brush Brush The brush used to paint the ellipse's outline.
Результат void

DrawEllipse() публичный Метод

Draws the outline of the specified ellipse using the specified stroke style.
The {{DrawEllipse}} method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawEllipse) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawEllipse ( SharpDX.Direct2D1.Ellipse ellipse, Brush brush, float strokeWidth ) : void
ellipse SharpDX.Direct2D1.Ellipse The position and radius of the ellipse to draw, in device-independent pixels.
brush Brush The brush used to paint the ellipse's outline.
strokeWidth float The thickness of the ellipse's stroke. The stroke is centered on the ellipse's outline.
Результат void

DrawGeometry() публичный Метод

Draws the outline of the specified geometry.
This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGeometry) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawGeometry ( SharpDX.Direct2D1.Geometry geometry, Brush brush ) : void
geometry SharpDX.Direct2D1.Geometry The geometry to draw.
brush Brush The brush used to paint the geometry's stroke.
Результат void

DrawGeometry() публичный Метод

Draws the outline of the specified geometry.
This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawGeometry) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawGeometry ( SharpDX.Direct2D1.Geometry geometry, Brush brush, float strokeWidth ) : void
geometry SharpDX.Direct2D1.Geometry The geometry to draw.
brush Brush The brush used to paint the geometry's stroke.
strokeWidth float The thickness of the geometry's stroke. The stroke is centered on the geometry's outline.
Результат void

DrawLine() публичный Метод

Draws a line between the specified points.
This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawLine) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawLine ( RawVector2 point0, RawVector2 point1, Brush brush ) : void
point0 RawVector2 The start point of the line, in device-independent pixels.
point1 RawVector2 The end point of the line, in device-independent pixels.
brush Brush The brush used to paint the line's stroke.
Результат void

DrawLine() публичный Метод

Draws a line between the specified points.
This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawLine) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawLine ( RawVector2 point0, RawVector2 point1, Brush brush, float strokeWidth ) : void
point0 RawVector2 The start point of the line, in device-independent pixels.
point1 RawVector2 The end point of the line, in device-independent pixels.
brush Brush The brush used to paint the line's stroke.
strokeWidth float A value greater than or equal to 0.0f that specifies the width of the stroke. If this parameter isn't specified, it defaults to 1.0f. The stroke is centered on the line.
Результат void

DrawRectangle() публичный Метод

Draws the outline of a rectangle that has the specified dimensions.
When this method fails, it does not return an error code. To determine whether a drawing method (such as {{DrawRectangle}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) method.
public DrawRectangle ( RawRectangleF rect, Brush brush ) : void
rect RawRectangleF The dimensions of the rectangle to draw, in device-independent pixels.
brush Brush The brush used to paint the rectangle's stroke.
Результат void

DrawRectangle() публичный Метод

Draws the outline of a rectangle that has the specified dimensions and stroke style.
When this method fails, it does not return an error code. To determine whether a drawing method (such as {{DrawRectangle}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) method.
public DrawRectangle ( RawRectangleF rect, Brush brush, float strokeWidth ) : void
rect RawRectangleF The dimensions of the rectangle to draw, in device-independent pixels.
brush Brush The brush used to paint the rectangle's stroke.
strokeWidth float A value greater than or equal to 0.0f that specifies the width of the rectangle's stroke. The stroke is centered on the rectangle's outline.
Результат void

DrawRoundedRectangle() публичный Метод

Draws the outline of the specified rounded rectangle.
This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawRoundedRectangle}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawRoundedRectangle ( RoundedRectangle roundedRect, Brush brush ) : void
roundedRect RoundedRectangle The dimensions of the rounded rectangle to draw, in device-independent pixels.
brush Brush The brush used to paint the rounded rectangle's outline.
Результат void

DrawRoundedRectangle() публичный Метод

Draws the outline of the specified rounded rectangle.
This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawRoundedRectangle}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawRoundedRectangle ( RoundedRectangle roundedRect, Brush brush, float strokeWidth ) : void
roundedRect RoundedRectangle The dimensions of the rounded rectangle to draw, in device-independent pixels.
brush Brush The brush used to paint the rounded rectangle's outline.
strokeWidth float The width of the rounded rectangle's stroke. The stroke is centered on the rounded rectangle's outline. The default value is 1.0f.
Результат void

DrawRoundedRectangle() публичный Метод

Draws the outline of the specified rounded rectangle using the specified stroke style.
This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawRoundedRectangle}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawRoundedRectangle ( RoundedRectangle roundedRect, Brush brush, float strokeWidth, SharpDX.Direct2D1.StrokeStyle strokeStyle ) : void
roundedRect RoundedRectangle The dimensions of the rounded rectangle to draw, in device-independent pixels.
brush Brush The brush used to paint the rounded rectangle's outline.
strokeWidth float The width of the rounded rectangle's stroke. The stroke is centered on the rounded rectangle's outline. The default value is 1.0f.
strokeStyle SharpDX.Direct2D1.StrokeStyle The style of the rounded rectangle's stroke, or NULL to paint a solid stroke. The default value is NULL.
Результат void

DrawText() публичный Метод

Draws the specified text using the format information provided by an T:SharpDX.DirectWrite.TextFormat object.
To create an T:SharpDX.DirectWrite.TextFormat object, create an T:SharpDX.DirectWrite.Factory and call its {{CreateTextFormat}} method. This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawText}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawText ( string text, SharpDX.DirectWrite.TextFormat textFormat, RawRectangleF layoutRect, Brush defaultForegroundBrush ) : void
text string A reference to an array of Unicode characters to draw.
textFormat SharpDX.DirectWrite.TextFormat An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.
layoutRect RawRectangleF The size and position of the area in which the text is drawn.
defaultForegroundBrush Brush The brush used to paint the text.
Результат void

DrawText() публичный Метод

Draws the specified text using the format information provided by an T:SharpDX.DirectWrite.TextFormat object.
To create an T:SharpDX.DirectWrite.TextFormat object, create an T:SharpDX.DirectWrite.Factory and call its {{CreateTextFormat}} method. This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawText}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawText ( string text, SharpDX.DirectWrite.TextFormat textFormat, RawRectangleF layoutRect, Brush defaultForegroundBrush, DrawTextOptions options ) : void
text string A reference to an array of Unicode characters to draw.
textFormat SharpDX.DirectWrite.TextFormat An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.
layoutRect RawRectangleF The size and position of the area in which the text is drawn.
defaultForegroundBrush Brush The brush used to paint the text.
options DrawTextOptions A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the layout rectangle. The default value is , which indicates that text should be snapped to pixel boundaries and it should not be clipped to the layout rectangle.
Результат void

DrawText() публичный Метод

Draws the specified text using the format information provided by an T:SharpDX.DirectWrite.TextFormat object.
To create an T:SharpDX.DirectWrite.TextFormat object, create an T:SharpDX.DirectWrite.Factory and call its {{CreateTextFormat}} method. This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawText}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawText ( string text, SharpDX.DirectWrite.TextFormat textFormat, RawRectangleF layoutRect, Brush defaultForegroundBrush, DrawTextOptions options, MeasuringMode measuringMode ) : void
text string A reference to an array of Unicode characters to draw.
textFormat SharpDX.DirectWrite.TextFormat An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.
layoutRect RawRectangleF The size and position of the area in which the text is drawn.
defaultForegroundBrush Brush The brush used to paint the text.
options DrawTextOptions A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the layout rectangle. The default value is , which indicates that text should be snapped to pixel boundaries and it should not be clipped to the layout rectangle.
measuringMode MeasuringMode A value that indicates how glyph metrics are used to measure text when it is formatted. The default value is DWRITE_MEASURING_MODE_NATURAL.
Результат void

DrawTextLayout() публичный Метод

Draws the formatted text described by the specified T:SharpDX.DirectWrite.TextLayout object.
When drawing the same text repeatedly, using the DrawTextLayout method is more efficient than using the {{DrawText}} method because the text doesn't need to be formatted and the layout processed with each call. This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawTextLayout) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public DrawTextLayout ( RawVector2 origin, TextLayout textLayout, Brush defaultForegroundBrush ) : void
origin RawVector2 The point, described in device-independent pixels, at which the upper-left corner of the text described by textLayout is drawn.
textLayout SharpDX.DirectWrite.TextLayout The formatted text to draw. Any drawing effects that do not inherit from are ignored. If there are drawing effects that inherit from ID2D1Resource that are not brushes, this method fails and the render target is put in an error state.
defaultForegroundBrush Brush The brush used to paint any text in textLayout that does not already have a brush associated with it as a drawing effect (specified by the method).
Результат void

EndDraw() публичный Метод

Ends drawing operations on the render target and indicates the current error state and associated tags.
Drawing operations can only be issued between a {{BeginDraw}} and EndDraw call.BeginDraw and EndDraw are use to indicate that a render target is in use by the Direct2D system. Different implementations of SharpDX.Direct2D1.RenderTarget might behave differently when {{BeginDraw}} is called. An SharpDX.Direct2D1.BitmapRenderTarget may be locked between BeginDraw/EndDraw calls, a DXGI surface render target might be acquired on BeginDraw and released on EndDraw, while an WindowRenderTarget may begin batching at BeginDraw and may present on EndDraw, for example. The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval operations can be performed even outside of {{BeginDraw}}/EndDraw. After {{BeginDraw}} is called, a render target will normally build up a batch of rendering commands, but defer processing of these commands until either an internal buffer is full, the {{Flush}} method is called, or until EndDraw is called. The EndDraw method causes any batched drawing operations to complete, and then returns an HRESULT indicating the success of the operations and, optionally, the tag state of the render target at the time the error occurred. The EndDraw method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing HRESULT. If EndDraw is called without a matched call to {{BeginDraw}}, it returns an error indicating that BeginDraw must be called before EndDraw. Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and returns an appropriate HRESULT and error information when EndDraw is called.
public EndDraw ( ) : void
Результат void

EndDraw() публичный Метод

Ends drawing operations on the render target and indicates the current error state and associated tags.

Drawing operations can only be issued between a BeginDraw and EndDraw call.

BeginDraw and EndDraw are use to indicate that a render target is in use by the Direct2D system. Different implementations of SharpDX.Direct2D1.RenderTarget might behave differently when BeginDraw is called. An SharpDX.Direct2D1.BitmapRenderTarget may be locked between BeginDraw/EndDraw calls, a DXGI surface render target might be acquired on BeginDraw and released on EndDraw, while an SharpDX.Direct2D1.WindowRenderTarget may begin batching at BeginDraw and may present on EndDraw, for example.

The BeginDraw method must be called before rendering operations can be called, though state-setting and state-retrieval operations can be performed even outside of BeginDraw/EndDraw.

After BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing of these commands until either an internal buffer is full, the Flush method is called, or until EndDraw is called. The EndDraw method causes any batched drawing operations to complete, and then returns an SharpDX.Result indicating the success of the operations and, optionally, the tag state of the render target at the time the error occurred. The EndDraw method always succeeds: it should not be called twice even if a previous EndDraw resulted in a failing SharpDX.Result.

If EndDraw is called without a matched call to BeginDraw, it returns an error indicating that BeginDraw must be called before EndDraw. Calling BeginDraw twice on a render target puts the target into an error state where nothing further is drawn, and returns an appropriate SharpDX.Result and error information when EndDraw is called.

public EndDraw ( long &tag1, long &tag2 ) : void
tag1 long

When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This parameter is passed uninitialized.

tag2 long

When this method returns, contains the tag for drawing operations that caused errors or 0 if there were no errors. This parameter is passed uninitialized.

Результат void

FillGeometry() публичный Метод

Paints the interior of the specified geometry.
If the opacityBrush parameter is not NULL, the alpha value of each pixel of the mapped opacityBrush is used to determine the resulting opacity of each corresponding pixel of the geometry. Only the alpha value of each color in the brush is used for this processing; all other color information is ignored. The alpha value specified by the brush is multiplied by the alpha value of the geometry after the geometry has been painted by brush. When this method fails, it does not return an error code. To determine whether a drawing operation (such as FillGeometry) failed, check the result returned by the EndDraw() or Flush() method.
public FillGeometry ( SharpDX geometry, SharpDX brush ) : void
geometry SharpDX The geometry to paint.
brush SharpDX The brush used to paint the geometry's interior.
Результат void

FillOpacityMask() публичный Метод

Applies the opacity mask described by the specified bitmap to a brush and uses that brush to paint a region of the render target.
For this method to work properly, the render target must be using the F:SharpDX.Direct2D1.AntialiasMode.Aliased antialiasing mode. You can set the antialiasing mode by calling the M:SharpDX.Direct2D1.RenderTarget.SetAntialiasMode(SharpDX.Direct2D1.AntialiasMode) method. This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{FillOpacityMask}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public FillOpacityMask ( Bitmap opacityMask, Brush brush, OpacityMaskContent content ) : void
opacityMask Bitmap The opacity mask to apply to the brush. The alpha value of each pixel in the region specified by sourceRectangle is multiplied with the alpha value of the brush after the brush has been mapped to the area defined by destinationRectangle.
brush Brush The brush used to paint the region of the render target specified by destinationRectangle.
content OpacityMaskContent The type of content the opacity mask contains. The value is used to determine the color space in which the opacity mask is blended.
Результат void

FillRoundedRectangle() публичный Метод

Paints the interior of the specified rounded rectangle.
This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{FillRoundedRectangle}}) failed, check the result returned by the M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@) or M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@) methods.
public FillRoundedRectangle ( RoundedRectangle roundedRect, Brush brush ) : void
roundedRect RoundedRectangle The dimensions of the rounded rectangle to paint, in device-independent pixels.
brush Brush The brush used to paint the interior of the rounded rectangle.
Результат void

Flush() публичный Метод

Executes all pending drawing commands.
This command does not flush the device that is associated with the render target. Calling this method resets the error state of the render target.
public Flush ( ) : void
Результат void

RenderTarget() публичный Метод

Creates a render target that draws to a DirectX Graphics Infrastructure (DXGI) surface.
To write to a Direct3D surface, you obtain an SharpDX.DXGI.Surface and pass it to the {{CreateDxgiSurfaceRenderTarget}} method to create a DXGI surface render target; you can then use the DXGI surface render target to draw 2-D content to the DXGI surface. A DXGI surface render target is a type of SharpDX.Direct2D1.RenderTarget. Like other Direct2D render targets, you can use it to create resources and issue drawing commands. The DXGI surface render target and the DXGI surface must use the same DXGI format. If you specify the {{DXGI_FORMAT_UNKOWN}} format when you create the render target, it will automatically use the surface's format.The DXGI surface render target does not perform DXGI surface synchronization. To work with Direct2D, the Direct3D device that provides the SharpDX.DXGI.Surface must be created with the D3D10_CREATE_DEVICE_BGRA_SUPPORT flag.For more information about creating and using DXGI surface render targets, see the {{Direct2D and Direct3D Interoperability Overview}}.When you create a render target and hardware acceleration is available, you allocate resources on the computer's GPU. By creating a render target once and retaining it as long as possible, you gain performance benefits. Your application should create render targets once and hold onto them for the life of the application or until the render target's {{EndDraw}} method returns the {{D2DERR_RECREATE_TARGET}} error. When you receive this error, you need to recreate the render target (and any resources it created).
public RenderTarget ( Factory factory, SharpDX.DXGI.Surface dxgiSurface, SharpDX.Direct2D1.RenderTargetProperties properties ) : System
factory Factory an instance of
dxgiSurface SharpDX.DXGI.Surface The DXGI surface to bind this render target to
properties SharpDX.Direct2D1.RenderTargetProperties The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering. For information about supported pixel formats, see {{Supported Pixel Formats and Alpha Modes}}.
Результат System