All pastes #288021 Raw Edit

Miscellany

public text v1 · immutable
#288021 ·published 2006-12-21 23:36 UTC
rendered paste body
set display mode 1600,1200,32
sync on

REM load an image
load image "w.jpg", 4

REM create a memblock from the image
make memblock from image 1, 4

width = memblock dword(1, 0)
height = memblock dword(1, 4)
depth = memblock dword(1, 8)


B = memblock byte(1,12)
G = memblock byte(1,13)
R = memblock byte(1,14)
A = memblock byte(1, 15)

for x = 1 to width
   for y = 1 to height
      location = ((y-1)*width + x - 1)*4 + 12
      B = memblock byte(1,location)
      G = memblock byte(1,location+1)
      R = memblock byte(1,location+2)
      A = memblock byte(1, location+3)
   next y
next x


write memblock dword 1, 12, rgb(90,90,90)

make image from memblock 3, 1

repeat


   sprite 1,mousex(), mousey(), 4
   sprite 2,mousex()+width+1, mousey(), 3

   sync
until spacekey()