-
-
Save gsrathoreniks/95208c9b836ac7ac2a9994f975975498 to your computer and use it in GitHub Desktop.
This file contains 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
open class BitmapUtils { | |
var _view: View? = null | |
var _context: Context? = null | |
constructor(context: Context, view: View) { | |
this._view = view | |
this._context = context | |
} | |
fun convertLayout(): Bitmap { | |
_view!!.isDrawingCacheEnabled = (true) | |
// _view!!.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), | |
// View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)) | |
// _view!!.layout(0, 0, 1080, 1280) | |
_view!!.buildDrawingCache(true) | |
var _bitmap = Bitmap.createBitmap(_view!!.drawingCache) | |
return _bitmap | |
} | |
fun convertLayoutDiet(): Bitmap { | |
_view!!.isDrawingCacheEnabled = (true) | |
// _view!!.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), | |
// View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)) | |
_view!!.buildDrawingCache(true) | |
var _bitmap = Bitmap.createBitmap(_view!!.drawingCache) | |
return _bitmap | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment