03-05-2025, 11:42 PM
something something split screen text to ascii
Code: (Select All)
DefLng A-Z
type ptype
c as string * 1
d as long
img as long
end type
img = _screenimage
sw = _width(img)
sh = _height(img)
'sw = 1280
'sh = 720
ww = sh-80
'ww = (2*sh/3 + 70) - sh/3
Screen _NewImage(sw / 2, ww, 32)
_screenmove sw/2, 0
n = 126-32
dim p(n) as ptype
dim z as _unsigned long
for i=0 to n
p(i).img = _newimage(8, 16, 32)
_dest p(i).img
_source p(i).img
_printstring (0,0), chr$(i + 32)
p(i).c = chr$(i + 32)
sum = 0
for y=0 to 16-1
for x=0 to 8-1
z = point(x, y)
'pset (x, y), z
if point(x,y)=_rgb(255,255,255) then sum = sum + 1
next
next
p(i).d = sum
next
'insertion sort
for i=1 to ubound(p)
j = i
do while (j>0 and p(j-1).d > p(j).d)
swap p(j), p(j-1)
j = j - 1
loop
next
_dest 0
_source 0
Do
img = _ScreenImage(0, 0, sw/2, sh)
w = sw/2
h = sh - 80
_PutImage (0,0), img
_source img
for y=0 to h/16 - 1
for x=0 to w/8 - 1
'0.299r + 0.587g + 0.114b
z = point(x*8 + 4, y*16 + 8)
r = _red(z)
g = _blue(z)
b = _green(z)
c = 0.299*r + 0.587*g + 0.114*b
c = (c/255)*n
'circle (x*8 + 4, y*16 + 8), 3, z
color z, _rgb(0.3*r, 0.3*g, 0.3*b)
'if c > 1*n/3 then
_printstring (x*8, y*16), p(c).c
'end if
next
next
_Display
_Limit 30
Loop until _keyhit = 27