Graphics & Drawing Overview
This section details ProGUIās core 2D graphics rendering capabilities. These functions provide the tools to draw shapes, text, images, and complex borders onto output targets, which can be either windows or in-memory images. ProGUI abstracts the underlying graphics subsystem (Direct2D on Windows, Cairo on Linux) to offer a consistent API.
Key functionalities include:
- Drawing Context: Initiating and terminating drawing
operations on a specific output (BeginDraw(), EndDraw()). The output target is obtained via OutputImg(). Note:
BeginDraw()andEndDraw()are handled automatically internally inside draw event handlers for windows and widgets. - State Management: Saving and restoring the drawing state (transformations, clipping, styles, paths) using DrawSave() and DrawRestore(). Setting and retrieving global drawing properties like anti-aliasing (DrawSetAntialias(), DrawGetAntialias()), blend mode (DrawSetBlendMode(), DrawGetBlendMode()), and querying the current active driver (GetGFXDriver()).
- Drawing Primitives: Functions for drawing basic shapes like lines (DrawLine(), DrawLineFill()), rectangles (DrawBox(), DrawBoxFill(), DrawBoxStroke(), DrawBoxStrokeFill()), rounded rectangles (DrawRoundBox(), DrawRoundBoxFill(), DrawRoundBoxStroke(), DrawRoundBoxStrokeFill()), and ellipses (DrawEllipse(), DrawEllipseFill(), DrawEllipseStroke(), DrawEllipseStrokeFill()).
- Paths: A vector path API allowing the creation of complex shapes composed of lines, curves, and arcs (PathMoveTo(), PathAddLine(), PathAddCurve(), PathAddArc(), PathClose(), PathReset()). You can also query the current path cursor (PathGetCursorX(), PathGetCursorY()). Paths can be drawn filled or stroked (DrawPath(), DrawPathFill(), DrawPathStroke(), DrawPathStrokeFill()).
- Stroke Styling: Configuring the appearance of lines and outlines using DrawSetStroke(), DrawGetStroke(), DrawSetStrokeCustom(), and DrawSetStrokeMiterLimit() to control width, dash patterns, end caps, and corner joins.
- Images & Shadows: Drawing images (DrawImg(), DrawImgEx()) and applying complex drop shadow effects (DrawImgShadow(), DrawImgShadowEx(), DrawImgShadowInset(), DrawImgShadowInsetEx()).
- Borders: Drawing complex borders (DrawBorder()) created using the Border API.
- Text: Rendering text created with the Text Handling API (DrawTxt(), DrawTxtFill()).
- Layers & Clipping: Managing drawing layers with opacity and masking (BeginLayer(), EndLayer()) and defining clipping regions (BeginClipBox(), BeginClipPath(), EndClip()).
- Output Management & Utilities: Clearing the output (DrawClear()), color blending utilities (AlphaBlendColor()), and managing DPI settings for the drawing context (DrawDPI(), DrawGetDPI(), DrawGetDPIScaleX(), DrawGetDPIScaleY()).