private static Bitmap createTile ( float h , Paint stripePaint , Paint progressPaint ) { Bitmap bm = Bitmap . createBitmap ( ( int ) h * 2 , ( int ) h , ARGB_8888 ) ; Canvas tile = new Canvas ( bm ) ; float x = 0 ; Path path = new Path ( ) ; path . moveTo ( x , 0 ) ; path . lineTo ( x , h ) ; path . lineTo ( h , h ) ; tile . drawPath ( path , stripePaint ) ; // draw striped triangle path . reset ( ) ; path . moveTo ( x , 0 ) ; path . lineTo ( x + h , h ) ; path . lineTo ( x + ( h * 2 ) , h ) ; path . lineTo ( x + h , 0 ) ; tile . drawPath ( path , progressPaint ) ; // draw progress parallelogram x += h ; path . reset ( ) ; path . moveTo ( x , 0 ) ; path . lineTo ( x + h , 0 ) ; path . lineTo ( x + h , h ) ; tile . drawPath ( path , stripePaint ) ; // draw striped triangle (completing tile) return bm ; }
Creates a Bitmap which is a tile of the progress bar background