/* Ċ Ġ* ĠCopyright Ġ( c ) Ġ 2 0 1 8 . ĠProperty Ġof ĠD enn is ĠK w ab ena ĠB il son . ĠNo Ġun authorized Ġduplication Ġof Ġthis Ġmaterial Ġshould Ġbe Ġmade Ġwithout Ġprior Ġpermission Ġfrom Ġthe Ġdeveloper Ċ Ġ*/ Ċ Ċ @ file : Jvm Name (" Drawable Utils ") Ċ Ċ package Ġio . pe an ut sdk . util Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . graphics . Bitmap Ċ import Ġandroid . graphics . Canvas Ċ import Ġandroid . graphics . drawable . Anim atable Ċ import Ġandroid . graphics . drawable . Drawable Ċ import Ġandroid . graphics . drawable . Layer Drawable Ċ import Ġandroid . support . annotation . Drawable Res Ċ import Ġandroid . support . v 4 . content . Context Compat Ċ Ċ fun ĠDrawable . to Bitmap (): ĠBitmap Ġ{ ĊĠĠĠ Ġval Ġbitmap Ġ= ĠBitmap . create Bitmap ( intrinsic Width , Ġintr insic Height , ĠBitmap . Config . ARGB _ 8 8 8 8 ) ĊĠĠĠ Ġval Ġcanvas Ġ= ĠCanvas ( bitmap ) ĊĠĠĠ Ġset Bounds ( 0 , Ġ 0 , Ġcanvas . width , Ġcanvas . height ) ĊĠĠĠ Ġdraw ( canvas ) ĊĠĠĠ Ġreturn Ġbitmap Ċ } Ċ Ċ fun Ġdrawable To Bitmap ( context : ĠContext , Ġ@ Drawable Res Ġdrawable Id : ĠInt ) Ġ= ĊĠĠĠĠĠĠĠ ĠContext Compat . get Drawable ( context , Ġdrawable Id )?. to Bitmap () Ċ Ċ fun ĠDrawable . is Animated () Ġ= Ġthis Ġis ĠAnim atable Ċ Ċ val ĠLayer Drawable . layers : ĠList < Drawable > ĊĠĠĠ Ġget () Ġ= Ġ( 0 Ġuntil ĠnumberOf Layers ). map Ġ{ Ġget Drawable ( it ) Ġ} ĊĊ