https://github.com/dylanxyz/nanovg.jl
Julia bindings for the NanoVG drawing library.
https://github.com/dylanxyz/nanovg.jl
graphics julia opengl
Last synced: 5 months ago
JSON representation
Julia bindings for the NanoVG drawing library.
- Host: GitHub
- URL: https://github.com/dylanxyz/nanovg.jl
- Owner: dylanxyz
- License: mit
- Created: 2022-10-19T22:32:38.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-16T21:50:32.000Z (over 3 years ago)
- Last Synced: 2025-07-24T11:42:55.157Z (12 months ago)
- Topics: graphics, julia, opengl
- Language: Julia
- Homepage:
- Size: 1.04 MB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NanoVG
Julia bindings for the [NanoVG](https://github.com/memononen/nanovg) drawing library.
> NanoVG is small antialiased vector graphics rendering library for OpenGL.
> It has lean API modeled after HTML5 canvas API. It is aimed to be a practical and fun toolset for building scalable user interfaces and visualizations.
## Screenshot

## Installation
NanoVG is a
Julia Language
package. To install NanoVG,
open
Julia's interactive session (known as REPL) and press ] key in the REPL to use the package mode, then type the following command:
```shell
pkg> add https://github.com/dylanxyz/NanoVG.jl
```
> Note that NanoVG is not yet at the public registry,
> installation is done directly from this repo.
## Documentation
In progress...
## Basic Example
```julia
using GLFW
using NanoVG
using ModernGL
function main()
title = "NanoVG Basic Example"
width = 800
height = 600
window = GLFW.CreateWindow(width, height, title)
@assert window.handle != C_NULL "Could not create a GLFW window 😢"
GLFW.MakeContextCurrent(window)
# Create the NanoVG context with the GL3 implementation
NanoVG.create(NanoVG.GL3, antialiasing=true)
while true
if GLFW.WindowShouldClose(window) break end
# get the framebuffer size
width, height = GLFW.GetFramebufferSize(window)
# get the window size
winWidth, winHeight = GLFW.GetWindowSize(window)
# dpr = device pixel ratio
dpr = width / winWidth
# set the viewport
glViewport(0, 0, width, height)
# create a new frame
NanoVG.frame(winWidth, winHeight, dpr)
# drawing functions should be called here
# set the fill color
fillcolor(rgb(128, 32, 56))
# draw a filled circle at the center of the screen
circle(width/2, height/2, 128, :fill)
# render the frame to the screen
NanoVG.render()
GLFW.SwapBuffers(window)
GLFW.PollEvents()
end
NanoVG.dispose()
GLFW.DestroyWindow(window)
end
main()
```
## License
This package is licensed under the [MIT](LICENSE) license.
NanoVG is licensed under the [zlib license](https://github.com/memononen/nanovg/blob/master/LICENSE.txt).
Additional licenses for [assets](examples/assets):
- Roboto is licensed under the [Apache License](https://www.apache.org/licenses/LICENSE-2.0)
- Entypo licensed under CC BY-SA 4.0.
- Noto Emoji licensed under [SIL Open Font License, Version 1.1](http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL)