MCPcopy Create free account
hub / github.com/TomClive/SeeDance2Stitcher / drawBitmapText

Function drawBitmapText

server.js:312–324  ·  view source on GitHub ↗
(rgba, width, x, y, line, scale)

Source from the content-addressed store, hash-verified

310}
311
312function drawBitmapText(rgba, width, x, y, line, scale) {
313 let cursor = x;
314 for (const char of line) {
315 const glyph = glyphFor(char);
316 for (let gy = 0; gy < glyph.length; gy += 1) {
317 for (let gx = 0; gx < glyph[gy].length; gx += 1) {
318 if (glyph[gy][gx] !== "#") continue;
319 fillRect(rgba, width, cursor + gx * scale, y + gy * scale, scale, scale, [255, 255, 255, 255]);
320 }
321 }
322 cursor += (glyph[0].length + 1) * scale;
323 }
324}
325
326async function writeLabelImage(text, targetPath) {
327 const paddingX = 16;

Callers 1

writeLabelImageFunction · 0.85

Calls 2

glyphForFunction · 0.85
fillRectFunction · 0.85

Tested by

no test coverage detected