Borders

Borders Overview

The Border module in ProGUI provides versatile methods for defining and drawing borders around elements or areas. ProGUI supports two main types of borders: generated borders and image borders.

Generated Borders: These are created programmatically using CreateBorder(). You can specify styles (like solid, dashed, dotted, double, groove, ridge, inset, outset), width, color, opacity, and corner radii. Properties for each of the four sides (top, right, bottom, left) can often be set individually using commands like BorderSetWidth(), BorderSetColor(), BorderSetRadius(), and BorderSetFlags(). Generated borders are rendered internally using an optimized image-based approach for complex styles (like rounded corners with dashes/dots) which involves caching different DPI versions.

Image Borders: These use image assets to create scalable borders, similar to CSS border-images. They are created using CreateBorderImg(), specifying an image and optionally a mask image. The image is conceptually divided into nine regions (slices) defined by edge offsets (BorderImgSetSlices()). The rendering behavior of the edge and center regions (stretch, repeat, round, space) is controlled by flags (BorderImgSetFlags()). The thickness of the edges can be scaled using BorderImgSetWidth().

Both border types can be drawn using the DrawBorder() command. You can also control whether borders scale with DPI using BorderSetDpiScaling(). Remember to release border resources using FreeBorder() when they are no longer needed.