Google
 

Trailing-Edge - PDP-10 Archives - BB-AI48A-BM - datatrieve/demo/palette.cdd-procedure
There are no other files named palette.cdd-procedure in the archive.
SET ABORT
#PRINT "Palette is a useful tool for changing the four colors in an",
!    SKIP,"image that is displayed on an external color monitor",
    SKIP,"attached to a VT125.",SKIP
!
! Variables for getting allocation selection from user
!
DECLARE INT INTEGER EDIT_STRING ZZZ9.
DECLARE HUE INTEGER EDIT_STRING ZZZ9.
DECLARE LIT INTEGER EDIT_STRING ZZZ9.
DECLARE SAT INTEGER DEFAULT VALUE 1  EDIT_STRING ZZZ9.
DECLARE HINC INTEGER. 			! Value to increment HUE
DECLARE SINC INTEGER. 			! Value to increment SAT
 XXXX.
DECLARE COLOR_FLAG PIC X DEFAULT VALUE "N".
DECLARE DISPLAY_FLAG PIC X DEFAULT VALUE "Y".
!
! Variables for Intensity 0
!
DECLARE INT0 PIC X DEFAULT VALUE "N".
DECLARE HUE0 INTEGER DEFAULT VALUE 0 EDIT_STRING ZZZ9 .
DECLARE LIT0 INTEGER DEFAULT VALUE 0 EDIT_STRING ZZZ9 .
DECLARE SAT0 INTEGER DEFAULT VALUE 1 EDIT_STRING ZZZ9 .
!
! Variables for Intensity 1
!
DECLARE INT1 PIC X DEFAULT VALUE "N".
DECLARE HUE1 INTEGER DEFAULT VALUE 0 EDIT_STRING ZZZ9 .
DECLARE LIT1 INTEGER DEFAULT VALUE 45 EDIT_STRING ZZZ9 .
DECLARE SAT1 INTEGER DEFAULT VALUE 1 EDIT_STRING ZZZ9 .
!
! Variables for Intensity 2
!
DECLARE INT2 PIC X DEFAULT VALUE "N".
DECLARE HUE2 INTEGER DEFAULT VALUE 120 EDIT_STRING ZZZ9 .
DECLARE LIT2 INTEGER DEFAULT VALUE 45 EDIT_STRING ZZZ9 .
DECLARE SAT2 INTEGER DEFAULT VALUE 1 EDIT_STRING ZZZ9 .
!
! Variables for Intensity 3
!
DECLARE INT3 PIC X DEFAULT VALUE "N".
DECLARE HUE3 INTEGER DEFAULT VALUE 240 EDIT_STRING ZZZ9 .
DECLARE LIT3 INTEGER DEFAULT VALUE 45 EDIT_STRING ZZZ9 .
DECLARE SAT3 INTEGER DEFAULT VALUE 1 EDIT_STRING ZZZ9 .
!
!
OPTION = "HELP"
!
WHILE OPTION NOT = "E","e"
    BEGIN
'	PRINT "Your options are I,H,L,S,-I,-H,-L,-S,RED,GRE,BLU,YEL,CYA,MAG,BLA,WHI"
	OPTION = *."an option, E to exit, or HELP for help)"
	!
	! Change the intensity value under consideration
	!
	IF OPTION = "I","i","-I","-i" THEN
	    BEGIN
	    IF OPTION CONT "-" THEN IF INT > 0 THEN
	    	INT = INT - 1 ELSE INT = 3 ELSE
	    IF INT < 3 THEN
	    	INT = INT + 1 ELSE INT = 0
			IF INT = 0 THEN
	    	    BEGIN
	    	    INT0 = "Y"
	     	    HUE = HUE0
	    	    LIT = LIT0
	    	    SAT = SAT0
	    	    END
			IF INT = 1 THEN
	    	    BEGIN
	    	    INT1 = "Y"
	    	    HUE = HUE1
	    	    LIT = LIT1
	    	    SAT = SAT1
	    	    END
			IF INT = 2 THEN
	    	    BEGIN
	    	    INT2 = "Y"
	    	    HUE = HUE2
	     	    LIT = LIT2
	    	    SAT = SAT2
	    	    END
			IF INT = 3 THEN
	    	    BEGIN
	    	    INT3 = "Y"
	    	    HUE = HUE3
	    	    LIT = LIT3
	    	    SAT = SAT3
	    	    END
	    END
	!
	! Change the HUE setting for this intensity
	!
	IF OPTION = "H","h","-H","-h" THEN
	    BEGIN
	    IF (SINC = 1 AND LIT NOT = 15) OR
		(SINC = 2 AND LIT NOT = 15 AND SAT LT 50) OR
		(SINC = 3 AND SAT = 1) THEN HINC = 120 ELSE
	    BEGIN
		IF LIT = 0,90 THEN HINC = 0
		IF LIT = 15 THEN HINC = 60
		IF LIT = 30,60 THEN HINC = 40
		IF LIT = 45 THEN IF SAT = 34 THEN HINC = 40 ELSE HINC = 30
		IF LIT = 75 THEN HINC = 120
	    END
	    IF HINC = 0 THEN BEGIN
	    	PRINT "There is no change at this level.", SKIP 2
		DISPLAY_FLAG = "N"
		END ELSE
	    BEGIN
	    IF OPTION CONT "-" THEN
		BEGIN

		    IF HINC = 30 THEN
			IF HUE < 30 THEN HUE = 330 ELSE

			    HUE = HUE - HINC

		    IF HINC = 40 THEN
			IF HUE < 40 THEN HUE = 320 ELSE

			    HUE = HUE - HINC

		    IF HINC = 60 THEN
			IF HUE < 60 THEN HUE = 300 ELSE

			    HUE = HUE - HINC
