ConstructGradientFill(CIMColorRamp,GradientFillMethod,Int32) Method
Constructs a gradient fill using the specififed color ramp.
Snippet Gradient fill between two colors
/// <summary>
/// Create a polygon symbol using the ConstructGradientFill method. Constructs a gradient fill between two colors passed to the method. <br/>
/// ![PolygonSymbolTwoColors](http://Esri.github.io/arcgis-pro-sdk/images/Symbology/PolygonSymbolTwoColors.png)
/// </summary>
/// <returns></returns>
public static Task<CIMPolygonSymbol> CreateGradientTwoColorsPolygonAsync()
{
return QueuedTask.Run<CIMPolygonSymbol>(() =>
{
//gradient fill between 2 colors
var gradientFill = SymbolFactory.Instance.ConstructGradientFill(CIMColor.CreateRGBColor(235, 64, 52), CIMColor.NoColor(), GradientFillMethod.Linear);
List<CIMSymbolLayer> symbolLayers = new List<CIMSymbolLayer>
{
gradientFill
};
return new CIMPolygonSymbol() { SymbolLayers = symbolLayers.ToArray() };
});
}
Snippet Gradient fill using Color ramp
/// <summary>
/// Create a polygon symbol using the ConstructGradientFill method. Constructs a gradient fill using the specified color ramp. <br/>
/// ![PolygonSymbolColorRamp](http://Esri.github.io/arcgis-pro-sdk/images/Symbology/PolygonSymbolColorRamp.png)
/// </summary>
/// <returns></returns>
public static Task<CIMPolygonSymbol> CreateGradientColorRampPolygonAsync()
{
return QueuedTask.Run<CIMPolygonSymbol>(() =>
{
//outine
CIMStroke outline = SymbolFactory.Instance.ConstructStroke(CIMColor.CreateRGBColor(49, 49, 49), 2.0, SimpleLineStyle.Solid);
//gradient fill using a color ramp
var gradientFill = SymbolFactory.Instance.ConstructGradientFill(GetColorRamp(), GradientFillMethod.Linear);
List<CIMSymbolLayer> symbolLayers = new List<CIMSymbolLayer>
{
outline,
gradientFill
};
return new CIMPolygonSymbol() { SymbolLayers = symbolLayers.ToArray() };
});
}
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3.1 or higher.