Question about Graphics.drawImage()

류재호 thinker at
Wed Sep 30 01:20:26 PDT 1998

About one of many java.awt.Graphics.drawImage();

public abstract boolean drawImage(Image img,  int x,  int y, int width,  int height,  
Color background, ImageObserver observer)

Official spec says 

"Draws as much of the specified image as has already been scaled to fit inside the specified rectangle. 
The image is drawn inside the specified rectangle of this graphics context's coordinate space, 
and is scaled if necessary. Transparent pixels do not affect whatever pixels are already there. "

it says "image is scaled if necessary"...  but kaffe doesn't seem to do scaling
so i modified as follows.. is it right? that's my question.

public boolean drawImage ( Image img, int x, int y, int width, int height,
		                Color background, ImageObserver observer ) {
    if ( (Image.checkImage( img, -1, -1, observer, true) & ImageObserver.ALLBITS) != 0 ) {
        if(img.width != width || img.height != height) {
    		drawImgScaled( img, x,y , x+width, y+height,
    		            0, 0,img.width,img.height, background);
    		drawImg( img, x, y, 0, 0, width, height, background);
		return true;
	return false;

I have involved in porting AWT portion of Kaffe to some kind of newly creating experimental

Recently, I found some missings & bugs & differences compared to official spec.
I'lll post them as I  modify or solve or understand:)


P.S. : it works well in my env. but i modified toolkit & natives much so i'm wondering whether
it's ok in original kaffe.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 2683 bytes
Desc: not available
Url : 

More information about the kaffe mailing list