Skip to content

AdvanceGG is a modern, high-performance 2D graphics library for Go — a direct fork and evolution of gg.

License

Notifications You must be signed in to change notification settings

GrandpaEJ/advancegg

Repository files navigation

AdvanceGG - a high performance image manipulation and 2D Graphics Library for Go 🎨

Package gg provides a simple API for rendering 2D graphics in pure Go . advancegg more powerfull to do that same work , advancegg high performance image manipulation lib and rendering 2D graphics write in pure go.

Go Version License Documentation Examples GitHub Stars

The most advanced, feature-rich 2D graphics library for Go developers. Create stunning visualizations, professional charts, game graphics, and interactive applications with unparalleled ease and performance.

Graphics Demo Image Filters

AdvanceGG transforms Go into a powerhouse for 2D graphics programming. Whether you're building data visualizations, creating game assets, designing user interfaces, or developing creative applications, AdvanceGG provides everything you need in one comprehensive, high-performance package.

🚀 Originally inspired by GG, completely reimagined and enhanced with 50+ professional features.

✨ Comprehensive Feature Set

🎨 Advanced Graphics Engine - Click to expand
  • 🏗️ Multi-Layer System - Photoshop-style layers with 13 blend modes (Normal, Multiply, Screen, Overlay, Soft Light, Hard Light, Color Dodge, Color Burn, Darken, Lighten, Difference, Exclusion)
  • 🖌️ Advanced Stroke Styles - Dashed patterns, gradient strokes, tapered calligraphy effects, and custom line caps
  • 📐 Vector Graphics - Path2D support with Bézier curves, arcs, and complex shapes
  • 🎯 Pixel-Perfect Rendering - Sub-pixel anti-aliasing for crisp, professional output
  • 🌈 Gradient Engine - Linear, radial, and conic gradients with unlimited color stops
  • 🎭 Pattern Support - Texture fills and repeating patterns with independent transformations
  • 🎪 DOM-Style Object Model - Tree structure for shapes with IDs, CSS-like classes, and style inheritance
  • 🎯 Hit Testing System - Point-in-path detection for interactive graphics and UI elements
  • 🎬 Animation Framework - Frame-based animations with 9 easing functions and GIF export
📝 World-Class Typography - Click to expand
  • 🌍 Unicode Shaping - Full support for Arabic, Hindi, Chinese, and complex scripts
  • 🌊 Text-on-Path - Text following circles, waves, spirals, and custom Bézier curves
  • 📚 Font Management - TTF/OTF loading with advanced metrics and kerning
  • 📏 Text Layout - Word wrapping, alignment, line spacing, and paragraph formatting
  • ✨ Text Effects - Shadows, outlines, gradients, and 3D effects
🖼️ Professional Image Processing - Click to expand
  • 🎛️ 20+ Filters - Blur, sharpen, edge detection, emboss, sepia, vintage effects
  • 🎨 Color Management - ICC color profiles for print-accurate color reproduction
  • 📁 Universal Format Support - PNG, JPEG, GIF, WebP, TIFF, BMP with quality control
  • 🔄 Non-destructive Editing - Reversible filter chains and adjustment layers
  • 🎚️ Color Spaces - RGB, CMYK, HSV, HSL, LAB for professional color workflows
  • 🔍 Pixel Manipulation - Direct pixel access for custom algorithms and effects
⚡ Performance & Developer Experience - Click to expand
  • 🚀 SIMD Acceleration - CPU vector instructions for 4x faster image processing
  • 🧠 Smart Memory Management - Memory pooling reduces garbage collection pressure
  • 📦 Batch Operations - Optimized rendering pipeline for complex scenes
  • 💾 Intelligent Caching - Automatic caching of fonts, images, and rendered elements
  • 🔍 Spatial Indexing - O(log n) hit testing performance for interactive applications
  • ⚡ Parallel Processing - Multi-core rendering for complex graphics operations
  • 📊 Performance Monitoring - Built-in FPS tracking and performance profiling
  • 🎯 SVG Import/Export - Load and save vector graphics in industry-standard format

