org.apache.poi.hslf.blip
Interface ImagePainter

All Known Implementing Classes:
BitmapPainter

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.

Author:
Yegor Kozlov.

Method Summary
 void paint(java.awt.Graphics2D graphics, PictureData pict, Picture parent)
          Paints the specified picture data
 

Method Detail

paint

void paint(java.awt.Graphics2D graphics,
           PictureData pict,
           Picture parent)
Paints the specified picture data

Parameters:
graphics - the graphics to paintb into
pict - the data to paint
parent - the shapes that owns the picture data


Copyright 2012 The Apache Software Foundation or its licensors, as applicable.