SharpDX.Direct2D1.LinearGradientBrush

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > SharpDX SDK Reference > SharpDX.Direct2D1 >

SharpDX.Direct2D1.LinearGradientBrush

Previous page Return to chapter overview Next page

Disclaimer: The SharpDX SDK Reference section was compiled from the official SharpDX Documentation and was NOT authored by NinjaTrader.  The contents of this section are provided as-is and only cover a fraction of what is available from the SharpDX SDK.  This page was intended only as a reference guide to help you get started with some of the 2D Graphics concepts used in the NinjaTrader.Custom assembly.  Please refer to the official SharpDX Documentation for additional members not covered in this reference.  For more seasoned graphic developers, the original MSDN Direct2D1 and DirectWrite unmanaged API documentation can also be helpful for understanding the DirectX/Direct2D run-time environment. For NinjaScript development purposes, we document only essential members in the structure of this page.

 

 

Definition

Paints an area with a linear gradient.

(See also unmanaged API documentation)

 

Notes:

1.An LinearGradientBrush paints an area with a linear gradient along a line between the brush start point and end point. The gradient, defined by the brush GradientStopCollection, is extruded perpendicular to this line, and then transformed by a brush transform (if specified).
2.The start point and end point are described in the brush space and are mappped to the render target when the brush is used. Note the starting and ending coordinates are absolute, not relative to the render target size. A value of (0, 0) maps to the upper-left corner of the render target, while a value of (1, 1) maps one pixel diagonally away from (0, 0). If there is a nonidentity brush transform or render target transform, the brush start point and end point are also transformed.
3.It is possible to specify a gradient axis that does not completely fill the area that is being painted. When this occurs, the ExtendMode, specified by the GradientStopCollection, determines how the remaining area is painted.
4.The LinearGradientBrush can only be used with the render target that created it or with the compatible targets for that render target.
5.A LinearGradientBrush is a device-dependent resource: your application should create linear gradient brushes after it initializes the render target with which the brushes will be used, and recreate the brushes whenever the render target needs recreated.  Please see the MSDN Direct2D Resources Overview for more information.
6.For convenience, Direct2D provides the RadialGradientBrushProperties function for creating new a LinearGradientBrush.

 

 

Syntax

class SolidColorBrush

 

Tips:

1.For NinjaScript Development purposes, you can use the NinjaTrader.Gui.DxExtensions.ToDxBrush() helper method to convert a System.Windows.Media.LinearGradientBrush to a SharpDX.Direct2D1.LinearGradientBrush
2.General information on Direct2D brushes can be found on the MSDN Direct2D Brushes Overview

 

 
Constructors

new LinearGradientBrush(RenderTarget renderTarget, LinearGradientBrushProperties linearGradientBrushProperties, GradientStopCollection gradientStopCollection)

Creates an LinearGradientBrush that contains the specified gradient stops and has the specified transform and base opacity.

new LinearGradientBrush(RenderTarget renderTarget, LinearGradientBrushProperties linearGradientBrushProperties, Nullable<BrushProperties> brushProperties, GradientStopCollection gradientStopCollection)

Creates an LinearGradientBrush that contains the specified gradient stops and has the specified transform and base opacity.

 

 

Methods and Properties

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from SharpDX.DisposeBase.)

EndPoint

Retrieves or sets the ending coordinates of the linear gradient.

GradientStopCollection

Retrieves the GradientStopCollection associated with this linear gradient brush.

IsDisposed

Gets a value indicating whether this instance is disposed. (Inherited from SharpDX.DisposeBase.)

Opacity

Gets or sets the degree of opacity of this brush.

(Inherited from Brush.)

StartPoint

Retrieves or sets the starting coordinates of the linear gradient.

Transform

Gets or sets the transform applied to this brush.

(Inherited from Brush.)