実験的にやってみました。予想していましたが重いです。 VRAM とか使ったら速くなるかしら?
src = 1
dest = 0
buffer src
picload dir_exe + "\\sample\\demo\\jp6girl.bmp"
w = ginfo_sx
h = ginfo_sy
dim matrix, 3, 3
matrix.0.0 = -1, -4, -1
matrix.0.1 = -4, 20, -4
matrix.0.2 = -1, -4, -1
screen dest, w, h
repeat h:y=cnt
if(y&15):else:redraw:redraw 0:await
repeat w:x=cnt
gosub *getcolor
pset x, y
loop
loop
redraw
stop
*getcolor
dim c, 3
repeat 3:yy=cnt
repeat 3:xx=cnt
gsel src
pget x-xx-1, y-yy-1
repeat 3
c.cnt += matrix( xx, yy ) * ginfo(16+cnt)
loop
loop
loop
gsel dest
;repeat 3:c.cnt/=1:loop // スケール
repeat 3:c.cnt=limit(c.cnt,0,255):loop
color c.0, c.1, c.2
return
もらい物の本「図解雑学コンピュータグラフィックス」にこうやってやるんだよって書いてあった。
src = 1
dest = 0
buffer src,,, SCREEN_PALETTE
picload dir_exe + "\\sample\\demo\\jp6girl.bmp"
w = ginfo_sx
h = ginfo_sy
dim matrix, 3, 3
matrix.0.0 = 1, 0, 0
matrix.0.1 = 0, -1, 0
matrix.0.2 = 0, 0, 0
screen dest, w, h
repeat h:y=cnt
if(y&15):else:redraw:redraw 0:await
repeat w:x=cnt
gosub *getcolor
pset x, y
loop
loop
redraw
stop
*getcolor
dim c, 3
repeat 3:yy=cnt
repeat 3:xx=cnt
gsel src
pget x-xx-1, y-yy-1
repeat 3
c.cnt += matrix( xx, yy ) * ginfo(16+cnt)
loop
loop
loop
gsel dest
repeat 3:c.cnt=limit(c.cnt+128,0,255):loop
color c.0, c.1, c.2
return