Code example for Canvas

Methods: drawCircle, drawColor

0
    } 
 
    @SmallTest 
    public void testRotateResize() { 
        Bitmap bmp = Bitmap.createBitmap(100, 10, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bmp);
        Paint paint = new Paint();
 
        // Paint the background white 
        canvas.drawColor(Color.BLACK);
 
        // Paint a black circle in the center 
        paint.setColor(Color.BLACK);
        paint.setStyle(Style.FILL);
        canvas.drawCircle(50, 50, 10, paint);
 
        Pix pixs = ReadFile.readBitmap(bmp);
        Pix pixd = Rotate.rotate(pixs, 180);
        pixs.recycle();
 
        assertTrue("Rotated width is 100", (pixd.getWidth() == 100));