PICVIEW.BAS

Go back

Below you'll find the source for the QBasic file PICVIEW.BAS.

I've been in doubt if I'd republish this file again. Mainly for a few reasons;
1. The stuff I made as a kid is very childish (which kinda makes sense)
2. Times have changed; what was funny/innovative or sharable in 1997 doesn't meet standards in 2024.
3. Most of the code doesn't run natively anymore on modern operating systems.
4. It's in the Dutch language, where most of my shared content is in English.

Still, I've decided to share this file. Keep in mind the age of this content though.

Download PICVIEW.BAS for QBasic

DECLARE SUB Viewer (Bestand$)
'Om dit in je eigen programma over te nemen moet je het een en het ander
'overnemen. In iedergeval de sub Viewer.
'Maar ook dit stuk:
TYPE PalletType      '──┐
   b AS INTEGER      '  │
   g AS INTEGER      '  │
   r AS INTEGER      '  │
END TYPE             '──┘
'Dan werkt het ook alleen maar op VGA of hoger
'Om naar de sub Viewer te gaan, druk op F2
'Om een stuk over te nemen, selecteer het stuk met Shift ingedrukt en de
'pijltjestoetsen
'Druk dan op Ctrl+Ins
'Om het ergens te plaatsen ga met de cursor naar de goede plaats, en druk op                
'Shift+Ins

FILES "*.pic"
LINE INPUT "Bestand: "; Pic$
a = INSTR(Pic$, ".")
IF a = 0 THEN Pic$ = Pic$ + ".PIC"
Pic$ = UCASE$(Pic$)
CLS
PRINT "PIC-bestand = "; Pic$
PRINT "Enter       = Teruggaan"
PRINT "0           = Negatief/positief"
PRINT "1           = 90° draaien"
PRINT "<TOETS>"
SLEEP
a$ = INKEY$
Viewer Pic$

SUB Viewer (Bestand$)
   DIM Pallet(255) AS PalletType
   Aan = -1: Uit = 0
   Graden = 0
   Negatief = Uit
   SCREEN 13
   PALETTE 255, 63
   COLOR 255
   FOR a = 0 TO 255
      DRAW "c" + STR$(a) + "bm" + STR$(a) + ",200u8"
   NEXT a
   FOR a = 0 TO 254: PALETTE a, 0: NEXT a
   LOCATE 25, 1: PRINT STRING$(40, 219);
   LOCATE 1, 1: PRINT SPACE$(40)
   OPEN Bestand$ FOR INPUT AS #1
      FOR a = 0 TO 320
         FOR b = 0 TO 200
            INPUT #1, c
            PSET (a, b), c
         NEXT b
      NEXT a
      FOR d = 0 TO 255
         INPUT #1, a, b, c
         Pallet(d).b = a
         Pallet(d).g = b
         Pallet(d).r = c
      NEXT d
   CLOSE #1
   DO
      FOR d = 0 TO 255
         a = Pallet(d).b
         b = Pallet(d).g
         c = Pallet(d).r
         e = c: f = b: g = a
         IF Negatief THEN e = 63 - e: f = 63 - f: g = 63 - g
   '     PALETTE a, 65536 * b + 256 * g + r
         PALETTE d, 65536 * e + 256 * f + g
      NEXT d
      Reactie = 0
      DO
         DO: a$ = UCASE$(INKEY$): LOOP WHILE a$ = ""
         IF a$ = "0" THEN
            IF Negatief THEN Negatief = Uit ELSE Negatief = Aan
            Reactie = 1
         END IF
         IF a$ = "1" THEN
            Graden = Graden + 90
            IF Graden = 360 THEN Graden = 0
           
            IF Graden = 270 THEN d = 260: e = -60: f = -1: g = 260: h = 60: i = -1
            IF Graden = 180 THEN d = 320: e = 0: f = -1: g = 200: h = 0: i = -1
            IF Graden = 90 THEN d = -60: e = 260: f = 1: g = 60: h = 260: i = 1
            IF Graden = 0 THEN d = 0: e = 320: f = 1: g = 0: h = 200: i = 1
           
            CLS
            IF Graden = 0 OR Graden = 180 THEN
               OPEN Bestand$ FOR INPUT AS #1
                  FOR a = d TO e STEP f
                     FOR b = g TO h STEP i
                        INPUT #1, c
                        PSET (a, b), c
                     NEXT b
                  NEXT a
               CLOSE #1
            ELSE
               OPEN Bestand$ FOR INPUT AS #1
                  FOR a = d TO e STEP f
                     FOR b = g TO h STEP i
                        INPUT #1, c
                        PSET (b, a), c
                     NEXT b
                  NEXT a
               CLOSE #1
            END IF
         END IF
         IF a$ = CHR$(13) THEN Reactie = 1
      LOOP WHILE Reactie = 0
   LOOP WHILE a$ <> CHR$(13)
   SCREEN 0
   WIDTH 80, 25
END SUB