addStyleImage method
- String arg_imageId,
- double arg_scale,
- MbxImage arg_image,
- bool arg_sdf,
- List<
ImageStretches?> arg_stretchX, - List<
ImageStretches?> arg_stretchY, - ImageContent? arg_content
Adds an image to be used in the style. This API can also be used for updating
an image. If the image for a given imageId was already added, it gets replaced by the new image.
The image can be used in icon-image,
fill-pattern,
line-pattern and
text-field properties.
@param imageId An identifier of the image. @param scale A scale factor for the image. @param image A pixel data of the image. @param sdf An option to treat whether image is SDF(signed distance field) or not. @param stretchX An array of two-element arrays, consisting of two numbers that represent the from position and the to position of areas that can be stretched horizontally. @param stretchY An array of two-element arrays, consisting of two numbers that represent the from position and the to position of areas that can be stretched vertically. @param content An array of four numbers, with the first two specifying the left, top corner, and the last two specifying the right, bottom corner. If present, and if the icon uses icon-text-fit, the symbol's text will be fit inside the content box.
@return A string describing an error if the operation was not successful, empty otherwise.
Implementation
Future<void> addStyleImage(
String arg_imageId,
double arg_scale,
MbxImage arg_image,
bool arg_sdf,
List<ImageStretches?> arg_stretchX,
List<ImageStretches?> arg_stretchY,
ImageContent? arg_content) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(<Object?>[
arg_imageId,
arg_scale,
arg_image,
arg_sdf,
arg_stretchX,
arg_stretchY,
arg_content
]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else {
return;
}
}