Package com.mapbox.maps.extension.style.image

Types

ImageExtensionImpl
Link copied to clipboard

Concrete implementation of ImagePlugin, the plugin is used to add an image to be used in the style.

This API can also be used for updating an image. If the image id was already added, it gets replaced by the new image.

The image can be used in icon-image, fill-pattern, and line-pattern.

See https://www.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-icon-image See https://www.mapbox.com/mapbox-gl-js/style-spec/#paint-line-line-pattern See https://www.mapbox.com/mapbox-gl-js/style-spec/#paint-fill-fill-pattern

ImageNinePatchExtensionImpl
Link copied to clipboard

Concrete implementation of ImagePlugin (see ImageExtensionImpl) but taking 9-patch Bitmap in order to calculate stretchX, stretchY and paddings automatically.

NinePatchImage
Link copied to clipboard

Data class describing 9-patch bitmap.

data class NinePatchImage(internalImage: Image, stretchX: List<ImageStretches>, stretchY: List<ImageStretches>, imageContent: ImageContent)

Functions

addImage
Link copied to clipboard

Extension function to add an image provided by the Style Extension to the Style.

fun StyleInterface.addImage(image: StyleContract.StyleImageExtension)
addImage9Patch
Link copied to clipboard

Extension function to add 9-patch image provided by the Style Extension to the Style.

fun StyleInterface.addImage9Patch(image: StyleContract.StyleImageExtension)

Adds an 9-patch image to be used in the style. X-stretches, Y-stretches and padding will be calculated from Bitmap.getNinePatchChunk.

fun StyleInterface.addImage9Patch(imageId: String, bitmap: Bitmap, scale: Float, sdf: Boolean): Expected<String, None>
image
Link copied to clipboard

DSL function for ImageExtensionImpl.

fun image(imageId: String, block: ImageExtensionImpl.Builder.() -> Unit): ImageExtensionImpl
image9Patch
Link copied to clipboard

DSL function for ImageNinePatchExtensionImpl.

fun image9Patch(imageId: String, bitmap: Bitmap, block: ImageNinePatchExtensionImpl.Builder.() -> Unit?): ImageNinePatchExtensionImpl
parse9PatchBitmap
Link copied to clipboard

Utility function returning NinePatchImage from a given Bitmap.

Bitmap has to be in 9-patch format (.9.png) or RuntimeException will be thrown.

fun Bitmap.parse9PatchBitmap(): NinePatchImage