provideExitSignIcon
fun provideExitSignIcon(reference: IconReference, content: String): Result<Bitmap, RoadShieldIconProviderFailure>
Generate an exit sign image.
The reference is used to construct an image for the exit sign, if the reference is invalid then a fallback image is generated.
The navigation engine provides GuidanceInstruction
instances during navigation the road shield reference can be obtained from instruction's properties.
To generate the exit sign the following code snippet can be used:
val roadShieldProvider = RoadShieldIconProvider(context)
val image = guidanceInstruction?.signpost?.exitIconReference?.let { exitIconReference ->
val exitNumber = guidanceInstruction?.signpost?.exitNumber.orEmpty()
roadShieldIconProvider.provideExitSignIcon(
reference = exitIconReference,
content = exitNumber,
).value().toAndroidImage(),
}
Content copied to clipboard
Return
Result containing either a bitmap of the generated exit sign image or a failure if the image could not be constructed.
Parameters
reference
The reference of the base exit sign image.
content
The text to draw on the base exit sign image.