Method CreateSwatchAsync
CreateSwatchAsync(Double)
Creates a swatch image of this symbol using the default size and a transparent background.
Declaration
public virtual Task<RuntimeImage> CreateSwatchAsync(double dpi = 96)
Parameters
Type | Name | Description |
---|---|---|
Double | dpi | Pixel density (dots per inch) to use when creating the swatch. Default is 96. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<RuntimeImage> | The task object representing the asynchronous create swatch operation. The value of the task result is a RuntimeImage object. |
Remarks
Dimensions of the created image will be at least 20x20 pixels (at 96 dpi), and may be larger depending on symbol size. Minimum swatch size scales with dpi. Note that if the swatch is created without an explicit size or geometry, an accurate representation of symbol patterns might not be captured in the output image.
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET Standard 2.0 | 100.3 - 100.15 |
.NET 6.0 | 100.13 - 100.15 |
.NET 6.0 Windows | 100.13 - 100.15 |
.NET Framework | 100.0 - 100.15 |
.NET 5 | 100.10 - 100.12 |
.NET Core 3.1 | 100.7 - 100.12 |
Xamarin.Android | 100.0 - 100.15 |
Xamarin.iOS | 100.0 - 100.15 |
UWP | 100.0 - 100.15 |
CreateSwatchAsync(Color, Double)
Creates a swatch image of this symbol, using the default sizing and a transparent background.
Declaration
public Task<RuntimeImage> CreateSwatchAsync(Color backgroundColor, double dpi = 96)
Parameters
Type | Name | Description |
---|---|---|
Color | backgroundColor | The image background color. |
Double | dpi | Pixel density (dots per inch) to use when creating the swatch. Default is 96. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<RuntimeImage> | The task object representing the asynchronous create swatch operation. The value of the task result is a RuntimeImage object. |
Remarks
Dimensions of the created image will be at least 20x20 pixels (at 96 dpi), and may be larger depending on symbol size. Minimum swatch size scales with dpi. Note that if the swatch is created without an explicit size or geometry, an accurate representation of symbol patterns might not be captured in the output image.
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET Standard 2.0 | 100.3 - 100.15 |
.NET 6.0 | 100.13 - 100.15 |
.NET 6.0 Windows | 100.13 - 100.15 |
.NET Framework | 100.3 - 100.15 |
.NET 5 | 100.10 - 100.12 |
.NET Core 3.1 | 100.7 - 100.12 |
Xamarin.Android | 100.0 - 100.15 |
Xamarin.iOS | 100.0 - 100.15 |
UWP | 100.3 - 100.14 |
CreateSwatchAsync(Int32, Int32, Single, Color, Geometry)
Creates a swatch image of this symbol, with the specified image size, dpi, background color, and geometry.
Declaration
public Task<RuntimeImage> CreateSwatchAsync(int widthPixels, int heightPixels, float dpi, Color backgroundColor, Geometry geometry)
Parameters
Type | Name | Description |
---|---|---|
Int32 | widthPixels | The image width in pixels. |
Int32 | heightPixels | The image height in pixels. |
Single | dpi | Pixel density (dots per inch) to use when creating the swatch. |
Color | backgroundColor | The image background color. |
Geometry | geometry | The custom geometry to be drawn in the swatch image. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<RuntimeImage> | The task object representing the asynchronous create swatch operation. The value of the task result is a RuntimeImage object. |
Remarks
widthPixels
and heightPixels
may need to be adjusted
if dpi
is different from its default value of 96.
This method does not scale the symbol in order to fit or fill the entire image.
The symbol is rendered at its actual size, which may result in some cropping or padding.
The geometry
should be specified DIPs, with the point {0,0} located at the centerpoint of the swatch image.
The X-axis increases towards the right-hand side of the swatch image. The Y-axis increases towards the top of the swatch image.
Geometry type should correspond to symbol type: MapPoint for MarkerSymbol,
Polyline for LineSymbol,
and Polygon for FillSymbol. Given geometry's spatial reference is ignored.
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET Standard 2.0 | 100.3 - 100.15 |
.NET 6.0 | 100.13 - 100.15 |
.NET 6.0 Windows | 100.13 - 100.15 |
.NET Framework | 100.3 - 100.15 |
.NET 5 | 100.10 - 100.12 |
.NET Core 3.1 | 100.7 - 100.12 |
Xamarin.Android | 100.0 - 100.15 |
Xamarin.iOS | 100.0 - 100.15 |
UWP | 100.3 - 100.14 |
CreateSwatchAsync(Int32, Int32, Double, Color)
Creates a swatch image of this symbol, scaled to fit the specified dimensions.
Declaration
public Task<RuntimeImage> CreateSwatchAsync(int widthPixels, int heightPixels, double dpi, Color backgroundColor)
Parameters
Type | Name | Description |
---|---|---|
Int32 | widthPixels | The image width in pixels. |
Int32 | heightPixels | The image height in pixels. |
Double | dpi | Pixel density (dots per inch) to use when creating the swatch. |
Color | backgroundColor | The background color of the image. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<RuntimeImage> | The task object representing the asynchronous create swatch operation. The value of the task result is a RuntimeImage object. |
Remarks
This method will scale the symbol up or down in order to fill the entire image. Symbol's aspect ratio will be preserved.
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET Standard 2.0 | 100.3 - 100.15 |
.NET 6.0 | 100.13 - 100.15 |
.NET 6.0 Windows | 100.13 - 100.15 |
.NET Framework | 100.3 - 100.15 |
.NET 5 | 100.10 - 100.12 |
.NET Core 3.1 | 100.7 - 100.12 |
Xamarin.Android | 100.1 - 100.15 |
Xamarin.iOS | 100.1 - 100.15 |
UWP | 100.3 - 100.14 |