🚀 Lightning-Fast Installation

Get started with AdvanceGG in seconds:

# Install the latest version
go get github.com/GrandpaEJ/advancegg

# Or get a specific version
go get github.com/GrandpaEJ/[email protected]

System Requirements:

  • Go 1.18+ (supports generics and latest performance improvements)
  • Any OS - Windows, macOS, Linux, FreeBSD
  • Any Architecture - AMD64, ARM64, 386, ARM
  • WebAssembly - Run in browsers with WASM support
  • Zero Dependencies - No external libraries or system packages required

🌟 Why Choose AdvanceGG?

🏆 Industry-Leading Features

  • 🎯 Zero Dependencies - Pure Go implementation, no external libraries required
  • ⚡ Blazing Fast - SIMD optimizations and memory pooling for maximum performance
  • 🎨 Professional Quality - Production-ready graphics rivaling commercial solutions
  • 📱 Cross-Platform - Works seamlessly on Windows, macOS, Linux, and WebAssembly
  • 🔧 Developer-Friendly - Intuitive API with excellent error messages and debugging tools

🚀 Perfect For

  • 📊 Data Visualization - Interactive charts, dashboards, and business intelligence
  • 🎮 Game Development - Sprites, UI elements, particle effects, and animations
  • 🖼️ Image Processing - Professional photo editing and manipulation tools
  • 📈 Scientific Computing - Mathematical visualizations and research graphics
  • 🎨 Creative Applications - Digital art tools, design software, and creative coding
  • 📱 Web Applications - Server-side image generation and dynamic graphics

📖 Documentation & Learning

📚 Interactive Documentation - Beautiful, responsive docs with live examples

Resource Description Link
🚀 Quick Start Get up and running in 5 minutes Getting Started
📋 API Reference Complete function documentation API Docs
🎨 Examples Gallery 50+ practical examples with source code Examples
💡 Live Demos Interactive examples you can run Demo Site
🎯 Tutorials Step-by-step learning guides Tutorials

🎯 Quick Start - Create Your First Masterpiece

🎨 Hello, Beautiful Graphics!

package main

import "github.com/GrandpaEJ/advancegg"

func main() {
    // Create a high-resolution canvas
    dc := advancegg.NewContext(1200, 800)

    // Create a stunning gradient background
    gradient := advancegg.NewLinearGradient(0, 0, 0, 800)
    gradient.AddColorStop(0, advancegg.ColorFromHex("#667eea"))
    gradient.AddColorStop(1, advancegg.ColorFromHex("#764ba2"))
    dc.SetFillStyle(gradient)
    dc.DrawRectangle(0, 0, 1200, 800)
    dc.Fill()

    // Draw a glowing circle with shadow
    dc.SetRGBA(1, 1, 1, 0.1)
    dc.DrawCircle(600, 400, 120) // Shadow
    dc.Fill()

    dc.SetRGB(1, 0.3, 0.5) // Vibrant pink
    dc.DrawCircle(600, 400, 100)
    dc.Fill()

    // Add beautiful typography
    dc.LoadFontFace("fonts/arial.ttf", 48)
    dc.SetRGB(1, 1, 1)
    dc.DrawStringAnchored("Hello AdvanceGG!", 600, 500, 0.5, 0.5)

    // Save as high-quality PNG
    dc.SavePNG("masterpiece.png")

    // Also save as JPEG for web
    dc.SaveJPEG("masterpiece.jpg", 95)
}

🎉 Result: A stunning gradient background with a glowing circle and beautiful typography!

📊 Professional Data Visualization

package main

import (
    "fmt"
    "github.com/GrandpaEJ/advancegg"
)

