Loading play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/Pattern.kt +4 −4 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ fun PatternItem.getName(): String = when (this) { /** * Name of pattern, to identify it after it is added to map */ fun MutableList<PatternItem>.getName(color: Int, strokeWidth: Float) = joinToString("-") { fun List<PatternItem>.getName(color: Int, strokeWidth: Float) = joinToString("-") { it.getName() } + "-${color}-width${strokeWidth}" Loading @@ -37,15 +37,15 @@ fun PatternItem.getWidth(strokeWidth: Float): Float = when (this) { * Gets width that a bitmap for this pattern would have if it were to be drawn * with respect to aspect ratio onto a canvas with height 1. */ fun MutableList<PatternItem>.getWidth(strokeWidth: Float) = map { it.getWidth(strokeWidth) }.sum() fun List<PatternItem>.getWidth(strokeWidth: Float) = map { it.getWidth(strokeWidth) }.sum() fun MutableList<PatternItem>.makeBitmap(color: Int, strokeWidth: Float): Bitmap = makeBitmap(Paint().apply { fun List<PatternItem>.makeBitmap(color: Int, strokeWidth: Float): Bitmap = makeBitmap(Paint().apply { setColor(color) style = Paint.Style.FILL }, strokeWidth) fun MutableList<PatternItem>.makeBitmap(paint: Paint, strokeWidth: Float): Bitmap { fun List<PatternItem>.makeBitmap(paint: Paint, strokeWidth: Float): Bitmap { // Pattern aspect ratio is not respected by renderer val width = getWidth(strokeWidth).toInt() Loading play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Circle.kt +2 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.util.Log import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.ObjectWrapper import com.google.android.gms.dynamic.unwrap import com.google.android.gms.maps.model.Dash import com.google.android.gms.maps.model.LatLng import com.google.android.gms.maps.model.PatternItem import com.google.android.gms.maps.model.internal.ICircleDelegate Loading Loading @@ -284,8 +285,7 @@ class CircleImpl(private val map: GoogleMapImpl, private val id: String, options it.lineWidth = strokeWidth / map.dpiFactor line.annotation?.linePattern = null strokePattern?.let { pattern -> (strokePattern ?: listOf(Dash(1f))).let { pattern -> val bitmapName = pattern.getName(strokeColor, strokeWidth) map.addBitmap(bitmapName, pattern.makeBitmap(strokeColor, strokeWidth)) line.annotation?.linePattern = bitmapName Loading Loading
play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/Pattern.kt +4 −4 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ fun PatternItem.getName(): String = when (this) { /** * Name of pattern, to identify it after it is added to map */ fun MutableList<PatternItem>.getName(color: Int, strokeWidth: Float) = joinToString("-") { fun List<PatternItem>.getName(color: Int, strokeWidth: Float) = joinToString("-") { it.getName() } + "-${color}-width${strokeWidth}" Loading @@ -37,15 +37,15 @@ fun PatternItem.getWidth(strokeWidth: Float): Float = when (this) { * Gets width that a bitmap for this pattern would have if it were to be drawn * with respect to aspect ratio onto a canvas with height 1. */ fun MutableList<PatternItem>.getWidth(strokeWidth: Float) = map { it.getWidth(strokeWidth) }.sum() fun List<PatternItem>.getWidth(strokeWidth: Float) = map { it.getWidth(strokeWidth) }.sum() fun MutableList<PatternItem>.makeBitmap(color: Int, strokeWidth: Float): Bitmap = makeBitmap(Paint().apply { fun List<PatternItem>.makeBitmap(color: Int, strokeWidth: Float): Bitmap = makeBitmap(Paint().apply { setColor(color) style = Paint.Style.FILL }, strokeWidth) fun MutableList<PatternItem>.makeBitmap(paint: Paint, strokeWidth: Float): Bitmap { fun List<PatternItem>.makeBitmap(paint: Paint, strokeWidth: Float): Bitmap { // Pattern aspect ratio is not respected by renderer val width = getWidth(strokeWidth).toInt() Loading
play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Circle.kt +2 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.util.Log import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.ObjectWrapper import com.google.android.gms.dynamic.unwrap import com.google.android.gms.maps.model.Dash import com.google.android.gms.maps.model.LatLng import com.google.android.gms.maps.model.PatternItem import com.google.android.gms.maps.model.internal.ICircleDelegate Loading Loading @@ -284,8 +285,7 @@ class CircleImpl(private val map: GoogleMapImpl, private val id: String, options it.lineWidth = strokeWidth / map.dpiFactor line.annotation?.linePattern = null strokePattern?.let { pattern -> (strokePattern ?: listOf(Dash(1f))).let { pattern -> val bitmapName = pattern.getName(strokeColor, strokeWidth) map.addBitmap(bitmapName, pattern.makeBitmap(strokeColor, strokeWidth)) line.annotation?.linePattern = bitmapName Loading