Checkerboard - RealWorld forums

Log-in or register.

Checkerboard

PAEz
on October 19th 2013

Checkerboard
Renders a checkerboard.

Source
https://github.com/amsqr/Chromanin.js

Code
Configuration

Configuration.AddColorButton("_c1", "Colour1", "", 0xff8040);
Configuration.AddColorButton("_c2", "Colour2", "", 0x0000ff);
Configuration.AddSlider("_a", "Alpha", "", 0, 255, 255);
Configuration.AddEditBox("_dx", "dx", "", 16);
Configuration.AddEditBox("_dy", "dy", "", 16);

Execution

var dx=Configuration._dx;
var dy=Configuration._dy;
var c1=Configuration._c1;
var c2=Configuration._c2;
var alpha=Configuration._a << 24;

var image = Document.RasterImage;
var w = image.sizeX;
var h = image.sizeY;

var c;

for (x=0; x<w; x++){
for (y=0; y<h; y++){

if(((y / dy) & 1) ^ ((x / dx) & 1))c=c1;
else c=c2;

image.SetPixel(x, y, 0, 0, alpha | c);

}
}
Page views: 923       Posts: 1      
What about ICL files?
Select background
I wish there were...