'=========================================================================== ' Subject: MOSAIC ALGORITHM Date: 08-07-00 (11:55) ' Author: Lithumn Code: QB, QBasic, PDS ' Origin: lithprod@earthlink.net Packet: GRAPHICS.ABC '=========================================================================== '----------------------------- 'Title: Mosaic Algorithm 'Programmer: Lithumm (webmaster@qblithumm.cjb.net) 'Website: qblithumm.cjb.net 'Date: 8-6-2000 (8-7-2000 GMT) 'Time: 23:13:52 (07:13:52 GMT) 'Programmed in: QB 4.5 '----------------------------- DECLARE SUB mosaic (size%, x, y, xx, yy) 'example to go along with program SCREEN 13 FOR i = 1 TO 255 CIRCLE (160, 100), i, i CIRCLE (161, 100), i, i NEXT i mosaic 3, 1, 1, 160, 100 mosaic 3, 160, 100, 320, 200 SUB mosaic (size%, x, y, xx, yy) FOR xsize = x TO xx STEP size% 'only gets the part asked for FOR ysize = y TO yy STEP size% p = POINT(xsize, ysize) 'gets the color of the pixel FOR xblock = xsize - 1 TO xsize + size% - 1'starts a loop to fill in FOR yblock = ysize - 1 TO ysize + size% - 1 IF (xsize + size%) - 1 > xx THEN EXIT FOR IF (ysize + size%) - 1 > yy THEN EXIT FOR PSET (xblock, yblock), p NEXT yblock NEXT xblock NEXT ysize NEXT xsize END SUB