public static Bitmap colorToBitmap ( final int width , final int height , @ ColorInt final int color ) { Condition . INSTANCE . ensureAtLeast ( width , 1 , "The width must be at least 1" ) ; Condition . INSTANCE . ensureAtLeast ( height , 1 , "The height must be at least 1" ) ; Bitmap bitmap = Bitmap . createBitmap ( width , height , Bitmap . Config . ARGB_8888 ) ; Canvas canvas = new Canvas ( bitmap ) ; Paint paint = new Paint ( ) ; paint . setColor ( color ) ; canvas . drawRect ( 0 , 0 , width , height , paint ) ; return bitmap ; }
Creates and returns a bitmap from a specific color .