Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -20,31 +20,31 @@ FBSLTILE(FBSLFORM("B/w"), FBSLLOADIMAGE(blackwhite)) ' ditto, black-and-white
RESIZE(FBSLFORM, 0, 0, 136, 162): CENTER(FBSLFORM): SHOW(FBSLFORM)
BEGIN EVENTS ' main message loop
IF CBMSG = WM_CLOSE THEN DESTROY(ME) ' click any [X] button to quit
IF CBMSG = WM_CLOSE THEN DESTROY(ME) ' click any [X] button to quit
END EVENTS
SUB ToGrayScale()
FOR ptr = head TO tail STEP 3
b = PEEK(ptr + 0, 1) ' Windows stores colors in BGR order
g = PEEK(ptr + 1, 1)
r = PEEK(ptr + 2, 1)
l = 0.2126 * r + 0.7152 * g + 0.0722 * b ' derive luminance
POKE(ptr + 0, CHR(l))(ptr + 1, CHR)(ptr + 2, CHR) ' set pixel to shade of gray
m = m + l
NEXT
FILEPUT(FILEOPEN(grayscale, BINARY_NEW), FILEGET): FILECLOSE(FILEOPEN) ' save grayscale image
FOR ptr = head TO tail STEP 3
b = PEEK(ptr + 0, 1) ' Windows stores colors in BGR order
g = PEEK(ptr + 1, 1)
r = PEEK(ptr + 2, 1)
l = 0.2126 * r + 0.7152 * g + 0.0722 * b ' derive luminance
POKE(ptr + 0, CHR(l))(ptr + 1, CHR)(ptr + 2, CHR) ' set pixel to shade of gray
m = m + l
NEXT
FILEPUT(FILEOPEN(grayscale, BINARY_NEW), FILEGET): FILECLOSE(FILEOPEN) ' save grayscale image
END SUB
SUB ToBlackAndWhite()
STATIC b = CHR(0), w = CHR(255) ' initialize once
m = m / (tail - head) * 3 ' derive median
FOR ptr = head TO tail STEP 3
IF PEEK(ptr + 0, 1) < m THEN ' set pixel black
POKE(ptr + 0, b)(ptr + 1, b)(ptr + 2, b)
ELSE ' set pixel white
POKE(ptr + 0, w)(ptr + 1, w)(ptr + 2, w)
END IF
NEXT
FILEPUT(FILEOPEN(blackwhite, BINARY_NEW), FILEGET): FILECLOSE(FILEOPEN) ' save b/w image
STATIC b = CHR(0), w = CHR(255) ' initialize once
m = m / (tail - head) * 3 ' derive median
FOR ptr = head TO tail STEP 3
IF PEEK(ptr + 0, 1) < m THEN ' set pixel black
POKE(ptr + 0, b)(ptr + 1, b)(ptr + 2, b)
ELSE ' set pixel white
POKE(ptr + 0, w)(ptr + 1, w)(ptr + 2, w)
END IF
NEXT
FILEPUT(FILEOPEN(blackwhite, BINARY_NEW), FILEGET): FILECLOSE(FILEOPEN) ' save b/w image
END SUB