2D Graphics
Rem's Engine renders UI, and therefore has a set of predefined functions for rendering them easily. They are implemented in me.anno.gpu.drawing.
Rectangles
Rectangles can be filled using DrawRectangles.drawRect or their border be drawn using .drawBorder. If you need rounded corners, use DrawRounded. If you need pixel-perfect, vertical stripes, use DrawStriped.drawRectStriped.
Horizontal and vertical lines are just rectangles, so you can use the methods above for them.
Textures
There are many different texture types: 2d, 3d, 2d arrays, cubemaps, and accordingly, there are many methods to display them. They can be found inside DrawTextures.
Textures can be loaded using the ImageGPUCache.get(file,timeoutMillis,async), which will also keep them loaded in case another function uses them too.
Text
Text rendering is no longer trivial, and to achieve the best results, subpixel rendering should be used. This method lights subpixels of the monitor for improved resolution, typically on the x-axis. When your background is monotonous, don't worry about it, and just call DrawTexts.drawText(). The result is the size of what was drawn packed into a single int. When the background color is monotonous, you even can call DrawTexts.startSimpleBatch()/.finishSimpleBatch() if your font is monospace for improved text rendering performance. This is used in the HexEditor sample.
If your background isn't mono-colored, call r=pushBetterBlending(true) and popBetterBlending(r) to enable compute-shader based blending. This rendering will ensure the text is readable by adding an additional 1px thick outline if necessary, and correctly blend the text color with the background respecting subpixel layouts.
Lines, quadratic- and cubic curves
Lines including nice anti-aliasing can be drawn using DrawCurves. There is also batch-support, but only for lines for now (26th May 2023).
Circles and more
More shapes like circles can be found in GFXx2D
Created: 14:50, 26. Mar 2023; Most recent change: 12:29, 19. Sep 2023