is an abstract class. You use a BufferedImage or VolatileImage when you need an implementation. The use of Image
in the toBufferedImage
method means you wish to accept either a BufferedImage or VolatileImage and let the method resolve which one it is dealing with at run-time (polymorphism). My guess is that this is not what you want.
Looking at your code it seems that toBufferedImage
is actually drawing the image. Why not rename the function and remove that return BufferedImage. Instead, when you create the image, cast it directly into a BufferedImage like so:
I wrote an Image processing tutorial
not long ago. It has some useful code on how to open, save and manipulate images (it uses a TYPE_INT_ARGB so don't be surprised if the bitwise pixel operators don't work with your TYPE_USHORT_565_RGB). This
example may also help you out.