= 120 THEN
			IF HUE < 120 THEN HUE = 240 ELSE

			    HUE = HUE - HINC
		END ELSE
		BEGIN

		    IF HINC = 30 THEN
			IF HUE GE 330 THEN HUE = 0 ELSE

			    HUE = HUE + HINC

		    IF HINC = 40 THEN
			IF HUE GE 320 THEN HUE = 0 ELSE

			    HUE = HUE + HINC

		    IF HINC = 60 THEN
			IF HUE GE 300 THEN HUE = 0 ELSE

			    HUE = HUE + HINC
= 120 THEN
			IF HUE GE 240 THEN HUE = 0 ELSE

			    HUE = HUE + HINC
		END
		IF INT = 0 THEN HUE0 = HUE
		IF INT = 1 THEN HUE1 = HUE
		IF INT = 2 THEN HUE2 = HUE
		IF INT = 3 THEN HUE3 = HUE
	    END
	    END
	!
	! Change the lightness setting for this intensity
	!
	IF OPTION = "L","l","-L","-l" THEN
	    BEGIN
	    IF OPTION CONT "-" THEN

		IF LIT GE 15 THEN
		    LIT = LIT - 15 ELSE LIT = 90 ELSE

			IF LIT < 90 THEN
			    LIT = LIT + 15 ELSE LIT = 0
		    IF LIT = 0,90 THEN SINC = 0
		    IF LIT = 15,75 THEN SINC = 1
		    IF LIT = 30,60 THEN SINC = 2
		    IF LIT = 45 THEN SINC = 3
	    	IF INT = 0 THEN LIT0 = LIT
	    	IF INT = 1 THEN LIT1 = LIT
	    	IF INT = 2 THEN LIT2 = LIT
	    	IF INT = 3 THEN LIT3 = LIT
	    END
	!
	! Change the saturation setting for this intensity
	!
	IF OPTION = "S","s","-S","-s" THEN
	    BEGIN
	    IF (SINC = 1 OR SINC = 0) THEN
		BEGIN
	    	PRINT "There is no change at this level.", SKIP 2
		DISPLAY_FLAG = "N"
		        END ELSE
		BEGIN
T "-" THEN
		    BEGIN

			IF SINC = 2 THEN
			    IF SAT = 1,34 THEN SAT = 67
			    IF SAT = 67 THEN SAT = 1

			IF SINC = 3 THEN
			    IF SAT = 1 THEN SAT = 67 ELSE SAT = SAT - 33
		    END ELSE
		BEGIN

		    IF SINC = 2 THEN
			IF SAT = 1,34 THEN SAT = 67 ELSE SAT = 1

		    IF SINC = 3 THEN
			IF SAT = 67 THEN SAT = 1 ELSE SAT = SAT + 33
		END
	    	    IF INT = 0 THEN SAT0 = SAT
	    	    IF INT = 1 THEN SAT1 = SAT
	    	    IF INT = 2 THEN SAT2 = SAT
	    	    IF INT = 3 THEN SAT3 = SAT
		END
	    END
	!
	! Change all settings so that this intensity is BLACK
	!
        IF OPTION CONT "BLA" THEN
	    BEGIN
		    OPTION = "C"
	    HUE = 0
	    LIT = 0
	    SAT = 1
	    SINC = 0
	    END
	!
	! Change all settings so that this intensity is RED
	!
	IF OPTION CONT "RED" THEN
	    BEGIN
		    OPTION = "C"
	    HUE = 120
	    LIT = 45
	    SAT = 67
	    SINC = 3
	    END
	!
	! Change all settings so that this intensity is GREEN
	!
	IF OPTION CONT "GRE" THEN
	    BEGIN
		    OPTION = "C"
	    HUE = 240
	    LIT = 45
	    SAT = 67
	    SINC = 3
	    END
	!
	! Change all settings so that this intensity is BLUE
	!
	IF OPTION CONT "BLU" THEN
	    BEGIN
		    OPTION = "C"
	    HUE = 0
	    LIT = 45
	    SAT = 67
	    SINC = 3
	    END
	!
	! Change all settings so that this intensity is YELLOW
	!
	IF OPTION CONT "YEL" THEN
	    BEGIN
		    OPTION = "C"
	    HUE = 180
	    LIT = 60
	    SAT = 67
	    SINC = 2
	    END
	!
	! Change all settings so that this intensity is CYAN
	!
	IF OPTION CONT "CYA" THEN
	    BEGIN
		    OPTION = "C"
	    HUE = 300
	    LIT = 60
	    SAT = 67
	    SINC = 2
	    END
	!
	! Change all settings so that this intensity is MAGENTA
	!
	IF OPTION CONT "MAG" THEN
	    BEGIN
		    OPTION = "C"
	    HUE = 60
	    LIT = 45
	    SAT = 67
	    SINC = 3
	    END
	!
	! Change all settings so that this intensity is WHITE
	!
	IF OPTION CONT "WHI" THEN
	    BEGIN
		    OPTION = "C"
	    HUE = 0
	    LIT = 90
	    SAT = 1
	    SINC = 0
	    END
	!
	! Get HELP
	!
