Hi,
The performance mechanisms that you are interested in (DirectX
acceleration) are exactly those that are being explored and
implemented inside of the JDK for Merlin. In particular, we are
accelerating offscreen surfaces on Win32 through the use of
DirectDraw surfaces. Using DirectDraw in this manner should allow
us to take advantage of hardware acceleration for both rendering
to the offscreen surfaces and copying from those surfaces to the
onscreen windows (e.g., for double-buffering). And doing it
inside the JDK should allow us to accelerate all users of the API
on win32 (instead of forcing people to have their own acceleration
outside of the API).
Having said that, I don't believe that you will be able to achieve
the same results by trying to do this acceleration yourself.
Currently, the memory for offscreen surfaces is stored in the Java
heap, so getting that memory into VRAM would require your application
to manually copy the data out of the image and into whatever private
surface you have created.
If you go through this means of copying the data into your private
VRAM surface, you will still not be able to accelerate copying from
that surface to the screen, unless your screen window is also some
non-Java2D creation. That is, there is no way for you to hand
a surface pointer to Java2D and have it copy from that surface to
the onscreen window and have Java2D know that it should use
DirectDraw to do that copy. Instead, Java2D will have very little
information about the surface you have created and will only be
able to access the pixels of the surface through very slow
mechanisms (for example, Raster.getPixels()).
We have had other requests for extending the DataBuffer mechanism
(such as wrapping native data buffers) and are working on that
mechanism as well. But I think the best solution for your situation
would be the implicit creation of DirectDraw surfaces for images;
this would allow you to simply use the API to get the acceleration
that you are looking for.
One point I would mention, though: there is no support for Alpha
in DirectDraw, so I'm not sure what you meant by copying images
with alpha to the display surface. The initial support for DirectDraw
acceleration will only be for opaque images for that reason. There
are other possibilities for getting acceleration of alpha surfaces,
but those details have not been worked out yet. I'm curious to
know what your requirements would be in this area; that could
help us determine the relative importance of different kinds of
acceleration possibilities.
I hope this answers your questions; let us know if you have any more.
Chet Haase.
> Hi,
>
> I'm seeking for a way to draw on an arbitrary memory area with Java2D.
> The memory area is not in Java heap, so I'm asking helps.
>
> I need to implement some portion of drawings in my application
> with native codes for performance reason. Actually I'm trying to blit
> Java2D-drawn images with alpha channel to the display surface
> using DirectDraw. There should not be performance penalty.
>
> Is the current Java2D implementation relying on a specific type of data
> buffers(such as DataBufferInt which is final)? Is there any way
> to wrap arbitrary memory areas as data buffers without copying
> memory areas from here to there?
>
> I think if it's possible, we can also modify Swing repaint manager to
> allocate
> buffer as a DirectDraw surface and blit VRAM-to-VRAM.
>
> Any helps will be appreciated.
>
> Thanks in advance.
>
> ==================
> Kim, DoHyung
> Assistant Engineer
> 4DL, Inc.
> ==================
>
> ===========================================================================
> 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".
===========================================================================
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".