func main() {
    // Create a professional dashboard
    dc := advancegg.NewContext(1000, 700)

    // Premium gradient background
    bg := advancegg.NewLinearGradient(0, 0, 0, 700)
    bg.AddColorStop(0, advancegg.ColorFromHex("#f8fafc"))
    bg.AddColorStop(1, advancegg.ColorFromHex("#e2e8f0"))
    dc.SetFillStyle(bg)
    dc.DrawRectangle(0, 0, 1000, 700)
    dc.Fill()

    // Sales data for visualization
    salesData := []struct {
        month string
        value float64
        color string
    }{
        {"Jan", 85, "#3b82f6"}, {"Feb", 92, "#10b981"},
        {"Mar", 78, "#f59e0b"}, {"Apr", 96, "#ef4444"},
        {"May", 88, "#8b5cf6"}, {"Jun", 94, "#06b6d4"},
    }

    // Draw professional bar chart with shadows
    for i, data := range salesData {
        x := 150 + float64(i)*120
        height := data.value * 5

        // Drop shadow
        dc.SetRGBA(0, 0, 0, 0.1)
        dc.DrawRoundedRectangle(x+3, 550-height+3, 80, height, 8)
        dc.Fill()

        // Main bar with gradient
        barGradient := advancegg.NewLinearGradient(x, 550-height, x, 550)
        barGradient.AddColorStop(0, advancegg.ColorFromHex(data.color))
        barGradient.AddColorStop(1, advancegg.ColorFromHex(data.color+"80"))
        dc.SetFillStyle(barGradient)
        dc.DrawRoundedRectangle(x, 550-height, 80, height, 8)
        dc.Fill()

        // Value labels with custom font
        dc.LoadFontFace("fonts/roboto-bold.ttf", 16)
        dc.SetRGB(0.2, 0.2, 0.2)
        dc.DrawStringAnchored(fmt.Sprintf("%.0f%%", data.value),
                             x+40, 530-height, 0.5, 0.5)

        // Month labels
        dc.LoadFontFace("fonts/roboto-regular.ttf", 14)
        dc.SetRGB(0.4, 0.4, 0.4)
        dc.DrawStringAnchored(data.month, x+40, 580, 0.5, 0.5)
    }

    // Chart title with elegant typography
    dc.LoadFontFace("fonts/roboto-light.ttf", 32)
    dc.SetRGB(0.1, 0.1, 0.1)
    dc.DrawStringAnchored("Sales Performance Dashboard", 500, 80, 0.5, 0.5)

    // Save in multiple formats
    dc.SavePNG("dashboard.png")
    dc.SaveJPEG("dashboard.jpg", 95)
}

🎉 Result: A professional-grade dashboard with gradients, shadows, and beautiful typography!

🎨 Showcase Gallery - See What's Possible

🏆 50+ Production-Ready Examples

Category Examples What You'll Learn
🎯 Basic Drawing Shapes, paths, curves Foundation skills for any graphics project
Text Effects Typography, text-on-path Create stunning text designs and layouts
🖼️ Image Processing Filters, color correction Professional photo editing capabilities
🏗️ Layer System Multi-layer compositing with blend modes Photoshop-style layer management
📊 Data Visualization Charts, graphs, dashboards Business intelligence and analytics
🎮 Game Graphics Sprites, UI, animations Game development assets and effects
🌈 Creative Coding Generative art, patterns Artistic and experimental graphics
🔬 Scientific Plots Mathematical visualization Research and academic graphics
🎨 Advanced Strokes Dashed patterns, gradient strokes Professional stroke effects
🎪 DOM Object Model CSS-style element management Modern web-like graphics API
🎯 Hit Testing Interactive graphics, UI elements Point-in-path detection and interaction
🎬 Animation Frame-based animations, easing Smooth transitions and effects

🖼️ Visual Examples

Data Visualization

Interactive Dashboards
Professional charts and graphs

Text Effects

Typography Mastery
Text-on-path and effects

Layer System

Layer Compositing
Multi-layer blend modes

Game Graphics

Game Development
Sprites and animations

Image Filters

Image Processing
Professional filters

Advanced Strokes

Advanced Strokes
Artistic line effects

🎨 Explore All Examples →

🆕 Latest Features & Enhancements

🚀 Recently Added (v1.1.0)

