$ sudo apt install libcairo2 libcairo2-dev libpango1.0-dev
Usage
Install
Install Cairo and Pango
Ubuntu
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
Using 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.
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"