https://github.com/Avocadocs/svgg
https://github.com/Avocadocs/svgg
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/Avocadocs/svgg
- Owner: Avocadocs
- Created: 2025-07-02T21:15:53.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2025-07-02T21:29:45.000Z (9 months ago)
- Last Synced: 2025-07-02T22:29:58.308Z (9 months ago)
- Language: C
- Size: 63.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-v - svgg - V module to load and resterize svg file into `gg.Image` object. (Libraries / Graphics)
README
# SVGG — SVG to `gg.Image` for V
**SVGG** is a small utility library for the [V programming language](https://vlang.io) that allows you to load and rasterize SVG files into `gg.Image` objects using the [`gg`](https://modules.vlang.io/gg.html) graphics module.

It uses [memononen/nanosvg](https://github.com/memononen/nanosvg) under the hood for SVG parsing and rasterization.
## Features
- Rasterizes `.svg` files to V `gg.Image`
- Simple API with optional configuration
- Integrates easily with any V `gg.Context`
## Installation
Clone the repository into your V module path or use it directly in your project.
```bash
git clone https://github.com/your-username/svgg.v
```
## Usage Example
```v
import gg
import gx
import svgg
@[heap]
struct App {
mut:
img gg.Image
}
fn main() {
mut app := App{}
mut ctx := gg.new_context(
width: 800
height: 600
window_title: 'SVGG Example'
bg_color: gx.light_blue
init_fn: app.init
frame_fn: app.frame
)
ctx.run()
}
fn (mut a App) init(mut ctx gg.Context) {
a.img = svgg.create_svg_image(mut ctx, './23.svg', svgg.RasterizeCfg{})
}
fn (mut a App) frame(mut ctx gg.Context) {
ctx.begin()
ctx.draw_image(0, 0, a.img.width, a.img.height, a.img)
ctx.end()
}
```
## License
This project is licensed under the MIT License.
It includes code from memononen/nanosvg, which is released under the Zlib license.