chitra v0.7.0

Crystal language 2D graphics library #cairo #graphics

Chitra - 2D graphics library

Chitra

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.

All Red

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

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

Repository

chitra

Owner
Statistic
  • 9
  • 0
  • 0
  • 0
  • 1
  • about 1 year ago
  • January 22, 2022
License

MIT License

Links
Synced at

Sat, 27 Apr 2024 09:13:56 GMT

Languages