xxxxxxxxxx
48
// by column (avoid mul)
function setup() {
pixelDensity(1);
createCanvas(960, 540)
background(0)
loadPixels()
// text position
const offsetX = 128
const offsetY = 128
let ox = offsetX + offsetY * width
// 2^3 = 8 possibilities
let logo = 82092015 // bit field data
// some constants
const blockWidth = 64
const glyphHeight = 64 * 3
while (logo > 0) {
for (let i = 0; i < blockWidth * glyphHeight; i += 1) {
const x = i & 63
const y = i >> 6
const bi = y >> 6
const br = ((logo >> bi) & 0x1) * 255
const index = (ox + x + y * width) * 4
pixels[index + 0] = br
pixels[index + 1] = br
pixels[index + 2] = br
}
// go to the next column
logo >>= 3
if (!(ox & 255)) {
ox += blockWidth
}
ox += blockWidth
}
updatePixels()
}
function draw() {
}