How do I add an image to a movie?
Added: 31 Jan 2009. Working example for Java.
There are two steps involved in displaying an image in a movie. First you create the image definition then in order to display it you must create a shape inside which the image will be rendered.
The easiest way of adding a BMP, PNG or JPEG format image to a movie is to use the FSImageConstructor to generate the image definition and the shape used to display the image on the screen.
FSImageConstructor generator = new FSImageConstructor();
generator.setImageFromFile(path);
int imageId = movie.newIdentifier();
int shapeId = movie.newIdentifier();
movie.add(generator.defineImage(imageId));
FSSolidLine style = new FSSolidLine(20, FSColorTable.black());
FSDefineShape3 shape = generator.defineEnclosingShape(
shapeId, imageId, xPoint, yPoint, style);
movie.add(shape);
movie.add(new FSPlaceObject2(shapeId, layer, x, y));
movie.add(new FSShowFrame());
When defining the shape you can set the registration point of the image so its position changes relative to the point where it is placed on the screen. For more information please see the article How do I set the registration point for an image?
.