Here is an example of creating and writing in pixels using BufferedImage:
BufferedImage image = new BufferedImage(10, 80, BufferedImage.TYPE_4BYTE_ABGR); image.setRGB(5, 20, Color.BLUE.getRGB());
The third parameter in the image is a type that can vary depending on your use, but for basic solid colors, the result shown is good. SetRGB uses an internal color representation, so you can simply use the color constant directly.
You probably don't want to use VolatileImage, because the benefits in custom Java implementations are dubious. See fooobar.com/questions/1044315 / ... why it might not help.
See the image of Oracle turorial for reference. It explains both your options and how you interact with them.
source share