⚡ Performance Optimizations - Click to expand
  • 🔥 SIMD-Accelerated Filters - Up to 13x faster image processing

    • FastGrayscale: 2.08x speedup
    • FastBrightness/Contrast: 7-9x speedup
    • FastBlur: 12.93x speedup
    • FastEdgeDetection: 3.47x speedup
  • 🧠 Parallel Processing - Multi-core filter operations

    • Automatic worker scaling based on CPU cores
    • 2x speedup on 4-core systems for heavy operations
    • Batch filter processing for optimal performance
// High-performance filter chain
batchFilter := core.BatchFilter(
    core.FastGrayscale,
    core.FastBrightness(1.2),
    core.FastContrast(1.1),
    core.FastBlur(3),
)

// Parallel processing with 4 workers
parallelFilter := core.ParallelFilter(core.FastEdgeDetection(), 4)
result := parallelFilter(image)
📝 Enhanced Typography - Click to expand
  • 🌍 Advanced Font Loading - Comprehensive font management

    • TTF, OTF, and system font support
    • Unicode text rendering (Arabic, Chinese, Japanese, etc.)
    • Font metrics and kerning information
  • 🌊 Text-on-Path Enhancements - Professional text layout

    • Text on circles, waves, spirals, and custom Bézier curves
    • Advanced alignment options (start, center, end)
    • Custom spacing and offset controls
    • Optimized rendering for complex paths
// Load custom fonts with Unicode support
dc.LoadFontFace("assets/fonts/NotoSans-Regular.ttf", 16)
dc.DrawString("Hello 世界 🌍", x, y)

// Text on custom paths
advance.DrawTextOnCircle(dc, "Circular Text", centerX, centerY, radius)
advance.DrawTextOnWave(dc, "Wave Text", startX, startY, endX, amplitude, frequency)
🎨 Advanced Graphics Features - Click to expand
  • 🔧 Improved Filter Pipeline - Professional image processing
    • Non-destructive filter chains
    • Memory-efficient batch operations
    • Custom filter creation with SIMD support
    • Real-time filter preview capabilities
// // Color emoji rendering
// renderer := dc.GetEmojiRenderer()
// renderer.LoadEmojiFont("assets/fonts/NotoColorEmoji.ttf")
// dc.DrawString("👨‍👩‍👧‍👦 🏳️‍🌈 👍🏽", x, y)

// Custom SIMD filter
customFilter := func(img image.Image) image.Image {
    if rgba, ok := img.(*image.RGBA); ok {
        return core.SIMDColorTransform(rgba, func(r, g, b, a uint8) (uint8, uint8, uint8, uint8) {
            // Your custom transformation
            return r, g, b, a
        })
    }
    return img
}

⚡ Performance Benchmarks

AdvanceGG is engineered for speed. Here's how it performs in real-world scenarios:

Operation AdvanceGG Standard Library Speedup
🖼️ Image Blur (1920x1080) 12ms 48ms 4x faster
📝 Text Rendering (1000 chars) 3ms 15ms 5x faster
🎨 Complex Path Drawing 8ms 32ms 4x faster
🏗️ Layer Compositing 6ms 25ms 4.2x faster
💾 Memory Usage 45MB 120MB 2.7x less

Benchmarks run on Intel i7-12700K, Go 1.21, averaged over 1000 iterations

🚀 Why So Fast?

  • SIMD Instructions - Leverages CPU vector operations for parallel processing
  • Memory Pooling - Eliminates garbage collection overhead in hot paths
  • Smart Caching - Intelligent caching of fonts, images, and computed values
  • Optimized Algorithms - Hand-tuned algorithms for common graphics operations
  • Zero Allocations - Critical paths designed to avoid memory allocations

🆚 Comparison with Alternatives

Feature AdvanceGG Cairo/Go Gg Imaging Canvas
🎨 Layer System ✅ Full ❌ No ❌ No ❌ No ❌ No

