Edvard,
> Well one problem is that I need to do a few per-pixel operations.
> Anyways as it seems like most of the java2d functions are accelerated
> inside the JVM, it could be faster to simply draw a line of length 1, or
> is it?
Good question. I think the answer depends on the situation. I'd suggest
you benchmark your application to see what's best for you. In the next
release (1.4), the tradeoff will be different on those platforms
with hardware acceleration support for images (mainly win32). This is
because you are trading off a potentially slightly slower route for drawing
that one pixel draw versus a much slower route for all other operations
(since we have to punt on all acceleration once you start handling
the pixels manually).
> Also my custom class built on ImageProducers is almost 50% faster
> than pure java2d (though I still don't know how to load the images
> quickly), so I don't think it's worth to use java2d if it isn't a lot
> faster, the biggest problem with performance seem to be rotation of an
> image which is **slow** compared to what you can do with C/asm. The
> reason why my own class is faster, is because I can combine effects in
> ways that aren't possible without accessing the pure image buffer and
> knowing what I'm doing...
I can see how this would be faster; once you start doing transformations
and other advanced effects on the images, we have general-case loops
that handle those operations. I don't know anything about your application,
but if it's possible to rotate and then cache the result, you could
take advantage of the API more. For example, if you are rotating a static
image in a set number of positions, you could do each rotation once and
then store each as an image to be used the next time you need that rotation.
>
> However, my biggest problem is with browser support. As only netscape 6
> seems to directly support java2d (well I'm unable to test with IE, as
> I'm using linux, freebsd and solaris, so I don't know). I can only hope
> JVMs are going to be like any plugin, ie. the browser can inform the
> user that he/she needs to update his/her JVM. Now it seems like the only
> people that actually update their JVMs are developers... and that's not
> a big market for a company :)
>
> Hearing that jdk1.4 is going to support hardware acceleration is really
> cool. I hope T&L hardware is going to be used with transformations. I
> don't know the internal architecture of the java2d pipeline (I'd love to
> find some good info), but if it performs all rendering in one shot when
> calling drawImage, the implementation in hardware can't be difficult
> (atleast this would make image rotating faster :)).
That's an excellent idea .... but not one that will make this next
release. For jdk1.4, we're concentrating on the basic image functions and
trying to make them go fast. Simple things like rendering to and copying
from an offscreen image will try to use hardware acceleration (where
possible; accelerating operations to offscreen images is not as
possible on Solaris. We can and do use pixmaps, but these are not really
hardware-accelerated the same way that vram-cached images are on win32).
More advanced image operations such as transformations, anti-aliasing,
and compositing will have to wait for the follow-on release.
We'll get there...
>
> Also I'm wondering how big is the performance difference between C and
> Java, when accessing buffers directly, is it like 1:20-30? And one more
It totally depends on your application. Benchmarking what your trying
to do is the best way to get a handle on it.
> thing, could it be possible to in a future release of java map objects
> to another, like being able to map an int array to a byte array so that
> they would both "point" to the same thing ie. changing the int at
> address n would be the same thing as accessing the byte at address 4 *
> n. Thus it would be possible to write pure data into something while
> still using the routines provided by java to manipulate this object. Of
> course this could come with some locking issues, and it could be
> "unjavaish" or something...
Hmmm. Casting objects to different types? Sounds like the Java
police would be after you.... I don't think this kind of feature would
make it into the language anytime soon (I don't know what is planned, but
type-safety and prevention from the dangers of C tricks seem to be
pretty big goals of the language so far...)
Chet.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".