Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Halftone - A Utility to Demonstrate 255 Colors Mixed in Screen 12
#1
Halftone.bas by Bob Seguin
[Image: Screenshot-585.png]

Code: (Select All)
'****************************************************************************
'
'               HALFTONE.BAS: Bob Seguin - 2003  (freeware)
'
'               A program to examine the possibilities of mixing the
'               16 basic palette colors in SCREEN 12 as halftones to
'               provide more than 16 colors on the screen at one time.
'
'               To use, send the sub program the left/top/right/bottom
'               boundaries of the shape being halftoned along with
'               ColorKEY and ToneCOLOR (the shape is in ColorKEY).
'
'         NOTE: Follow row and column from the halftone to find the
'               attribute numbers involved.
'
'     Comments: (textury, but useful in certain applications,
'               such as fabrics, wood, etc.)
'
'
'****************************************************************************

DEFINT A-Z

_TITLE "Halftone.bas by Bob Seguin"

DIM Box(1 TO 1600)
  
SCREEN 12
PALETTE 4, 63 'set default dark red to brightest red
  
LOCATE 2, 2: PRINT "0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15"
FOR x = 8 TO 384 STEP 24
    GET (x, 16)-(x + 16, 28), Box(n + 1)
    n = n + 100
NEXT x

CLS
FOR y = 0 TO 15
    FOR x = 0 TO 15
        LINE (x * 40, y * 30)-(x * 40 + 37, y * 30 + 27), y, BF
        HalfTONE x * 40, y * 30, x * 40 + 37, y * 30 + 27, y, x
    NEXT x
NEXT y

n = 0: y = 8
FOR x = 15 TO 611 STEP 40
    IF x = 415 THEN x = 411
    PUT (x, y), Box(n + 1)
    n = n + 100
    y = y + 30
NEXT x

DO: LOOP UNTIL INKEY$ <> ""
END

SUB HalfTONE (x1, y1, x2, y2, ColorKEY, ToneCOLOR)

    FOR x = x1 TO x2 STEP 2
        FOR y = y1 TO y2 STEP 2
            IF POINT(x, y) = ColorKEY THEN PSET (x, y), ToneCOLOR
            IF POINT(x + 1, y + 1) = ColorKEY THEN PSET (x + 1, y + 1), ToneCOLOR
        NEXT y
    NEXT x

END SUB


Description: A program to examine the possibilities of mixing the 16 basic palette colors in SCREEN 12 as halftones to provide more than 16 colors on the screen at one time.




Users browsing this thread: 1 Guest(s)