src/main/java/eu/digitisation/image/Bimage.java
public Bimage rotate(double alpha) {
        double cos = Math.cos(alpha);
        double sin = Math.abs(Math.sin(alpha));
        int w = (int) Math.floor(getWidth() * cos + getHeight() * sin);
        int h = (int) Math.floor(getHeight() * cos + getWidth() * sin);
        Bimage rotated = new Bimage(w, h, getType());
        Graphics2D g = (Graphics2D) rotated.getGraphics();
        g.setBackground(background());
        g.clearRect(0, 0, w, h);
        if (alpha < 0) {
            g.translate(getHeight() * sin, 0);
        } else {
            g.translate(0, getWidth() * sin);
        }
        g.rotate(-alpha);
        g.drawImage(this, 0, 0, null);
        g.dispose();
        return rotated;

    }
/**
     * Create a rotated image
     *
     * @param alpha the rotation angle (anticlockwise)
     * @return the rotated image
     */
Create a rotated image
@param alpha the rotation angle (anticlockwise)
@return the rotated image
Create a rotated image @param alpha the rotation angle ( anticlockwise ) @return the rotated image
public Bimage rotate(double alpha) {
        double cos = Math.cos(alpha);
        double sin = Math.abs(Math.sin(alpha));
        int w = (int) Math.floor(getWidth() * cos + getHeight() * sin);
        int h = (int) Math.floor(getHeight() * cos + getWidth() * sin);
        Bimage rotated = new Bimage(w, h, getType());
        Graphics2D g = (Graphics2D) rotated.getGraphics();
        g.setBackground(background());
        g.clearRect(0, 0, w, h);
        if (alpha < 0) {
            g.translate(getHeight() * sin, 0);
        } else {
            g.translate(0, getWidth() * sin);
        }
        g.rotate(-alpha);
        g.drawImage(this, 0, 0, null);
        g.dispose();
        return rotated;
    }
public Bimage rotate ( double alpha ) { double cos = Math . cos ( alpha ) ; double sin = Math . abs ( Math . sin ( alpha ) ) ; int w = ( int ) Math . floor ( getWidth ( ) * cos + getHeight ( ) * sin ) ; int h = ( int ) Math . floor ( getHeight ( ) * cos + getWidth ( ) * sin ) ; Bimage rotated = new Bimage ( w , h , getType ( ) ) ; Graphics2D g = ( Graphics2D ) rotated . getGraphics ( ) ; g . setBackground ( background ( ) ) ; g . clearRect ( 0 , 0 , w , h ) ; if ( alpha < 0 ) { g . translate ( getHeight ( ) * sin , 0 ) ; } else { g . translate ( 0 , getWidth ( ) * sin ) ; } g . rotate ( - alpha ) ; g . drawImage ( this , 0 , 0 , null ) ; g . dispose ( ) ; return rotated ; }
Create a rotated image
 @param alpha the rotation angle (anticlockwise)
 @return the rotated image
Create a rotated image @param alpha the rotation angle ( anticlockwise ) @return the rotated image