...it's the mosaic effect, like the SNES games used it to pixelate (blur?) the screen.
screenwindow.height = 600
CONST pixelbytes
= 4 '4 byte per pixel (RGBA)
mosaicSize = 1
'calculate maximum mosaic tiles
mosaicsVertical
= FIX(screenwindow.height
/ mosaicSize
)mosaicsHorizontal
= FIX(screenwindow.
width / mosaicSize
)
LINE (0, 0)-(screenwindow.
width - 1, screenwindow.height
- 1), _RGB(255, 255, 95), BF
_PRINTSTRING (32, 64), "This program shows the Mosaic Effect." _PRINTSTRING (32, 128), "But it's the old version, like the Super Nintendo Entertainment System used it." _PRINTSTRING (32, 192), "The old version takes just the color of a pixel" _PRINTSTRING (32, 256), "and overwrites the next few pixels on the x and y axis" _PRINTSTRING (32, 320), "with the color values of the first pixel." _PRINTSTRING (32, 384), "There is also a newer, smooth version, but who needs it? :D" _PRINTSTRING (32, 448), "Just press [+] or [-] to change the mosaic size." _PRINTSTRING (32, 512), "Press [Escape] to close the program." _PRINTSTRING (32, 576), "X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X"
FOR pixelVertical
= 1 TO mosaicsVertical
FOR pixelHorizontal
= 1 TO mosaicsHorizontal
y = (pixelVertical - 1) * mosaicSize
x = (pixelHorizontal - 1) * mosaicSize
_MEMGET imageScreenMEMORY
, imageScreenMEMORY .OFFSET
+ (x
* pixelbytes
) + (y
* (screenwindow.
width * pixelbytes
)), pixelcolorRed
_MEMGET imageScreenMEMORY
, imageScreenMEMORY .OFFSET
+ ((x
* pixelbytes
) + 1) + (y
* (screenwindow.
width * pixelbytes
)), pixelcolorGreen
_MEMGET imageScreenMEMORY
, imageScreenMEMORY .OFFSET
+ ((x
* pixelbytes
) + 2) + (y
* (screenwindow.
width * pixelbytes
)), pixelcolorBlue
FOR y2
= 0 TO mosaicSize
- 1 FOR x2
= 0 TO mosaicSize
- 1 _MEMPUT imageScreenMEMORY
, imageScreenMEMORY .OFFSET
+ (x
* pixelbytes
) + (x2
* pixelbytes
) + (y
* (screenwindow.
width * pixelbytes
)) + (y2
* (screenwindow.
width * pixelbytes
)), pixelcolorRed
_MEMPUT imageScreenMEMORY
, imageScreenMEMORY .OFFSET
+ ((x
* pixelbytes
) + 1) + (x2
* pixelbytes
) + (y
* (screenwindow.
width * pixelbytes
)) + (y2
* (screenwindow.
width * pixelbytes
)), pixelcolorGreen
_MEMPUT imageScreenMEMORY
, imageScreenMEMORY .OFFSET
+ ((x
* pixelbytes
) + 2) + (x2
* pixelbytes
) + (y
* (screenwindow.
width * pixelbytes
)) + (y2
* (screenwindow.
width * pixelbytes
)), pixelcolorBlue
mosaicSize = mosaicSize + 1
IF mosaicSize
> 64 THEN mosaicSize
= 64 mosaicsVertical
= FIX(screenwindow.height
/ mosaicSize
) mosaicsHorizontal
= FIX(screenwindow.
width / mosaicSize
) mosaicSize = mosaicSize - 1
IF mosaicSize
< 1 THEN mosaicSize
= 1 mosaicsVertical
= FIX(screenwindow.height
/ mosaicSize
) mosaicsHorizontal
= FIX(screenwindow.
width / mosaicSize
)
close_program:
EDIT:
...and here the slightly slower version, but with POINT/ PRESET instead of _MEMGET/ _MEMPUT
screenwindow.height = 600
mosaicSize = 1
'calculate maximum mosaic tiles
mosaicsVertical
= FIX(screenwindow.height
/ mosaicSize
)mosaicsHorizontal
= FIX(screenwindow.
width / mosaicSize
)
LINE (0, 0)-(screenwindow.
width - 1, screenwindow.height
- 1), _RGB(255, 255, 95), BF
_PRINTSTRING (32, 64), "This program shows the Mosaic Effect." _PRINTSTRING (32, 128), "But it's the old version, like the Super Nintendo Entertainment System used it." _PRINTSTRING (32, 192), "The old version takes just the color of a pixel" _PRINTSTRING (32, 256), "and overwrites the next few pixels on the x and y axis" _PRINTSTRING (32, 320), "with the color values of the first pixel." _PRINTSTRING (32, 384), "There is also a newer, smooth version, but who needs it? :D" _PRINTSTRING (32, 448), "Just press [+] or [-] to change the mosaic size." _PRINTSTRING (32, 512), "Press [Escape] to close the program." _PRINTSTRING (32, 576), "X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X"
FOR pixelVertical
= 1 TO mosaicsVertical
FOR pixelHorizontal
= 1 TO mosaicsHorizontal
y = (pixelVertical - 1) * mosaicSize
x = (pixelHorizontal - 1) * mosaicSize
pixelcolorRed
= _RED32(pixelcolor
) pixelcolorBlue
= _BLUE32(pixelcolor
)
FOR y2
= 0 TO mosaicSize
- 1 FOR x2
= 0 TO mosaicSize
- 1 PRESET (x
+ x2
, y
+ y2
), _RGB(pixelcolorRed
, pixelcolorGreen
, pixelcolorBlue
)
mosaicSize = mosaicSize + 1
IF mosaicSize
> 64 THEN mosaicSize
= 64 mosaicsVertical
= FIX(screenwindow.height
/ mosaicSize
) mosaicsHorizontal
= FIX(screenwindow.
width / mosaicSize
) mosaicSize = mosaicSize - 1
IF mosaicSize
< 1 THEN mosaicSize
= 1 mosaicsVertical
= FIX(screenwindow.height
/ mosaicSize
) mosaicsHorizontal
= FIX(screenwindow.
width / mosaicSize
)
close_program: