@@ -404,22 +404,24 @@ public void clear() {
404404 //////////////////////////////////////////////////////////////
405405
406406
407- /*
408- protected void imageImplAWT(java.awt.Image awtImage,
407+ protected void imageImpl (PImage image ,
409408 float x1 , float y1 , float x2 , float y2 ,
410409 int u1 , int v1 , int u2 , int v2 ) {
411410 pushMatrix ();
412411 translate (x1 , y1 );
413- int awtImageWidth = awtImage.getWidth(null);
414- int awtImageHeight = awtImage.getHeight(null);
415- scale((x2 - x1) / (float)awtImageWidth,
416- (y2 - y1) / (float)awtImageHeight);
417- g2.drawImage(awtImage,
418- 0, 0, awtImageWidth, awtImageHeight,
419- u1, v1, u2, v2, null);
412+ int imageWidth = image .width ;
413+ int imageHeight = image .height ;
414+ scale ((x2 - x1 ) / (float )imageWidth ,
415+ (y2 - y1 ) / (float )imageHeight );
416+ if (u2 -u1 != imageWidth || v2 -v1 != imageHeight ) {
417+ PImage tmp = new PImage (u2 -u1 , v2 -v1 , ARGB );
418+ tmp .copy (image , u1 , v1 , u2 , v2 , 0 , 0 , u2 -u1 , v2 -v1 );
419+ g2 .drawImage (image .getImage (), 0 , 0 , null );
420+ } else {
421+ g2 .drawImage (image .getImage (), u1 , v1 , null );
422+ }
420423 popMatrix ();
421424 }
422- */
423425
424426
425427 //////////////////////////////////////////////////////////////
0 commit comments