import java.awt.Rectangle;_x000D_
import java.awt.Graphics;_x000D_
import java.awt.image.BufferedImage;_x000D_
import java.awt.image.ImageObserver;_x000D_
import java.io.File;_x000D_
import javax.imageio.ImageIO;_x000D_
import java.io.IOException;_x000D_
_x000D_
_x000D_
/** De klasse voor een Bitmap item_x000D_
 * <P>_x000D_
 * This program is distributed under the terms of the accompanying_x000D_
 * COPYRIGHT.txt file (which is NOT the GNU General Public License)._x000D_
 * Please read it. Your use of the software constitutes acceptance_x000D_
 * of the terms in the COPYRIGHT.txt file._x000D_
 * @author Ian F. Darwin, ian@darwinsys.com_x000D_
 * @version $Id: BitmapItem.java,v 1.1 2002/12/17 Gert Florijn_x000D_
 * @version $Id: BitmapItem.java,v 1.2 2003/12/17 Sylvia Stuurman_x000D_
 * @version $Id: BitmapItem.java,v 1.3 2004/08/17 Sylvia Stuurman_x000D_
 * @version $Id: BitmapItem.java,v 1.4 2007/07/16 Sylvia Stuurman_x000D_
 */_x000D_
_x000D_
public class BitmapItem extends SlideItem {_x000D_
  private BufferedImage bufferedImage;_x000D_
  private String imageName;_x000D_
_x000D_
// level staat voor het item-level; name voor de naam van het bestand met het plaatje_x000D_
  public BitmapItem(int level, String name) {_x000D_
    super(level);_x000D_
    imageName = name;_x000D_
    try {_x000D_
      bufferedImage = ImageIO.read(new File(imageName));_x000D_
    }_x000D_
    catch (IOException e) {_x000D_
      System.err.println("Bestand " + imageName + " niet gevonden") ;_x000D_
    }_x000D_
  }_x000D_
_x000D_
// Een leeg bitmap-item_x000D_
  public BitmapItem() {_x000D_
    this(0, null);_x000D_
  }_x000D_
_x000D_
// geef de bestandsnaam van het plaatje_x000D_
  public String getName() {_x000D_
    return imageName;_x000D_
  }_x000D_
_x000D_
// geef de bounding box van het plaatje_x000D_
  public Rectangle getBoundingBox(Graphics g, ImageObserver observer, float scale, Style myStyle) {_x000D_
    return new Rectangle((int) (myStyle.indent * scale), 0,_x000D_
	(int) (bufferedImage.getWidth(observer) * scale),_x000D_
	((int) (myStyle.leading * scale)) + (int) (bufferedImage.getHeight(observer) * scale));_x000D_
  }_x000D_
_x000D_
// teken het plaatje_x000D_
  public void draw(int x, int y, float scale, Graphics g, Style myStyle, ImageObserver observer) {_x000D_
    int width = x + (int) (myStyle.indent * scale);_x000D_
    int height = y + (int) (myStyle.leading * scale);_x000D_
    g.drawImage(bufferedImage, width, height,(int) (bufferedImage.getWidth(observer)*scale),_x000D_
                (int) (bufferedImage.getHeight(observer)*scale), observer);_x000D_
  }_x000D_
_x000D_
  public String toString() {_x000D_
    return "BitmapItem[" + getLevel() + "," + imageName + "]";_x000D_
  }_x000D_
}_x000D_

// geef de bestandsnaam van het plaatje_x000D_
import java.awt.Rectangle;_x000D_
import java.awt.Graphics;_x000D_
import java.awt.image.BufferedImage;_x000D_
import java.awt.image.ImageObserver;_x000D_
import java.io.File;_x000D_
import javax.imageio.ImageIO;_x000D_
import java.io.IOException;_x000D_
_x000D_
_x000D_
/** De klasse voor een Bitmap item_x000D_
 * <P>_x000D_
 * This program is distributed under the terms of the accompanying_x000D_
 * COPYRIGHT.txt file (which is NOT the GNU General Public License)._x000D_
 * Please read it. Your use of the software constitutes acceptance_x000D_
 * of the terms in the COPYRIGHT.txt file._x000D_
 * @author Ian F. Darwin, ian@darwinsys.com_x000D_
 * @version $Id: BitmapItem.java,v 1.1 2002/12/17 Gert Florijn_x000D_
 * @version $Id: BitmapItem.java,v 1.2 2003/12/17 Sylvia Stuurman_x000D_
 * @version $Id: BitmapItem.java,v 1.3 2004/08/17 Sylvia Stuurman_x000D_
 * @version $Id: BitmapItem.java,v 1.4 2007/07/16 Sylvia Stuurman_x000D_
 */_x000D_
_x000D_
public class BitmapItem extends SlideItem {_x000D_
  private BufferedImage bufferedImage;_x000D_
  private String imageName;_x000D_
_x000D_
// level staat voor het item-level; name voor de naam van het bestand met het plaatje_x000D_
  public BitmapItem(int level, String name) {_x000D_
    super(level);_x000D_
    imageName = name;_x000D_
    try {_x000D_
      bufferedImage = ImageIO.read(new File(imageName));_x000D_
    }_x000D_
    catch (IOException e) {_x000D_
      System.err.println("Bestand " + imageName + " niet gevonden") ;_x000D_
    }_x000D_
  }_x000D_
_x000D_
// Een leeg bitmap-item_x000D_
  public BitmapItem() {_x000D_
    this(0, null);_x000D_
  }_x000D_
_x000D_
// geef de<SUF>
  public String getName() {_x000D_
    return imageName;_x000D_
  }_x000D_
_x000D_
// geef de bounding box van het plaatje_x000D_
  public Rectangle getBoundingBox(Graphics g, ImageObserver observer, float scale, Style myStyle) {_x000D_
    return new Rectangle((int) (myStyle.indent * scale), 0,_x000D_
	(int) (bufferedImage.getWidth(observer) * scale),_x000D_
	((int) (myStyle.leading * scale)) + (int) (bufferedImage.getHeight(observer) * scale));_x000D_
  }_x000D_
_x000D_
// teken het plaatje_x000D_
  public void draw(int x, int y, float scale, Graphics g, Style myStyle, ImageObserver observer) {_x000D_
    int width = x + (int) (myStyle.indent * scale);_x000D_
    int height = y + (int) (myStyle.leading * scale);_x000D_
    g.drawImage(bufferedImage, width, height,(int) (bufferedImage.getWidth(observer)*scale),_x000D_
                (int) (bufferedImage.getHeight(observer)*scale), observer);_x000D_
  }_x000D_
_x000D_
  public String toString() {_x000D_
    return "BitmapItem[" + getLevel() + "," + imageName + "]";_x000D_
  }_x000D_
}_x000D_
