Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.2 kB
2
Indexable
Never
fun updategeopoint(newgeopoint: GeoPoint, startColor1: Int, endColor1: Int) {
        geopoint = newgeopoint
       startColor = startColor1
       endColor = endColor1
//    Log.d("", "updategeopoint1=: "+startColor)
        val positionPixels = mapView?.projection?.toPixels(newgeopoint, null)
        positionPixels?.let {
            val radiusInPixels = calculateRadiusInPixels(mapView, circleRadiusInMeters)

            val centerX = it.x.toFloat()
            val centerY = it.y.toFloat()
            // Set up the gradient color with alpha
            val startColorWithAlpha = Color.argb(30, Color.red(startColor), Color.green(startColor), Color.blue(startColor))
            val endColorWithAlpha = Color.argb(10, Color.red(endColor), Color.green(endColor), Color.blue(endColor))
            // Set up the gradient color dynamically
            val gradient = RadialGradient(centerX, centerY, radiusInPixels,startColorWithAlpha , endColorWithAlpha, Shader.TileMode.CLAMP)
//            paintCircleOutline.shader = sahder
            paintCircleOutline.shader = gradient
            mapView?.invalidate()
        }
    }
Leave a Comment