xxxxxxxxxx
46
// 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
for (let o = ox; o < offsetX + offsetY * width + blockWidth * 11; o += blockWidth) {
for (let y = 0; y < glyphHeight; y += 1) {
const bi = y >> 6
for (let x = 0; x < blockWidth; x += 1) {
const br = ((logo >> bi) & 0x1) * 255
const index = (o + x + y * width) * 4
pixels[index + 0] = br
pixels[index + 1] = br
pixels[index + 2] = br
}
}
// go to the next column
logo >>= 3
if (!(o & 255)) {
o += blockWidth
}
}
updatePixels()
}
function draw() {
}