Discover the latest powerful features that make AdvanceGG the most advanced 2D graphics library for Go.
Professional Photoshop-style layer management with 13 blend modes including Normal, Multiply, Screen, Overlay, Soft Light, Hard Light, Color Dodge, Color Burn, Darken, Lighten, Difference, and Exclusion.
// Enable layer system
dc.EnableLayers()
lm := dc.GetLayerManager()
// Create layers with different blend modes
layer1 := lm.AddLayer("background")
layer1.SetBlendMode(advancegg.BlendModeNormal)
layer2 := lm.AddLayer("overlay")
layer2.SetBlendMode(advancegg.BlendModeMultiply)
layer2.SetOpacity(0.8)
// Draw on specific layers
lm.SetActiveLayer(1)
dc.SetRGB(1, 0, 0)
dc.DrawCircle(100, 100, 50)
dc.Fill()
// Composite all layers
result := lm.Composite()
Modern web-like API with tree structure for shapes, IDs, CSS-like classes, and style inheritance. Perfect for complex graphics applications.
// Create document with elements
doc := advancegg.NewDocument()
// Create elements with IDs and classes
circle := advancegg.CreateCircle("circle1", 100, 100, 40)
circle.AddClass("shape")
circle.AddClass("primary")
circle.SetStyle("fill", color.RGBA{255, 100, 100, 255})
rect := advancegg.CreateRect("rect1", 200, 60, 80, 80)
rect.AddClass("shape")
rect.AddClass("secondary")
// Add CSS-like styles
doc.AddStyle(".primary", advancegg.Style{
Fill: color.RGBA{255, 100, 100, 255},
Stroke: color.RGBA{200, 50, 50, 255},
})
// Render document
doc.Render(ctx)
Point-in-path detection for interactive graphics with spatial indexing for O(log n) performance. Perfect for UI elements and interactive applications.
// Create hit test manager
htm := advancegg.NewHitTestManager()
// Add hit testable shapes
rect := advancegg.CreateHitTestRect("rect1", 50, 50, 100, 80)
circle := advancegg.CreateHitTestCircle("circle1", 200, 100, 40)
polygon := advancegg.CreateHitTestPolygon("triangle", trianglePoints)
htm.AddObject(rect)
htm.AddObject(circle)
htm.AddObject(polygon)
// Test for hits at mouse position
hits := htm.HitTest(mouseX, mouseY)
if len(hits) > 0 {
fmt.Printf("Hit: %s\n", hits[0].GetID())
}
Frame-based animation system with 9 easing functions and GIF export. Create smooth transitions and professional animations with ease.
// Create animator
animator := advancegg.NewAnimator(400, 300, 30.0, 3*time.Second)
// Generate frames with easing
for i := 0; i < frameCount; i++ {
t := float64(i) / float64(frameCount-1)
// Animate with bounce easing
x := advancegg.AnimateProperty(50, 350, t, advancegg.EaseLinear)
y := 150 + 80*advancegg.EaseBounce(t)
// Create frame
ctx := advancegg.NewContext(400, 300)
ctx.DrawCircle(x, y, 15)
ctx.Fill()
animator.AddFrame(ctx.Image())
}
// Export as GIF
animator.SaveGIF("animation.gif")
Advanced performance features including spatial indexing, render caching, parallel processing, and memory optimization for professional applications.
// Batch rendering for performance
colorGroups := make(map[color.RGBA][]Circle)
for _, circle := range circles {
colorGroups[circle.color] = append(colorGroups[circle.color], circle)
}
// Render by color groups (fewer state changes)
for col, group := range colorGroups {
dc.SetColor(col)
for _, circle := range group {
dc.DrawCircle(circle.x, circle.y, circle.radius)
dc.Fill()
}
}
Install AdvanceGG and start creating amazing graphics with these powerful new features.