[OpenJDK 2D-Dev] Provide access to data offset in WritableRaster in Java 9

Peter A peter.abeles at gmail.com
Thu Jul 13 19:13:07 UTC 2017

Apologies since this probably not the correct list, but I was referenced
here from another Java list. I've actually been getting bounced around to a
few mailing lists. I'm hopeful that this is the right now!

The high level API in a BufferedImage is very very very slow.  To get
around that problem, in previous versions of Java, the internal rasters
which were defined in sun.awt.image were accessed.   Doing so enabled
real-time computer vision in Java.

Accessing the low level Rasters is no longer practical in Java 9.  After
this problem was reported by one of my users I looked into it and *almost*
found a work around  Unfortunately the higher level WritableRaster does not
provide access to the offset inside its internal data array.   This makes
processing of subimages impossible.  My suspicion is that it is most likely
an oversight because it provides access to every other piece of information
needed and the raw data.    It would be great if getDataOffset() could be
moved into WritableRaster or one of its parents instead of being hidden in
children of WritableRaster which are no longer accessible.

Just to clarify the raw arrays are stored inside of a DataBuffer and that
data structure contains an offset. This offset is always set to zero and
the offset inside of WritableRaster is what is needed,
e.g. IntegerInterleavedRaster.getDataOffsets().

- Peter

"Now, now my good man, this is no time for making enemies."    — Voltaire
(1694-1778), on his deathbed in response to a priest asking that he
renounce Satan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20170713/5b556e0e/attachment.html>

More information about the 2d-dev mailing list