‹ newscoolish A Script that Rules the World ›

RedBMP

2010-11-22 03:36 supercollider

clean-up #7:

Today I cleaned up and finished a class belonging to my redSys quark. The class can read and write bitmap images (.bmp files). To get it run the following command in SuperCollider...

Quarks.install("redSys");

It's a fairly slow and useless class but well, it can generate images relatively fast. And saving to disk is also quite quick. But avoid drawing the images to screen. The built-in makeWindow method is very slow as it goes through width*height number of pixels and draws a rectangle for each using Pen.

(
b= RedBMP(640, 480, 32);
b.data= {|i|
  var x= i%b.width;
  Color.red(sin(x/b.width*2pi+sin(x*0.11)), sin(i*0.01+sin(x*0.1)).abs);
}.dup(b.width*b.height);
b.write("~/Desktop/redbmp.bmp");
)

This code outputs the following file (notice the alpha channel)...

1.2 MB Windows v3 BMP, 640x480, 72dpi


‹ newscoolish A Script that Rules the World ›