movie = pMovie;
preview = pPreview;
}
private void generatePreview(int pQuality) {
preview = new SimpleImage(IMG_WIDTH * IMG_COUNT, IMG_HEIGHT - 1);
for (int i = 0; i < IMG_COUNT; i++) {
RenderInfo info = new RenderInfo(IMG_WIDTH, IMG_HEIGHT, RenderMode.PREVIEW);
Flame renderFlame;
if (movie.getParts().size() > 0) {
int frame = (int) ((double) movie.getFrameCount() / ((double) IMG_COUNT + 1) * i + 0.5);
Flame morphedFlame = movie.getFlame(frame);
renderFlame = movie.createAnimatedFlame(morphedFlame, frame);
}
else {
renderFlame = new Flame();
}
double wScl = (double) info.getImageWidth() / (double) renderFlame.getWidth();
double hScl = (double) info.getImageHeight() / (double) renderFlame.getHeight();
renderFlame.setPixelsPerUnit((wScl + hScl) * 0.5 * renderFlame.getPixelsPerUnit());
renderFlame.setWidth(IMG_WIDTH);
renderFlame.setHeight(IMG_HEIGHT);
renderFlame.setSpatialFilterRadius(0.0);
FlameRenderer renderer = new FlameRenderer(renderFlame, prefs, false, false);
renderFlame.setSampleDensity(pQuality / IMG_COUNT);
RenderedFlame res = renderer.renderFlame(info);
SimpleImage foreground = res.getImage();
ComposeTransformer composeT = new ComposeTransformer();
composeT.setHAlign(ComposeTransformer.HAlignment.OFF);
composeT.setVAlign(ComposeTransformer.VAlignment.OFF);
composeT.setTop(0);
composeT.setLeft(i * IMG_WIDTH);