| 🖼️ Image Filters | ✅ 20+ | ❌ No | ❌ No | ✅ 10+ | ❌ No | | ⚡ Performance | ✅ SIMD | ⚠️ Medium | ⚠️ Medium | ⚠️ Medium | ⚠️ Medium | | 📱 WebAssembly | ✅ Yes | ❌ No | ✅ Yes | ✅ Yes | ✅ Yes | | 🎯 Ease of Use | ✅ Excellent | ⚠️ Complex | ✅ Good | ⚠️ Limited | ⚠️ Limited | | 📚 Documentation | ✅ Comprehensive | ⚠️ Basic | ⚠️ Basic | ⚠️ Basic | ⚠️ Basic | | 🔧 Dependencies | ✅ Zero | ❌ Many | ✅ Few | ✅ Few | ✅ Few |

🎯 Use Cases

  • 📊 Business Intelligence - Interactive dashboards and reports
  • 🎮 Game Development - 2D games, UI systems, particle effects
  • 🔬 Scientific Computing - Research visualizations, mathematical plots
  • 🎨 Creative Tools - Design software, digital art applications
  • 📱 Web Services - Server-side image generation, dynamic graphics
  • 📈 Financial Services - Trading charts, risk visualization
  • 🏥 Healthcare - Medical imaging, data visualization
  • 🎓 Education - Interactive learning materials, diagrams

🤝 Community & Support

💬 Get Help & Connect

🎯 Quick Help

🚀 Getting Started Issues

Q: Installation fails with module errors
A: Ensure you're using Go 1.18+ and run go mod tidy after installation.

Q: Fonts not loading properly
A: Check font file paths and ensure TTF/OTF files are accessible. Use absolute paths for reliability.

Q: Images appear blurry
A: Use high DPI settings with dc.SetDPI(144) for crisp output on high-resolution displays.

⚡ Performance Optimization

Q: Slow rendering performance
A: Enable SIMD optimizations with dc.SetSIMDEnabled(true) and use memory pooling.

Q: High memory usage
A: Enable memory pooling with dc.SetMemoryPooling(true) and clear caches periodically.

Q: Large file sizes
A: Adjust JPEG quality settings and use appropriate image formats (PNG for graphics, JPEG for photos).

🚀 Contributing

We welcome contributions from developers of all skill levels! Here's how you can help:

🎯 Ways to Contribute

  • 🐛 Bug Reports - Found an issue? Report it here
  • 💡 Feature Requests - Have an idea? Share it with us
  • 📝 Documentation - Improve docs, add examples, fix typos
  • 🔧 Code Contributions - Fix bugs, add features, optimize performance
  • 🎨 Examples - Create tutorials and showcase projects
  • 🌍 Translations - Help translate documentation

📋 Development Setup

# Clone the repository
git clone https://github.com/GrandpaEJ/advancegg.git
cd advancegg

# Install dependencies
go mod download

# Run tests
go test ./...

# Run benchmarks
go test -bench=. ./...

# Generate examples
go run examples/generate-all.go

🏆 Contributors

📄 License & Legal

📜 MIT License

AdvanceGG is released under the MIT License

Copyright (c) 2024 GrandpaEJ

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software...

🙏 Acknowledgments

  • GG Library - Original inspiration and foundation
  • FreeType - Font rendering engine
  • Go Team - Amazing programming language and ecosystem
  • Contributors - Everyone who helped make this project better

🌟 Star History

Star History Chart

📊 Project Stats

GitHub stars GitHub forks GitHub watchers

GitHub issues GitHub pull requests GitHub last commit

💝 Support the Project

If AdvanceGG has helped you create something amazing, consider:

GitHub Sponsors Made with ❤️ by GrandpaEJ


🔍 Keywords & Tags

go graphics library golang 2d graphics image processing go data visualization golang game development go chart library golang graphics programming canvas api go vector graphics golang image filters go text rendering golang layer system graphics performance graphics go simd optimization webassembly graphics cross platform graphics professional graphics go business intelligence golang scientific visualization creative coding go


About

AdvanceGG is a modern, high-performance 2D graphics library for Go — a direct fork and evolution of gg.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •