public void drawRotated(Bitmap bitmap, int xOffs, int yOffs, int xo, int yo, int w, int h, int rotation) {
        final double radians = Math.toRadians(rotation);
        final double cos = Math.cos(radians);
        final double sin = Math.sin(radians);
        for(int y = 0; y < w; y++){
            int yPix = y + yo;
            for(int x = 0; x < h; x++){
                int xPix = x + xo;

                int centerX = w / 2;
                int centerY = h / 2;
                int m = x - centerX;
                int n = y - centerY;
                int j = ((int) (m * cos + n * sin)) + centerX;
                int k = ((int) (n * cos - m * sin)) + centerY;

                int src = bitmap.pixels[xPix + yPix * bitmap.width];

                int xDraw = xOffs+j;
                int yDraw = yOffs+k;

                if(xDraw < 0 || xDraw >= width-1 || yDraw < 0 || yDraw >= height-1)continue;
                if(src != -2){
                	pixels[xDraw + yDraw * width] = src;
                	if(x < w-1)pixels[xDraw + 1 + yDraw * width] = src;
                	if(y < h-1)pixels[xDraw + (yDraw + 1) * width] = src;
                }

            }
        }
    }