Added tileImageDown().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1318 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ImageUtil.java,v 1.9 2002/04/29 01:12:54 mdb Exp $
|
||||
// $Id: ImageUtil.java,v 1.10 2002/04/30 02:14:13 mdb Exp $
|
||||
|
||||
package com.threerings.media.util;
|
||||
|
||||
@@ -218,6 +218,32 @@ public class ImageUtil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Paints multiple copies of the supplied image using the supplied
|
||||
* graphics context such that the requested height is filled with the
|
||||
* image.
|
||||
*/
|
||||
public static void tileImageDown (Graphics g, Image image,
|
||||
int x, int y, int height)
|
||||
{
|
||||
int iwidth = image.getWidth(null), iheight = image.getHeight(null);
|
||||
int tcount = height/iheight, extra = height % iheight;
|
||||
|
||||
// draw the full copies of the image
|
||||
for (int ii = 0; ii < tcount; ii++) {
|
||||
g.drawImage(image, x, y, null);
|
||||
y += iheight;
|
||||
}
|
||||
|
||||
// clip the final blit
|
||||
if (extra > 0) {
|
||||
Shape oclip = g.getClip();
|
||||
g.clipRect(x, y, iwidth, extra);
|
||||
g.drawImage(image, x, y, null);
|
||||
g.setClip(oclip);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an image using the alpha channel from the first Image
|
||||
* and the RGB values from the second.
|
||||
|
||||
Reference in New Issue
Block a user