[OpenJDK 2D-Dev] <AWT Dev> Fwd: creating images using native code
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Tue Aug 18 16:58:37 UTC 2015
This is 2d related question (cc 2d-dev).
> *From: *Alan Snyder <javalists at cbfiddle.com
> <mailto:javalists at cbfiddle.com>>
> *Subject: **<AWT Dev> creating images using native code*
> *Date: *August 11, 2015 at 5:36:55 PM PDT
> *To: *awt-dev at openjdk.java.net <mailto:awt-dev at openjdk.java.net>
>
> I am currently creating images with data provided by native code by
> capturing the data in an int array then using that array to construct
> a DataBufferInt which is used to create a WritableRaster which is used
> to create a BufferedImage.
>
> That seems to work fine, except that looking at the code it appears
> that the buffer is considered untrackable, which sounds like a bad
> thing. Does that in fact prevent caching the image in a GPU, for example?
Yes you are right, because in this case we cannot be sure when the data
inside the raster is changed, this can occur for example when we copy
this data from/to gpu.
>
> If so, is there a good way to create a cacheable image?
The public way is to draw the image once again to another one which will
be cached instead.
>
> The solutions I have found so far all wind up processing the pixels
> one at a time at some point, as far as I can tell, which should not be
> necessary.
>
> I’m wondering why there is no way to simply declare that the buffer
> will not change in the future.
>
> Alan
>
--
Best regards, Sergey.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20150818/fa13c8e5/attachment.html>
More information about the 2d-dev
mailing list