Android Application

Kotlin 이미지(Image) : 엠보싱(embossing)

작성자 임베디드코리아 작성일23-10-20 23:02 조회1,472회 댓글0건

첨부파일

Kotlin 이미지(Image) : 엠보싱(embossing)
------------------------------------------------------------------------------------
    MainActivity.kt
------------------------------------------------------------------------------------
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //setContentView(R.layout.activity_main)

        setContentView(MyGraphicView(this))
    }

    private class MyGraphicView(context: Context) : View(context) {

        override fun onDraw(canvas: Canvas) {
            super.onDraw(canvas)

            var cenX = this.width / 2f
            var cenY = this.height / 2f

            var paint = Paint()
            paint.color = Color.GRAY
            var eMask: EmbossMaskFilter
/*
            eMask = EmbossMaskFilter(floatArrayOf(3f, 3f, 3f), 0.5f, 5f, 10f)
            paint.maskFilter = eMask
            canvas.drawCircle(cenX, cenY, 150f, paint)

            eMask = EmbossMaskFilter(floatArrayOf(10f, 3f, 3f), 0.5f, 5f, 10f)
            paint.maskFilter = eMask
            canvas.drawCircle(cenX, cenY, 150f, paint)

            eMask = EmbossMaskFilter(floatArrayOf(3f, 10f, 3f), 0.5f, 5f, 10f)
            paint.maskFilter = eMask
            canvas.drawCircle(cenX, cenY, 150f, paint)
*/
            eMask = EmbossMaskFilter(floatArrayOf(3f, 3f, 10f), 0.5f, 5f, 10f)
            paint.maskFilter = eMask
            canvas.drawCircle(cenX, cenY, 150f, paint)
        }
    }
}