Android Application
Kotlin 이미지(Image) : 블러링(blurring)
작성자 임베디드코리아
작성일23-10-17 00:52
조회1,436회
댓글0건
Kotlin 이미지(Image) : 블러링(blurring)
------------------------------------------------------------------------------------
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 picture = BitmapFactory.decodeResource(resources,R.drawable.durumi)
var picX = (this.width - picture.width) / 2f
var picY = (this.height - picture.height) / 2f
var paint = Paint()
var bMask: BlurMaskFilter
bMask = BlurMaskFilter(30f, BlurMaskFilter.Blur.NORMAL)
paint.maskFilter = bMask
canvas.drawBitmap(picture, picX, picY, paint)
picture.recycle()
/*
bMask = BlurMaskFilter(30f, BlurMaskFilter.Blur.INNER)
paint.maskFilter = bMask
canvas.drawBitmap(picture, picX, picY, paint)
picture.recycle()
bMask = BlurMaskFilter(30f, BlurMaskFilter.Blur.OUTER)
paint.maskFilter = bMask
canvas.drawBitmap(picture, picX, picY, paint)
picture.recycle()
bMask = BlurMaskFilter(30f, BlurMaskFilter.Blur.SOLID)
paint.maskFilter = bMask
canvas.drawBitmap(picture, picX, picY, paint)
picture.recycle()
*/
}
}
}