Core graphics primitives
LibGfx provides fundamental types for 2D graphics operations.Geometric types
IntPoint / FloatPoint
2D coordinate positions with integer or floating-point precision
IntRect / FloatRect
Rectangles with position and dimensions, plus intersection/union operations
IntSize / FloatSize
Width and height dimensions
Quad
Arbitrary four-sided polygon
Color
Comprehensive color support with multiple representations:LibGfx supports multiple color spaces including sRGB, Display P3, and custom ICC profiles through the
ColorSpace class.Bitmap handling
Bitmap creation and manipulation
Bitmap is the core image storage class:
RGBA8888- 32-bit with alphaRGB888- 24-bit without alphaBGRx8888- 32-bit BGR formatBGRA8888- 32-bit BGRA with alpha
ImmutableBitmap
Read-only, shareable bitmap optimized for multi-process usage:Image decoding
LibGfx includes decoders for common image formats:PNG
Full PNG support with transparency
JPEG
Baseline and progressive JPEG
GIF
Including animations
WebP
Lossy and lossless
BMP
Windows bitmap format
ICO
Windows icon format
Font rendering
Font system
LibGfx provides font loading and text rendering:Text layout
Complex text shaping and layout:Painting
LibGfx uses Skia for high-performance 2D rendering.Painter interface
Painter provides the main drawing API:
Advanced painting
Paths and vector graphics
Path construction
Transformations
AffineTransform provides 2D matrix transformations:
Hardware acceleration
LibGfx supports multiple rendering backends:Skia backend
Default high-performance backend using Skia:Vulkan and Metal
Platform-specific GPU acceleration:- Vulkan: Cross-platform GPU rendering (
VulkanContext) - Metal: macOS/iOS GPU rendering (
MetalContext)
Filters and effects
Image filtering and effects:System theme integration
Source location
- Repository:
~/workspace/source/Libraries/LibGfx/ - Key headers:
Bitmap.h,Color.h,Painter.h,Rect.h,Point.h,Font.h - Image formats:
LibGfx/ImageFormats/ - Fonts:
LibGfx/Font/
LibGfx is designed to be backend-agnostic. While it currently uses Skia as the primary rendering engine, the API abstracts the underlying implementation.