'=========================================================================== ' Subject: PIXEL LOADER/SAVER Date: 01-19-97 (16:25) ' Author: Nick Kochakian Code: QB, QBasic, PDS ' Origin: NickK@worldnet.att.net Packet: GRAPHICS.ABC '=========================================================================== DECLARE SUB PIXLD (FILENAM$, TRANS$) DECLARE SUB PIXSAV (filnam$, wip$, yms%, xms%, yme%, xme%) 'Pix - Pixle Loader / Saver ' '1997 By: - Nick Kochakian - ' 'This isn't the fasest screen capture. It works best on drawing sprites 'for games. The loading is ALOT faster than the saving is... So you COULD 'save a screen for a game then load it. Do whatever... ' 'If you'd like to use any of these routines do so. But please give me some 'credit where it is needed the most! ' 'Thanks! :) ' 'If you have any questions or comments please E-mail me at: ' 'nickK@worldnet.att.net 'This program will either... '1 - Start at a certain X,Y place and end at a certain X,Y place '2 - Save the entire screen SCREEN 13 RANDOMIZE TIMER 'Put boxes / lines on the screen cntr = 0 DO X = INT(RND * 300) + 1 Y = INT(RND * 200) + 1 x2 = INT(RND * 200) + 1 y2 = INT(RND * 300) + 1 COL = INT(RND * 256) + 1 LINE (X, Y)-(x2, y2), COL, B LINE (X, Y)-(x2, y2), COL cntr = cntr + 1 LOOP UNTIL cntr = 1000 LOCATE 2, 2: PRINT "Pixle saver / loader" LOCATE 3, 2: PRINT "1997 By: - Nick Kochakian -" CALL PIXSAV("PIXLE.PIX", "Y", 0, 0, 30, 300) 'Rip some of the top of the screen 'How to use PIXSAV 'filnam$ - is the file name you want to save your Pixle Picture to 'wip$ - is if you want to have the Pixle Pointer wipe out where its been 'yms% - Starting location of Y. The defualt is 0 'xms% - Starting location of X. The defualt is 0 'yme% - Ending location of Y. The defualt is 200 'xme% - Ending location of Y. The defualt is 300 'Y is up/down placer 'X is left/right placer 'To set any of the things mentioned above to their defualt set their value 'to zero. SLEEP 1 CLS CALL PIXLD("PIXLE.PIX", "N") SLEEP 1 CLS PAINT (0, 0), 1 LOCATE 10, 1: PRINT "PIXLD with TRANS$ set to Y" CALL PIXLD("PIXLE.PIX", "Y") '56 first max '3136 last max '7 per line '8 lines 'How to use PIXLD 'FILENAM$ - is the file to load your Pixle Picture from 'TRANS$ - makes the color zero invisible if TRANS$ is set to "Y" END DATA 0 DATA 1 DATA 2 DATA 3 DATA 4 DATA 5 DATA 6 DATA 7 DATA 8 DATA 9 DATA 10 DATA 11 DATA 12 DATA 13 DATA 14 DATA 15 DATA 16 DATA 17 DATA 18 DATA 19 DATA 20 DATA 21 DATA 22 DATA 23 DATA 24 DATA 25 DATA 26 DATA 27 DATA 28 DATA 29 DATA 30 DATA 31 DATA 32 DATA 33 DATA 34 DATA 35 DATA 36 DATA 37 DATA 38 DATA 39 DATA 40 DATA 41 DATA 42 DATA 43 DATA 44 DATA 45 DATA 46 DATA 47 DATA 48 DATA 49 DATA 50 DATA 51 DATA 52 DATA 53 DATA 54 DATA 55 DATA 56 DATA 57 DATA 58 DATA 59 DATA 60 DATA 61 DATA 62 DATA 63 DATA 64 DATA 65 DATA 66 DATA 67 DATA 68 DATA 69 DATA 70 DATA 71 DATA 72 DATA 73 DATA 74 DATA 75 DATA 76 DATA 77 DATA 78 DATA 79 DATA 80 DATA 81 DATA 82 DATA 83 DATA 84 DATA 85 DATA 86 DATA 87 DATA 88 DATA 89 DATA 90 DATA 91 DATA 92 DATA 93 DATA 94 DATA 95 DATA 96 DATA 97 DATA 98 DATA 99 DATA 100 DATA 101 DATA 102 DATA 103 DATA 104 DATA 105 DATA 106 DATA 107 DATA 108 DATA 109 DATA 110 DATA 111 DATA 112 DATA 113 DATA 114 DATA 115 DATA 116 DATA 117 DATA 118 DATA 119 DATA 120 DATA 121 DATA 122 DATA 123 DATA 124 DATA 125 DATA 126 DATA 127 DATA 128 DATA 129 DATA 130 DATA 131 DATA 132 DATA 133 DATA 134 DATA 135 DATA 136 DATA 137 DATA 138 DATA 139 DATA 140 DATA 141 DATA 142 DATA 143 DATA 144 DATA 145 DATA 146 DATA 147 DATA 148 DATA 149 DATA 150 DATA 151 DATA 152 DATA 153 DATA 154 DATA 155 DATA 156 DATA 157 DATA 158 DATA 159 DATA 160 DATA 161 DATA 162 DATA 163 DATA 164 DATA 165 DATA 166 DATA 167 DATA 168 DATA 169 DATA 170 DATA 171 DATA 172 DATA 173 DATA 174 DATA 175 DATA 176 DATA 177 DATA 178 DATA 179 DATA 180 DATA 181 DATA 182 DATA 183 DATA 184 DATA 185 DATA 186 DATA 187 DATA 188 DATA 189 DATA 190 DATA 191 DATA 192 DATA 193 DATA 194 DATA 195 DATA 196 DATA 197 DATA 198 DATA 199 DATA 200 DATA 201 DATA 202 DATA 203 DATA 204 DATA 205 DATA 206 DATA 207 DATA 208 DATA 209 DATA 210 DATA 211 DATA 212 DATA 213 DATA 214 DATA 215 DATA 216 DATA 217 DATA 218 DATA 219 DATA 220 DATA 221 DATA 222 DATA 223 DATA 224 DATA 225 DATA 226 DATA 227 DATA 228 DATA 229 DATA 230 DATA 231 DATA 232 DATA 233 DATA 234 DATA 235 DATA 236 DATA 237 DATA 238 DATA 239 DATA 240 DATA 241 DATA 242 DATA 243 DATA 244 DATA 245 DATA 246 DATA 247 DATA 248 DATA 249 DATA 250 DATA 251 DATA 252 DATA 253 DATA 254 DATA 255 DATA 256 SUB PIXLD (FILENAM$, TRANS$) DEFINT A-Z 'This loads a saved Pixle file FREEFIL = FREEFILE OPEN FILENAM$ FOR INPUT AS #FREEFIL CNTT = 0 X = 0 Y = 0 DO INPUT #FREEFIL, COL IF COL = 0 AND UCASE$(TRANS$) = "Y" THEN Y = Y + 1 IF COL = -20 THEN Y = 0: X = X + 1 IF COL = -30 THEN CLOSE #FREEFIL: EXIT SUB IF UCASE$(TRANS$) = "Y" AND COL = 0 THEN TRANS$ = "Y" ELSE PSET (X, Y), COL IF UCASE$(TRANS$) = "Y" AND COL = 0 THEN TRANS$ = "Y" ELSE Y = Y + 1 'CNTT = CNTT + 1 LOOP END SUB DEFSNG A-Z SUB PIXSAV (filnam$, wip$, yms%, xms%, yme%, xme%) DEFINT A-Z '$DYNAMIC 'Saves the screen to a file frefil = FREEFILE OPEN filnam$ FOR OUTPUT AS #frefil X = 0 Y = 0 IF yms% <= 0 THEN Y = 0 ELSE Y = yms% IF xms% <= 0 THEN X = 0 ELSE X = xms% IF yme% <= 0 THEN ymax = 200 ELSE ymax = yme% IF xme% <= 0 THEN xmax = 300 ELSE xmax = xme% B$ = "" RESTORE I = 256 DIM A$(I) I = 0 'Read the color data FOR I = 0 TO 256 READ A$(I) NEXT I I = 0 DO 'Get the color of the current point at X,Y and save the color to B$ FOR I = 0 TO 256 IF POINT(X, Y) = I THEN B$ = B$ + A$(I) + "," NEXT I IF UCASE$(wip$) = "Y" THEN PSET (X, Y), 0 IF Y > ymax THEN Y = 0: X = X + 1: PRINT #frefil, B$ + "-20": B$ = "" Y = Y + 1 LOOP UNTIL X > xmax OR INKEY$ = CHR$(32) PRINT #frefil, "-30" CLOSE #frefil END SUB