As part of my first real project, I would like to create a pixelization routine as a transition from one level to the next. By pixelization, I mean I would like the image on the screen to get more and more blocky, then change the image to a blocky version of the image I want to transition
to (same level of blockiness), then reverse the process to gradually sharpen the new image until it's the correct resolution. I don't know how else to accomplish this except using the POINT command to find the color of the current pixel and then change it based on a set of rules, but the end routine is very slow. Any ideas how to modify my algorithm?
Rem Project: Dark Basic Pro Project
Rem Created: Tuesday, May 04, 2010
Rem ***** Main Source File *****
load bitmap "media\gog1.jpg",1
copy bitmap 1,0
wait 1
pixelate(1,10)
copy bitmap 1,0
wait key
end
function pixelate(image2pixel,degree)
bmpx = bitmap width(image2pixel)
bmpy = bitmap height(image2pixel)
pxlcolor as dword = 0
tmpcolor as dword = 0
for h=0 to bmpy
for w=0 to bmpx
if w MOD degree = 0 and h MOD degree = 0
pxlcolor = point (w,h)
endif
if w MOD degree <> 0 and h MOD degree = 0
pxlcolor = pxlcolor
endif
if w MOD degree = 0 and h MOD degree <> 0
pxlcolor = point (w,h-1)
endif
dot w,h,pxlcolor
next w
next h
endfunction