You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Falkreon edited this page Jul 24, 2021
·
2 revisions
Using glow-image
ImageData is the main focus of this library. It's a 32-bit ARGB image in the sRGB colorspace.
Unlike BufferedImage, ImageData is not capable of different color depths, colorspaces or gamuts,
element orders, or bitplaning. It's made for fast access on modern machines, and straightforward
upload to GL, DX, or Java2D.
ImageData are obtained in a few ways: Just like BufferedImage, you can construct an empty, transparent image:
If you need more complex tasks, including image compositing, use an ImageEditor:
//You can use your main class's classLoader to grab resource InputStreams suitable for PNGImageLoader from the jarImageDataa = PNGImageLoader.load(TestClass.class.getClassLoader().getResourceAsStream("image/a.png"));
ImageDatab = PNGImageLoader.load(TestClass.class.getClassLoader().getResourceAsStream("image/b.png"));
ImageEditorbEditor = ImageEditor.edit(b);
bEditor.drawImage(a, 10, 10, BlendMode.LINEAR_BURN, 0.5); //blend with LINEAR_BURN and apply with 50% opacity//Opacity blends are applied using a high-quality linear colorspace method to avoid haloes//No close or dispose is needed here, the operation is complete at the end of the method call.