Search in sources :

Example 6 with Movie

use of org.apache.pivot.wtk.media.Movie in project pivot by apache.

the class MovieViewSkin method paint.

@Override
public void paint(Graphics2D graphics) {
    MovieView movieView = (MovieView) getComponent();
    Movie movie = movieView.getMovie();
    int width = getWidth();
    int height = getHeight();
    if (backgroundColor != null) {
        graphics.setPaint(backgroundColor);
        graphics.fillRect(0, 0, width, height);
    }
    if (movie != null) {
        if (scale != 1) {
            graphics.scale(scale, scale);
        }
        graphics.translate(movieX, movieY);
        movie.paint(graphics);
    }
}
Also used : Movie(org.apache.pivot.wtk.media.Movie) MovieView(org.apache.pivot.wtk.MovieView)

Example 7 with Movie

use of org.apache.pivot.wtk.media.Movie in project pivot by apache.

the class MovieViewSkin method getPreferredHeight.

@Override
public int getPreferredHeight(int width) {
    MovieView movieView = (MovieView) getComponent();
    Movie movie = movieView.getMovie();
    return (movie == null) ? 0 : Math.round(movie.getHeight() * scale);
}
Also used : Movie(org.apache.pivot.wtk.media.Movie) MovieView(org.apache.pivot.wtk.MovieView)

Example 8 with Movie

use of org.apache.pivot.wtk.media.Movie in project pivot by apache.

the class MovieViewSkin method layout.

@Override
public void layout() {
    MovieView movieView = (MovieView) getComponent();
    Movie movie = movieView.getMovie();
    if (movie != null) {
        int width = getWidth();
        int height = getHeight();
        int movieWidth = movie.getWidth();
        int movieHeight = movie.getHeight();
        switch(horizontalAlignment) {
            case CENTER:
                movieX = (width - movieWidth) / 2;
                break;
            case RIGHT:
                movieX = width - movieWidth;
                break;
            default:
                movieX = 0;
                break;
        }
        switch(verticalAlignment) {
            case CENTER:
                movieY = (height - movieHeight) / 2;
                break;
            case BOTTOM:
                movieY = height - movieHeight;
                break;
            default:
                movieY = 0;
                break;
        }
    }
}
Also used : Movie(org.apache.pivot.wtk.media.Movie) MovieView(org.apache.pivot.wtk.MovieView)

Aggregations

Movie (org.apache.pivot.wtk.media.Movie)8 MovieView (org.apache.pivot.wtk.MovieView)6 Dimensions (org.apache.pivot.wtk.Dimensions)1