Brushes Overview
Brushes in ProGUI define how areas are filled or how strokes are drawn. They go beyond simple solid colors, allowing for complex fills using images or gradients. Drawing commands that fill areas (like DrawBoxFill, DrawPathFill, DrawRoundBoxFill, DrawEllipseFill) or draw complex strokes (DrawLineFill, DrawPathStrokeFill, etc.) require a Brush object.
Key functionalities include:
- Types: ProGUI supports several brush types:
- Solid Color: While there isn't an explicit `CreateSolidBrush`, solid colors are used directly in basic drawing commands (e.g., DrawBox). Underlying solid brushes are managed internally.
- Image Brush: Created using CreateBrushImg(), these brushes tile or stretch an image to fill an area.
- Linear Gradient Brush: Created with CreateBrushGradientLinear() or CreateBrushGradientLinearEx(), these blend colors along a straight line.
- Radial Gradient Brush: Created with CreateBrushGradientRadial() or CreateBrushGradientRadialEx(), these blend colors outwards from a central point in an elliptical shape.
- Configuration: Brushes can be extensively configured:
- Transformations: Apply translation (BrushSetPosition), scaling (BrushSetScale), and rotation (BrushSetRotation) to the brush pattern relative to the drawing origin.
- Opacity: Control the overall transparency of the brush using BrushSetOpacity().
- Extend Mode: Define how the brush pattern repeats outside its natural boundaries (e.g., clamp, wrap, mirror) using BrushSetExtendMode().
- Interpolation: Specify how colors are blended in gradients or how image pixels are sampled when scaled using BrushSetInterpolationMode().
- DPI Scaling: Control whether brush properties (like gradient points or image size) scale automatically with window DPI changes using BrushSetDpiScaling().
- Gradient Details: Add intermediate colors to gradients with BrushGradientAddColor(). Modify the geometry of existing gradients using BrushGradientLinearSetPoints() and BrushGradientRadialSetPoints().
- Management: Reset brush transformations with BrushReset(), change the image in an image brush with BrushSetImg(), and release resources with FreeBrush().
Brushes are essential for creating visually rich interfaces with textures, gradients, and complex fills. Remember to free created brushes using FreeBrush() when they are no longer needed.