|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ImagePainter
A common interface for objects that can render ppt picture data.
Subclasses can redefine it and use third-party libraries for actual rendering, for example, Bitmaps can be rendered using javax.imageio.* , WMF can be rendered using Apache Batik, PICT can be rendered using Apple QuickTime API for Java, etc.
A typical usage is as follows:
public WMFPaiter implements ImagePainter{
public void paint(Graphics2D graphics, PictureData pict, Picture parent){
DataInputStream is = new DataInputStream(new ByteArrayInputStream(pict.getData()));
org.apache.batik.transcoder.wmf.tosvg.WMFRecordStore wmfStore =
new org.apache.batik.transcoder.wmf.tosvg.WMFRecordStore();
try {
wmfStore.read(is);
} catch (IOException e){
return;
}
Rectangle anchor = parent.getAnchor();
float scale = (float)anchor.width/wmfStore.getWidthPixels();
org.apache.batik.transcoder.wmf.tosvg.WMFPainter painter =
new org.apache.batik.transcoder.wmf.tosvg.WMFPainter(wmfStore, 0, 0, scale);
graphics.translate(anchor.x, anchor.y);
painter.paint(graphics);
}
}
PictureData.setImagePainter(Picture.WMF, new WMFPaiter());
...
Subsequent calls of Slide.draw(Graphics gr) will use WMFPaiter for WMF images.
Method Summary | |
---|---|
void |
paint(java.awt.Graphics2D graphics,
PictureData pict,
Picture parent)
Paints the specified picture data |
Method Detail |
---|
void paint(java.awt.Graphics2D graphics, PictureData pict, Picture parent)
graphics
- the graphics to paintb intopict
- the data to paintparent
- the shapes that owns the picture data
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |