Untitled

 avatar
unknown
plain_text
a year ago
1.2 kB
4
Indexable
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()
        }
    }
Editor is loading...
Leave a Comment