'=========================================================================== ' Subject: PATTERN GENERATOR V1.0 Date: 06-18-98 (17:14) ' Author: Leandro Pardini Code: QB, QBasic, PDS ' Origin: lpardini@cefex.com Packet: GRAPHICS.ABC '=========================================================================== '========================================================================== ' Pattern generator v1.0 lpardini@cefex.com '========================================================================== ' This is a simple program that captures a screen area of 40x40 pixels and ' rotates it 90 degrees, creating a pretty pattern. This program fills the ' screen with the 80x80 bitmap they created. Then the program saves the ' graphic in BMP format, using the name "PATT0000.BMP" (of course, ' increasing the number). The program continues until you press a key. ' The program uses Windows' standard palette. You can use the BMP files ' they generate as Windows' wallpapers. Better, you can (like me!) create ' 366 miniwallpapers and then use the PC Magazine's CHANGER utility to set ' a different wallpaper every day. Enjoy! '========================================================================== ' | I like mail, so contact me for ' __________ ____---____ | any doubt or suggestion you ' \_________D /-/---_----' LL&P | have for this/another program, ' _H__/_/ Leandro Pardini | for get my last routines, to ' '-_____|( lpardini@cefex.com | chat about computers and/or ' | programming or to say "Hello". '========================================================================== '$STATIC DEFINT A-Z DIM Matriz(1601) AS INTEGER RANDOMIZE TIMER SCREEN 12 'Set the Windows' palette OUT &H3C8, 0: OUT &H3C9, 0: OUT &H3C9, 0: OUT &H3C9, 0 OUT &H3C8, 1: OUT &H3C9, 32: OUT &H3C9, 0: OUT &H3C9, 0 OUT &H3C8, 2: OUT &H3C9, 0: OUT &H3C9, 32: OUT &H3C9, 0 OUT &H3C8, 3: OUT &H3C9, 32: OUT &H3C9, 32: OUT &H3C9, 0 OUT &H3C8, 4: OUT &H3C9, 0: OUT &H3C9, 0: OUT &H3C9, 32 OUT &H3C8, 5: OUT &H3C9, 32: OUT &H3C9, 0: OUT &H3C9, 32 OUT &H3C8, 6: OUT &H3C9, 0: OUT &H3C9, 32: OUT &H3C9, 32 OUT &H3C8, 7: OUT &H3C9, 32: OUT &H3C9, 32: OUT &H3C9, 32 OUT &H3C8, 8: OUT &H3C9, 48: OUT &H3C9, 48: OUT &H3C9, 48 OUT &H3C8, 9: OUT &H3C9, 63: OUT &H3C9, 0: OUT &H3C9, 0 OUT &H3C8, 10: OUT &H3C9, 0: OUT &H3C9, 63: OUT &H3C9, 0 OUT &H3C8, 11: OUT &H3C9, 63: OUT &H3C9, 63: OUT &H3C9, 0 OUT &H3C8, 12: OUT &H3C9, 0: OUT &H3C9, 0: OUT &H3C9, 63 OUT &H3C8, 13: OUT &H3C9, 63: OUT &H3C9, 0: OUT &H3C9, 63 OUT &H3C8, 14: OUT &H3C9, 0: OUT &H3C9, 63: OUT &H3C9, 63 OUT &H3C8, 15: OUT &H3C9, 63: OUT &H3C9, 63: OUT &H3C9, 63 DO 'Put random boxes on screen. FOR a = 10 TO 0 STEP -1 FOR b = 1 TO 50 x = RND * (39 - a) y = RND * (39 - a) c = RND * 16 LINE (x, y)-(x + a, y + a), c, BF NEXT b NEXT a 'Rotate one triangle. c = 0 FOR a = 0 TO 39 FOR b = 39 TO c STEP -1 PSET (a, b), POINT(b, a) NEXT b c = c + 1 NEXT a 'Copy and rotate the two triangles into a 80x80 area. FOR x = 0 TO 39 FOR y = 0 TO 39 PSET (x + 40, y), POINT(39 - x, y) PSET (x, y + 40), POINT(x, 39 - y) PSET (x + 40, y + 40), POINT(39 - x, 39 - y) NEXT y NEXT x 'Capture 80x80 bitmap. GET (0, 0)-(79, 79), Matriz 'These FORs copies the bitmap to the screen. FOR a = 0 TO 639 STEP 80 FOR b = 0 TO 479 STEP 80 PUT (a, b), Matriz, PSET NEXT b NEXT a StartTime& = TIMER File$ = "PATT" IF FileNum% < 1000 THEN File$ = File$ + "0" IF FileNum% < 100 THEN File$ = File$ + "0" IF FileNum% < 10 THEN File$ = File$ + "0" File$ = File$ + LTRIM$(RTRIM$(STR$(FileNum%))) + ".BMP" OPEN File$ FOR OUTPUT AS #1 PRINT #1, "BM"; MKL$(3318); MKL$(0); MKL$(118); MKL$(40); MKL$(80); PRINT #1, MKL$(80); MKL$(262145); MKL$(0); MKL$(3200); MKL$(0); MKL$(0); PRINT #1, MKL$(16); MKL$(16); MKL$(0); MKL$(8388608); MKL$(32768); PRINT #1, MKL$(8421376); MKL$(128); MKL$(8388736); MKL$(32896); PRINT #1, MKL$(8421504); MKL$(12632256); MKL$(16711680); MKL$(65280); PRINT #1, MKL$(16776960); MKL$(255); MKL$(16711935); MKL$(65535); PRINT #1, MKL$(16777215); FOR b = 0 TO 79 FOR a = 0 TO 79 STEP 2 v = (POINT(a, b) * 16) + POINT(a + 1, b) PRINT #1, CHR$(v); NEXT a NEXT b CLOSE #1 FileNum% = FileNum% + 1 IF FileNum% = 10000 THEN EXIT DO WHILE (TIMER - StartTime&) < 5: WEND LOOP WHILE INKEY$ = "" SCREEN 0 SYSTEM