Created
September 7, 2025 10:46
-
-
Save root-ansh/a33e69c3469f0536a7e36b9c27956792 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun getCurrentImageViewBitmap(): Bitmap{ | |
| val drawable = binding.imagePreviewPlaceholder.drawable | |
| val bitmap = if (drawable is BitmapDrawable) { | |
| drawable.bitmap | |
| } else { | |
| val bitmap = createBitmap(drawable.intrinsicWidth, drawable.intrinsicHeight) | |
| val canvas = Canvas(bitmap) | |
| drawable.setBounds(0, 0, canvas.width, canvas.height) | |
| drawable.draw(canvas) | |
| bitmap | |
| } | |
| return bitmap | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment