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);
}
}
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);
}
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;
}
}
}
Aggregations