Nice, short ruby script I came across showing basic png usage (albeit with a twisted mutator ;)). [disclaimer] This may not work with ruby-1.9
[sourcecode language="ruby"]
require 'rubygems'
require 'png'
def f(x,y)
((x^y) & ((y-350) >> 3 )) ** 2
end
canvas = PNG::Canvas.new(500.500)
0.upto(499) do |y|
0.upto(499) do |x|
if ((f(x,y) >> 12) & 1) == 1
canvas[x,499-y] = PNG::Color::Black
else
canvas[x,499-y] = PNG::Color::White
end
end
end
png = PNG.new(canvas)
png.save 'ruby.png'
[/sourcecode]
I think this is a powerfull weblog with a lot interesting posts about this stuff. And i just wanna thank you for this. I'll follow your website to see if you post more stuff like these!
ReplyDeleteThanks. Yeah I post stuff like this all the time, feel free to follow [:
ReplyDeleteReblogged this on The Post-Software Movement.
ReplyDeletehello from across the ocean I'm Sarah I'm such a silly girl but I still really appreciated your posts
ReplyDeleteNo prob, thanks for the chillstep mix [:
ReplyDelete