libgfx library

A comprehensive 2D vector graphics engine for Dart with software rasterization.

Pure Dart implementation with no external dependencies, providing high-quality rendering for vector graphics, text, and images.

Classes

BasicTextShaper
Basic text shaper without complex layout support
Bitmap
Simple bitmap class for both rendering and image manipulation. Combines low-level rendering operations with high-level image transformations.
ClipRegion
Represents a clipping region with support for fill rules and hit testing
Color
A class to hold a 32-bit ARGB color value. This class is a pure Dart replacement for dart:ui.Color.
ColorStop
Represents a color stop in a gradient with position (offset) and color
ConicalGradient
Conical/Sweep gradient - creates an angular gradient around a center point
Font
Represents a font face with metrics and glyph access
FontFallbackChain
Font fallback chain for handling missing glyphs
FontRun
A run of text that uses the same font
GradientPaint
Base class for gradient paints with shared functionality
GraphicsEngine
A simple facade for the entire graphics engine.
GraphicsFileSystem
Provides byte-level IO without depending on dart:io, enabling libgfx to run in browser and isolate environments. Implementations handle any platform-specific directory management.
ImageFilters
Image filtering utilities
ImageOptions
Options for drawing images
LinearGradient
Matrix2D
An optimized 2D transformation matrix using 6 components.
Paint
Abstract base class for all paint types (solid colors, gradients, patterns)
Path
PathBuilder
PathCommand
PathOperations
Path operations class combining boolean operations, simplification, and transformation
PatternPaint
Enhanced pattern paint that supports Bitmap and advanced features
Point
A class representing a 2D vector or point.
RadialGradient
Rasterizer
Abstract interface for rasterizer implementations
Rectangle<T extends num>
A 2D axis-aligned rectangle.
ShapedGlyph
A shaped glyph with position and advance information
ShapedText
Result of text shaping
SolidPaint
Solid color paint that applies a uniform color to all pixels
SystemFontManager
System font manager for loading common system fonts
TextEngine
Text rendering engine with font management, shaping, and metrics calculation
TextMetrics
Text metrics returned by font measurement
TextPosition
Represents an adjusted text position
TextRenderer
Combines basic text rendering with advanced Unicode features
TextShaper
Text shaper interface for complex text layout
TransformUtils
Utilities for common transformation operations and matrix manipulations.
TTFFont
TrueType font implementation

Enums

Alignment
Defines how content should be aligned within a container.
BlendMode
Blend modes for compositing operations
FillRule
Fill rule for determining interior of a path
FilterType
Image filter types
GradientSpread
ImageFilter
Image filtering modes
LineCap
Line cap styles for stroked paths
LineJoin
Line join styles for stroked paths
PathCommandType
PatternRepeat
Pattern repeat modes
ScaleMode
Defines how content should be scaled to fit within a target area.
ScriptType
Script type for text shaping
TextAlign
Text alignment options
TextBaseline
Text baseline options
TextDirection
Text direction for bidirectional text
TextOperation
Text rendering operations

Typedefs

Image = Bitmap

Exceptions / Errors

ConfigurationException
Thrown when invalid configuration is provided
FontException
Thrown when a font operation fails
GraphicsException
Thrown when a graphics operation fails
ImageException
Thrown when an image operation fails
LibgfxException
Base class for all libgfx exceptions
RenderException
Thrown when a rendering operation fails
ResourceException
Thrown when required resources are not available
ResourceLimitException
Thrown when an operation would exceed resource limits
UnsupportedFormatException
Thrown when an unsupported format is encountered