Class | PNG |
In: |
lib/png/pie.rb
lib/png/reader.rb lib/png.rb |
Parent: | Object |
An almost-pure-ruby Portable Network Graphics (PNG) writer.
www.libpng.org/pub/png/spec/1.2/
PNG supports: + 8 bit truecolor PNGs
PNG does not support: + any other color depth + extra data chunks + filters
require 'png' canvas = PNG::Canvas.new 200, 200 canvas[100, 100] = PNG::Color::Black canvas.line 50, 50, 100, 50, PNG::Color::Blue png = PNG.new canvas png.save 'blah.png'
+ Get everything orinted entirely on [x,y,h,w] with x,y origin being
bottom left.
FULL | = | 360.0 | ||
HALF | = | FULL / 2 | ||
VERSION | = | '1.2.0' | ||
SIGNATURE | = | [137, 80, 78, 71, 13, 10, 26, 10].pack("C*") | ||
GRAY | = | 0 | Color Types: | |
RGB | = | 2 | ||
INDEXED | = | 3 | ||
GRAYA | = | 4 | ||
RGBA | = | 6 | ||
NONE | = | 0 | Filter Types: | |
SUB | = | 1 | ||
UP | = | 2 | ||
AVG | = | 3 | ||
PAETH | = | 4 |
Makes a pie chart you can pass to PNG.new:
png = PNG.new pie_chart(250, 0.30) png.save "pie.png" system 'open pie.png'