Can ADD and MULTIPLY be expressed using Porter/Duff equations as per the existing rules? I seem to recall that they require clipping the result which none of the other modes require. The P/D chapter in Foley and vanDam mentiones PLUS, but it doesn't describe it in the same terms as the existing table of rules. It is more described as "another useful binary image operation".

Keep in mind that the existing P/D rules for AC are all implemented using a single loop at the bottom end that has a tiny variation in it that handles all 12 or so rules in the same piece of code with little structural change. Note that when I say "a single loop" I don't mean a single piece of code that is factored with macros into 12 loops, but a single actual compiled object function that handles all 12 rules. It doesn't even have any decisions in the inner loop for the 12 rules - instead it relies on mathematical similarities of the 12 rules to handle them all with a single computation. So, if you want to add new rules to this matrix, they might not fit into this technique and induce an explosion of the code that handles the AC rules. The technique only really deals well with rules that can be expressed with the 4 standard Fa and Fb functions that are guaranteed not to overflow in the math.

If you add rules that are incompatible with that technique then it is more likely that you'll have to special case them and vector them into new inner loops that do whatever clipping/clamping is required for ADD/MUL that isn't required for the regular AC rules. That isn't a huge issue, but it might almost be cleaner to have a new class so we vector into different code paths at a higher level than to have to vector off at a lower level. (Try it and see how it goes).

                        ...jim

jav...@javadesktop.org wrote:
Hi everyone,

quick question more or less related to this topic on hardware accelerated 
drawing:
I was desperately waiting for what was supposed to be called the PhotoComposite 
API that would allow new blending modes (ADD, MULTIPLY, OVERLAY, ...) to be 
used as Composite for the Graphics2D API.
Unfortunately, it seems that the original plan is no longer in scope as stated 
in the RFE 6541868 (RFE: hardware acceleration for advanced blending modes (aka 
PhotoComposite) ):

[i]"Therefore, my current inclination is to scale back the changes originally
proposed for JDK 7 and instead make small additions to the existing
AlphaComposite API with at least an ADD mode since a) that is the most
commonly requested blend mode that isn't already provided in AlphaComposite,
b) it fits in fairly well with the existing AlphaComposite rules, and
c) it can be accelerated easily in both the software and hardware pipelines
(without the use of shaders or reading back from the framebuffer in the
hardware case).  We might also be able to add a simple MULTIPLY mode, but
that will require some more investigation.
I think this approach (small enhancements to AlphaComposite) would serve
the needs of Java2D developers quite well, while keeping the implementation
burden low.  Developers who want access to extended blend modes can use the
Blend class from JavaFX, which offers the right amount of functionality in a
form that can be easily accelerated on the GPU."[/i]

Having ADD and MULTIPLY as Composite for Graphics2D is much better than nothing as they 
are usually the most useful "advanced" blending modes.

My problem is that I am working with the BufferStrategy to perform fast frame 
rate in fullscreen mode. And when using the BufferStrategy, I cannot access to 
the actual offscreen backbuffer to use it with the JavaFX Blend implementation 
that will give access to the other hardware accelerated blending modes.
As stated by Dmitri, using a VI and then drawing it with the BufferStrategy is 
not really satifying... This is why having the Graphics2D API able to use all 
the wonderful hardware accelerated drawing features of the JavaFX package would 
be very nice...

If you see some kind of workaround for me to use JavaFX API with the 
BufferStrategy without using an additional backbuffer, I would be very 
interested !

Thanks.

Vincent.
[Message sent by forum member 'vync79' (vync79)]

http://forums.java.net/jive/thread.jspa?messageID=340922

===========================================================================
To unsubscribe, send email to lists...@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
lists...@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to lists...@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
lists...@java.sun.com and include in the body of the message "help".

Reply via email to