[5284] in java-interest

home help back first fref pref prev next nref lref last post

Re: Question: quick Image crop/copy/draw?

daemon@ATHENA.MIT.EDU (Greg Ewing)
Mon Feb 5 07:35:03 1996

Date: Mon, 5 Feb 1996 16:43:42 +1100
From: grege@optimation.com.au (Greg Ewing)
To: java-interest@java.sun.com
Cc: khkramer.student.harvard.edu@optimation.com.au

> From henryg Mon Feb  5 12:43 EST 1996
> From: NewsGroup_comp-lang-java
> >From: Kwin Kramer <khkramer@bitwise.net>
> Subject: Question: quick Image crop/copy/draw?
> Date: Sun, 04 Feb 1996 18:04:57 -0500
> Nntp-Posting-Host: khkramer.student.harvard.edu
> Mime-Version: 1.0
> Content-Transfer-Encoding: 7bit
> 
> Hi,
> 
> I have written a custom awt component that works great, but is much, much slower 
> repainting itself than I expected.
> 
> The following (pseudo) code -- in which a small Image is copied out of a much 
> larger reference Image -- seems to be the bottleneck:
> 
>     public Image getPieceOfImage() {
>         CropImageFilter crop = new CropImageFilter( someX, someY, someW, someH)
>         ImageProducer imgSrc = wholeBigImage.getSource();
>         Image pieceOfBigImage = createImage( new FilteredImageSource( imgSrc , 
> crop ) );
>         return pieceOfBigImage;
>     }
> 
> I can't figure out how to make this faster. Is there a createSubImage or 
> copyNewImage or some other perfect solution that I have missed? Does anyone have 
> any suggestions as to how to accomplish this in a better/faster way? The large 
> image varies in size, but could typically be 500x1500. The smaller image returned 
> by the method is intended to be drawn on a canvas, so it's smaller than the 
> screen size.
> 
> Yours,
> Kwin Kramer


Kwin,

I have the same problem (incredibly slow) when I use a FilteredImageSource. The same 
slowdown happens when I do a drawImage() to a target image with a larger dimension 
(this has the same effect as scaling the image to the new dimension).

If you get any clues please let me know.

GREG
grege@optimation.com.au
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post