• Keep in touch:
  • Linked In
  • Twitter
  • RSS

How do I add an image to a movie?

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 ImageFactory to generate the image definition and the shape used to display the image on the screen.

int uid = 1;

final ImageFactory factory = new ImageFactory();
factory.read(new File(imageFile));
final ImageTag image = factory.defineImage(uid++);

movie.add(image);

final ShapeTag shape = new ImageShape().defineShape(uid++, image,
    xOrigin, yOrigin, new LineStyle1(width, color));

movie.add(shape);
movie.add(Place2.show(shape.getIdentifier(), layer, x, y));
movie.add(ShowFrame.getInstance());

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.

.