Skip to content

CuteSORA/advancegg

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

127 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

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
  • ๐Ÿ˜€ Emoji Rendering - Color emoji fonts with automatic fallback mechanisms
  • ๐ŸŒŠ 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/advancegg@v1.0.0

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

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 95.9%
  • HTML 4.1%