Search in sources :

Example 1 with MovieView

use of org.apache.pivot.wtk.MovieView in project pivot by apache.

the class MovieViewSkin method getPreferredWidth.

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

Example 2 with MovieView

use of org.apache.pivot.wtk.MovieView in project pivot by apache.

the class MovieViewSkin method install.

@Override
public void install(Component component) {
    super.install(component);
    MovieView movieView = (MovieView) component;
    movieView.getMovieViewListeners().add(this);
    Movie movie = movieView.getMovie();
    if (movie != null) {
        movie.getMovieListeners().add(movieListener);
    }
}
Also used : Movie(org.apache.pivot.wtk.media.Movie) MovieView(org.apache.pivot.wtk.MovieView)

Example 3 with MovieView

use of org.apache.pivot.wtk.MovieView in project pivot by apache.

the class MovieViewSkin method getPreferredSize.

@Override
public Dimensions getPreferredSize() {
    MovieView movieView = (MovieView) getComponent();
    Movie movie = movieView.getMovie();
    return (movie == null) ? Dimensions.ZERO : new Dimensions(Math.round(movie.getWidth() * scale), Math.round(movie.getHeight() * scale));
}
Also used : Movie(org.apache.pivot.wtk.media.Movie) Dimensions(org.apache.pivot.wtk.Dimensions) MovieView(org.apache.pivot.wtk.MovieView)

Example 4 with MovieView

use of org.apache.pivot.wtk.MovieView 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 5 with MovieView

use of org.apache.pivot.wtk.MovieView 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)

Aggregations

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