home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / Gamelication / examples / Boink / com / next / gt / backup / TiledImage.java < prev   
Encoding:
Java Source  |  1998-04-07  |  841 b   |  36 lines

  1. /**
  2.  *
  3.  * TiledImage.java
  4.  * @author    Mark G. Tacchi (mtacchi@next.com) 
  5.  * @version    0.8
  6.  * Feb 24/1996
  7.  * 
  8.  * TiledImage is a simple class with the sole responsibility of
  9.  * replicating an image tile to produce a large tiled image.  This is
  10.  * useful for creating a background image.
  11.  * 
  12. */
  13.  
  14. package com.next.gt;
  15.  
  16. import java.awt.Graphics;
  17. import java.awt.Image;
  18.  
  19.  
  20. public class TiledImage extends java.lang.Object {
  21.   static Image        tiledImage;
  22.  
  23. public static Image createTiledImage(Image theImage, int width, int height, Gamelet owner) {
  24.   int        i, j;
  25.   
  26.   tiledImage= owner.createImage(width,height);
  27.   for (i= 0; i< width; i+= theImage.getWidth(null)) {
  28.     for (j= 0; j< height; j+= theImage.getHeight(null)) {
  29.       tiledImage.getGraphics().drawImage(theImage,i,j,owner);
  30.     }
  31.   }
  32.   return tiledImage;
  33. } /*TiledImage(,,,)*/
  34.  
  35.  
  36. } /*TiledImage*/