Posted: 6th Jan 2003 12:39
with memblocks , you will now be able to make mosaics effects just like Super Mario world does.

You should change the load image with 1 image you choose.

use is quite simple.
Just use 1 function :
Flx_Mosaic(_source,_cible,_facteur)
_source = source bitmap that contain the original image
_target = target bitmap that'll contain the mosaic
_factor = mosaic factor ( >0 and 1 and _key0
make memblock from bitmap _memblock,_bitmapsource
xsize=memblock dword(_memblock,0) : ysize=memblock dword(_memblock,4)
depth=memblock dword(_memblock,8) : _length=get memblock size(_memblock)
if depth=16
for ypos=0 to ysize-_factor step _factor
for xpos=0 to xsize-_factor step _factor
_read=12+(xpos*2+(ypos*xsize*2))
_pixel=memblock word(_memblock,_read)
if _factor=2
write memblock word _memblock,_read+2,_pixel
write memblock word _memblock,_read+(xsize*2),_pixel
write memblock word _memblock,_read+(xsize*2)+2,_pixel
endif
if _factor>2
for ysb=0 to _factor-1
for xsb=0 to _factor-1
_write=_read+(xsb*2)+(ysb*xsize*2)
write memblock word _memblock,_write,_pixel
next xsb
next ysb
endif
next xpos
next ypos
endif
make bitmap from memblock _bitmaptarget,_memblock
delete memblock _memblock
endif
endfunction
Posted: 10th Jan 2003 1:14
I h
Posted: 10th Jan 2003 1:15
sorry.
I have problems posting source code !
there are always parts that disappear on the post !
not good !

here is the full source code corrected :
+ Code Snippet
Rem Gestion d'effets de mosaiques à la SuperNes
Rem How to make SuperNes's Mosaics effects
Rem
set display mode 640,480,16
sync rate 0 ; sync on
Rem
Rem chargement d'une image d'exemple
Rem Load a picture to make effect work.
load bitmap "gfx\exemple.jpg",1
FLX_Mosaic(1,2,1)
Rem
sync
Repeat
  _key=scancode()
  Rem On crée l'effet de mosaique ici.
  Rem We apply the mosaic effect here.
  if _key>1 and _key<14
    FLX_Mosaic(1,2,_key-1) : _mos=_key-1
   endif
  if bitmap exist(2)=1 then copy bitmap 2,0,0,639,479,0,0,0,639,479
  set current bitmap 0
  set cursor 0,0
  print "Mosaics effects Ver1.0"
  print "Made by : Freddix ( freddbprojects@wanadoo.fr )"
  print " "
  Print "Press keys from 1-0 to make mosaics"
  print "Press space bar to quit demo"
  print " "
  print "Mosaic value : ";_mos
  sync
 until spacekey()=1
End

Rem Fonction de mosaiques Ver 1.0
Rem Mosaics function Ver 1.0
Function FLX_Mosaic(_bitmapsource,_bitmaptarget,_factor)
  Rem On cherche un memblock de libre
  Rem We look for a free memblock to use.
  _memblock=256
  repeat
    dec _memblock,1
   until memblock exist(_memblock)=0 or _memblock=0
  Rem Si le bitmap source existe et 1 memblock est dispo alors . . .
  Rem if source bitmap exist and 1 free memblock is found . . .
  if bitmap exist(_bitmapsource)=1 and _memblock>0
    make memblock from bitmap _memblock,_bitmapsource
    xsize=memblock dword(_memblock,0) : ysize=memblock dword(_memblock,4)
    depth=memblock dword(_memblock,8) : _length=get memblock size(_memblock)
    if depth=16
      for ypos=0 to ysize-_factor step _factor
        for xpos=0 to xsize-_factor step _factor
          _read=12+(xpos*2+(ypos*xsize*2))
          _pixel=memblock word(_memblock,_read)
          if _factor=2
            write memblock word _memblock,_read+2,_pixel
            write memblock word _memblock,_read+(xsize*2),_pixel
            write memblock word _memblock,_read+(xsize*2)+2,_pixel
           endif
          if _factor>2
            for ysb=0 to _factor-1
              for xsb=0 to _factor-1
                _write=_read+(xsb*2)+(ysb*xsize*2)
                write memblock word _memblock,_write,_pixel
               next xsb
             next ysb
           endif

         next xpos
       next ypos
     endif
    make bitmap from memblock _bitmaptarget,_memblock
    delete memblock _memblock
   endif
 endfunction