Hi

So in one of those head-slappingly embarrassing moments of realization, it occurred to 
me on the train just now that my example had you trying to construct an abstract 
class, ComponentSampleModel. What you'd really want is one of the concrete subclasses, 
PixelInterleavedSampleModel. Moreover, you could do both the sample model and raster 
in one call to a WriteableRaster factory (static) method:

createInterleavedRaster(dataBuffer, w, h, w*n, 1, offsets, origin);

Even so, I would still ask yourself whether interleaving the resters like this is such 
a good idea. If the only reason is to save calls by only having to do the scaling 
operation once instead of n times, then I think you should probably just construct a 
raster for each image in the first place. Unless each raster is very small (say, less 
than 50 X 50), the overhead of calling the pixel processing code once for each raster 
instead of once for all of them will probably be negligible.

Cheers,
Pete


---
Pete Cockerell
California, USA
http://www.best.com/~petec



On Thu, 17 Jun 1999 17:12:20   Denis Riedijk wrote:
>Thanks, I will try it in a minute to see if it will work. This is my first
> experience with Java2D, so I am still trying to understand it all exactly, the
>construction of an image out of databuffers, samplemodels, rasters and
>colormodels :-)
>
>But from what I have understood from the docs, this will probably be it.
>
>About my use for this:
>I will have data (in a char array right now, but from what I understand it must
>become a short array now) which is scaled from 0-65535 (16 bits) This is output
>from different reconstruction programs. The user must be able to adjust the
>intensity-thresholds of the image ( set minimum to be black and maximum to be
>white, so standard value 0 will be black and value 65535 will be white, but
>when the user want 16734 to be black I have to scale from 16734 to 65535)
>This scaling of intensity must be done on all images, so therefore I can use
>different IndexColorModels I believe. Right now in my JDK1.1.7 program I have
>written a function to do this myself, but it is not too fast, and my most ugly
>piece of code (it is also very big) I think I can make it fast and small (and
>nice :-) by using Java2D
>
>
>Dhnis Riedijk
>
>


--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.

Reply via email to