ELP" THEN
	    BEGIN
'    PRINT SKIP 2,"Palette changes the colors currently being displayed",SKIP,
&"on the color monitor attached to your VT125 and optionally writes a",SKIP,
$"Datatrieve command file, which when TAKEn, makes the same color",SKIP,
	"changes.",SKIP,
#"	To use Palette, first display a plot on your color monitor.",SKIP,
$"Then answer Palette's questions until the colors you desire are",SKIP,
"displayed. Then exit using the E command.",SKIP,
""	Although the VT125 color monitor can display a large range",SKIP,
&"of different colors, it can only display 4 colors at once. Palette",SKIP,
&"changes one color (or INTENSITY) at a time. The color is determined",SKIP,
%"by the values for HUE, LIGHTNESS, and SATURATION. Please see the",SKIP,
"VT125 User's Guide for more information.",SKIP,
""	You can change each setting independantly, with the H, L,",SKIP,
%"and S commands, or, or all settings at once with a color command.",SKIP,
$"H, L, and S raise the value and -H, -L, and -S lower the value.",SKIP

	    DISPLAY_FLAG = "N"
	    END
!
! If auto color, then give it to the right intensity.
!
IF OPTION = "C" THEN
    BEGIN

    DISPLAY_FLAG = "Y"
		IF INT = 0 THEN
	    BEGIN
	    INT0 = "Y"
	    HUE0 = HUE
	    LIT0 = LIT
	    SAT0 = SAT
	    END
		IF INT = 1 THEN
	    BEGIN
	    INT1 = "Y"
	    HUE1 = HUE
	    LIT1 = LIT
	    SAT1 = SAT
	    END
		IF INT = 2 THEN
	    BEGIN
	    INT2 = "Y"
	    HUE2 = HUE
	    LIT2 = LIT
	    SAT2 = SAT
	    END
		IF INT = 3 THEN
	    BEGIN
	    INT3 = "Y"
	    HUE3 = HUE
	    LIT3 = LIT
	    SAT3 = SAT
	    END
    END 
!
! Tell him what he just got
!
    PRINT "Intensity:", INT (-), "Hue:", HUE (-),
           "Lightness:", LIT (-), "Saturation:", SAT (-),SKIP 2
!
! Now change the colors on the monitor
!
IF DISPLAY_FLAG = "Y" THEN
    BEGIN
    COLOR_FLAG = "Y"
    PLOT MAP INT, HUE, LIT, SAT
    END


    DISPLAY_FLAG = "Y"
END
!
#! User wants to exit, we should ask him if he wants to save anything
!
"Y" THEN
    BEGIN
    PRINT "Your color selections are as follows:"

    IF INT0 = "Y" THEN
	BEGIN
	PRINT "Intensity 0:"
%	PRINT "   Hue:",HUE0 (-), "Lightness:",LIT0 (-), "Saturation:",SAT0 (-)
	END

    IF INT1 = "Y" THEN
	BEGIN
	PRINT "Intensity 1:"
$	PRINT "   Hue:",HUE1 (-), "Lightness:",LIT1(-), "Saturation:",SAT1 (-)
	END

    IF INT2 = "Y" THEN
	BEGIN
	PRINT "Intensity 2:"
%	PRINT "   Hue:",HUE2 (-), "Lightness:",LIT2 (-), "Saturation:",SAT2 (-)
	END

    IF INT3 = "Y" THEN
	BEGIN
	PRINT "Intensity 3:"
%	PRINT "   Hue:",HUE3 (-), "Lightness:",LIT3 (-), "Saturation:",SAT3 (-)
	END
"    IF *."do you want to save your color allocations" CONT "Y" THEN
your file"
	 BEGIN
#	 IF INT0 CONT "Y" THEN PRINT "PLOT MAP 0,"| HUE0|","| LIT0|","| SAT0
#	 IF INT1 CONT "Y" THEN PRINT "PLOT MAP 1,"| HUE1|","| LIT1|","| SAT1
#	 IF INT2 CONT "Y" THEN PRINT "PLOT MAP 2,"| HUE2|","| LIT2|","| SAT2
#	 IF INT3 CONT "Y" THEN PRINT "PLOT MAP 3,"| HUE3|","| LIT3|","| SAT3
	 END
    END
$PRINT "PALETTE has finished. Remember to type a character to see the",
	SKIP,"Datatrieve prompt."