Image Handling Overview
The Image module in ProGUI provides functions for creating, loading, manipulating, and managing image resources used within the GUI. Images are fundamental for displaying icons, backgrounds, custom drawing, and creating image-based brushes.
Key functionalities include:
- Loading & Creation: Load images from various file formats (PNG, JPG, BMP, ICO) using LoadImg() or create new, blank images with specific dimensions and background colors using CreateImg().
- Dimensions: Retrieve the width and height of an image using ImgGetWidth() and ImgGetHeight().
- Multi-Size Images: ProGUI supports associating multiple size variants with a single image handle, particularly useful for icons or DPI-aware assets. ImgAddSize() adds a variant, and the system can automatically select the closest match during rendering.
- Properties: Get and set image properties like the interpolation mode used when scaling (ImgGetInterpolationMode(), ImgSetInterpolationMode()) and other flags using ImgSetProperty().
- Drawing Target: Use OutputImg() to obtain an output target handle, allowing you to draw onto an image using the Graphics & Drawing commands within a BeginDraw()/EndDraw() block.
- Manipulation: Extract a rectangular portion of an image into a new image using ImgGrab().
- Memory Management: Release image resources when no longer needed using FreeImg(). ProGUI uses reference counting internally, so an image is only truly freed when its reference count reaches zero.
Images are essential for creating visually rich interfaces and serve as the source for image brushes and image borders.