Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-10 Thread Jim Graham
I think I've discovered at least one problem that you are running into - we don't have an optimized loop to convert from 1-bit binary images to INT_RGB images. Further, the general code that gets used doesn't take the best advantage of the existing optimized loops that do exist. We only have

Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-10 Thread Jim Graham
jav...@javadesktop.org wrote: - let us know what image formats you are seeing in the loaded image and which Reader is loading it so we can consider adding loops that deal with that format more directly (or modifying our format detection code to recognize it if there is something amiss with our

Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-09 Thread java2d
Hello Jim, you have provided here so much valuable information that i doubt if i have found that before all in one place, THANK YOU. Let me come to some specifics: What is the image format you are using in the TIFF file and what are the parameters of the *Models it uses to represent it in

Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-08 Thread java2d
Thank you for all your answers, there is one question not answered yet: Is it possible to create a BufferedImage with a custom DataBuffer that can be put in the video-cache? Costas [Message sent by forum member 'csterg' (csterg)] http://forums.java.net/jive/thread.jspa?messageID=349659

Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-08 Thread Jim Graham
jav...@javadesktop.org wrote: Thank you Dmitri for your answer. Let me just say a bit more of the problem and why i go to this method: My goal is to find the faster way to load an image from the disk (a tif file, either binary or colored) and display it on the screen in a compatible way (e.g.

Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-07 Thread java2d
The first thing that you will have to understand is that Java is going to be slower than anything except maybe Flash. If your goal s to be as fast as C, C++, C# or .Net then you should find another goal because it is already a given that Java will be slower. You mix up runtime enviroments

Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-07 Thread Ken Warner
Last time I looked, both C and C++ had runtime code -- I suppose one could dispute that that code created a runtime environment. I wouldn't argue with that. And if the design of an API is so complex that the average programmer can't understand how to use it is the hallmark of good design --

Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-06 Thread java2d
Thank you Dmitri for your answer. Let me just say a bit more of the problem and why i go to this method: My goal is to find the faster way to load an image from the disk (a tif file, either binary or colored) and display it on the screen in a compatible way (e.g. fast to redraw, pan, zoom,

Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-06 Thread Ken Warner
The first thing that you will have to understand is that Java is going to be slower than anything except maybe Flash. If your goal is to be as fast as C, C++, C# or .Net then you should find another goal because it is already a given that Java will be slower. Another way to display an image is

Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-05 Thread Dmitri Trembovetski
Could you please show the code which creates the BufferedImage? Thanks, Dmitri jav...@javadesktop.org wrote: Hi all, I am trying to create a BufferedImage manually (e.g. via the constructor) and i am using the DirectColorModel and the SinglePixelPackedSampleModel. I am trying to

Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-05 Thread java2d
Of course. Here is a proc that converts a binary image to a compatible RGB: public static BufferedImage convertToSinglePixelPackedSampleModel_BINARY(BufferedImage image) { int[] bitMasks = new int[]{0x00ff, 0xff00, 0x00ff}; SinglePixelPackedSampleModel sampleModel = new

Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-05 Thread java2d
Of course. Here is a proc that converts a binary image to a compatible RGB: [code] public static BufferedImage convertToSinglePixelPackedSampleModel_BINARY(BufferedImage image) { int[] bitMasks = new int[]{0x00ff, 0xff00, 0x00ff}; SinglePixelPackedSampleModel sampleModel =

Re: [JAVA2D] createCompatibleImage: why is it faster than creating a Buffered image?

2009-06-05 Thread Dmitri Trembovetski
The problem with your first method is that you are creating the image with your own DataBuffer. This prohibits this image from ever being cached in video memory since we can not guarantee that the cache will be up to date with the original image. Thus the image is unmanageable. I'm not