chitra-crystal v0.7.0
Chitra - 2D graphics library
Crystal language library to generate 2D graphics.
Name
Chitra is a Kannada(Karnataka, India) word which means Drawing.
Install
Install Cairo
Ubuntu
sudo apt install libcairo2 libcairo2-dev libpango1.0-dev
Fedora
sudo yum install cairo-devel pango-devel
Mac
brew install cairo pango
Add this to your application's shard.yml:
dependencies:
chitra:
github: aravindavk/chitra
Example (Global context)
require "chitra"
size 200, 10
(0..100).each do |x|
fill x/100, 0, 0
rect x*2, 0, 2, height
end
save "all_red.png"
Above example produces nice gradient like below.
Example (Without using global context)
require "chitra/context"
ctx = Chitra.new 200, 10
(0..100).each do |x|
ctx.fill x/100, 0, 0
ctx.rect x*2, 0, 2, ctx.height
end
ctx.save "all_red.png"
Documentation
Read the docs here.
Thanks
- Cairo Graphics
- Drawing API syntax are inspired from Drawbot and Processing.
Contributing
- Fork it (https://github.com/aravindavk/chitra/fork)
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- Aravinda Vishwanathapura - Creator and Maintainer
Repository
chitra-crystal
Owner
Statistic
- 10
- 0
- 0
- 0
- 1
- over 1 year ago
- January 22, 2022
License
MIT License
Links
Synced at
Wed, 06 Nov 2024 17:35:33 GMT
Languages