WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Boxes Examples from Users

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Color Wheel Boxes Display #2

Answer:

The previous colour wheel used only two colours. I modified the previous program to show light shades using three colours.

I cannot think of easy methods to identify the full colour mixing I actually use in my paintings. I just do it by gut feel and my eyes.

I bought variables to the front of the utility so that people do not need to go in the working code to change the colours shown and also tried to make it flexible enough so that the utility colour mapping is easier to change. I could not be bothered to do a more friendly user interface. It can be adjusted to match the output of the previous program which was really just mixing in Grays.

;  Author:  John Coats
;  Object:  Compare an Artists's colour wheel to the computer colours. 
;  Date:    18 march 1999
;
;  Artist's Colour Wheel was printed by "The Colour Wheel Company" in the USA.
;
;  Computer Display must be set to at least 16 bits otherwise colours look lousy. 
;
;  This program shows the mixing of three colours to get pleasent shades.
;
;  Gray is all three colours gradually increasing in darkness from left to right
;
;  White is the extreme shade of Gray -- all three monitor guns maximum
;  Black is the other end of the Spectrum -- all three guns off
;  
;  The PRIME_STEP (0-32)      darkens the colour from left to right
;  The THIRD_STEP (0-32)      mixes a third colour in increasing amounts from left to right
;  The INTENSITY  (128 - 255) controls the darkness  of the colours
;
;  TWO COLOUR DARKENING       PRIME_STEP = 32   THIRD_STEP = 0    INTENSITY = 255
;  LIGHT THREE COLOUR         PRIME_STEP = 0    THIRD_STEP = 32   INTENSITY = 255
;
;  If colours are too dark Black print does not show up so set white print WHITE_TEXT_X (1-9)
;                                                                     

PRIME_STEP   = 0
THIRD_STEP   = 32
INTENSITY    = 255
WHITE_TEXT_X = 9

:MAIN

If PRIME_STEP <  0  Then PRIME_STEP = 0
If PRIME_STEP > 32  Then PRIME_STEP = 32
If THIRD_STEP <  0  Then THIRD_STEP = 0
If THIRD_STEP > 32  Then THIRD_STEP = 32
If INTENSITY  < 128 Then INTENSITY  = 128
If INTENSITY  > 255 Then INTENSITY  = 255

	GoSub Top_Box_init  ; Top box with an Exit button
	Gosub Draw_columns  ; 9 Columns (getting darker) and 26 colour rows

	While @TRUE         ; Wait for exit button to be pressed
	   If BoxButtonStat(TOP_BOX,BUT_EXIT) == @TRUE then break
	EndWhile

:Cancel

EXIT (0)

;
;   The Top box handles the Exit button and the White and Black rectangles.
;   Another 5 Child Boxs are used to handle a 9 x 26 Text (colour) rectangle array 
;   The stack size for a box is limited but will handle 52 text rectangles.
;
:Top_Box_init ; sub
	TOP_BOX = 1
	BoxesUp("100,50,900,900", @ZOOMED) 
	BUT_EXIT = 1
	BoxButtonDraw(TOP_BOX,BUT_EXIT,"EXIT","780,940,990,990")
Return (0) ; EndSub Top_box_init 

:Draw_Columns ; sub
	For x = 5 to 13  ; Nine columns (boxes 2 to 6)
		GoSub Init_column_box
		This_box = Rtn
		Y1 = -38
		for  y = 1 to 26          ; Rows of colours from 1 to 26
			Y1 = Y1 + 38           
			Y2 = Y1 + 38
			GoSub Set_colour       ; Sets C_wheel and Colour_xy 
			BoxColor(This_box,Colour_xy,0)
			If This_box == 2  ; Artist's Colour Names 
				Out = strcat("   ", C_wheel)
				BoxDrawText(This_box ,"0,%Y1%,1000,%Y2%",Out,@TRUE,4)
			Else        ; Varying colour intensities
				S_top    = strlen(Colour_xy)                            ; Format  ### ### ###
				End_r    = StrScan(Colour_xy,",",1,@FWDSCAN)         
				Red_no   = StrSub(Colour_xy,1,End_r-1)                  ; 1st #  (Red)
				Red_no   = StrFixCharsL(Red_no,"0", 3)
				End_g    = StrScan(Colour_xy,",",End_r + 1,@FWDSCAN)    ; 2cnd # (Green)
				Green_no = StrSub(Colour_xy,End_r + 1,End_g - End_r -1)    
				Green_no = StrFixCharsL(Green_no,"0", 3)
				Blue_no  = StrSub(Colour_xy,End_g + 1,S_top)            ; 3rd #  (Blue)
				Blue_no  = StrFixCharsL(Blue_no,"0", 3)
				Out = strcat(Red_no, " ", Green_no," ",Blue_no)

				If y == 26                                                ; Gray 
					If x > 9 Then BoxTextColor(This_box ,"255, 255, 255") ; white text for darker colours
					         Else BoxTextColor(This_box ,"0,0,0")         ; black text for lighter colours
				Else
					X_VAL = WHITE_TEXT_X + 4
					if x > X_VAL Then BoxTextColor(This_box ,"255, 255, 255") ; white text for darker colours
					             Else BoxTextColor(This_box ,"0,0,0")         ; black text for lighter colours
				EndIf
				If x mod 2 == 0  Then  BoxDrawText(This_box,"0,%Y1%,500,%Y2%",Out,@TRUE,5)     ; left column
					              Else  BoxDrawText(This_box,"500,%Y1%,1000,%Y2%",Out,@TRUE,5)  ; right column
			EndIf
		Next ; y = 1 to 26  Rows
	Next  ; x = 5 to 13 Columns

	;  Draw the white and black rectangles at bottom left of top box 1

	BoxTextFont(TOP_BOX,"Times Roman",25,0,16)

	BoxColor(TOP_BOX,"255, 255, 255",0)
	BoxTextColor(TOP_BOX,"0,0,0")
	BoxDrawRect(TOP_BOX,"10,940,230,990",1)
	BoxDrawText(TOP_BOX,"20,950,220,980","White   255 255 255",@TRUE,5)

	BoxColor(TOP_BOX,"0, 0, 0",0)
	BoxTextColor(TOP_BOX,"255,255,255")
	BoxDrawText(TOP_BOX,"340,940,560,990","Black   000 000 000",@TRUE,5)

Return (0) ; EndSub Draw_columns

:Init_Column_box ; Sub
	Low_y = 940   ; Adjustment to stop columns above the exit box
	Rtn = x >> 1  ; Two Columns per box
	select x 
	case  5                                   ; Only One column in Box (Artist's Colour name)
		BoxNew(Rtn,"0,0,120,%Low_y%",0)
		Break
	case  6                                   ; 4 boxs each with two columns
		BoxNew(Rtn,"120,0,340,%Low_y%",0)
		Break
	case  8
		BoxNew(Rtn,"340,0,560,%Low_y%",0)
		Break
	case  10
		BoxNew(Rtn,"560,0,780,%Low_y%",0)
		Break
	case  12
		BoxNew(Rtn,"780,0,1000,%Low_y%",0)
		Break
	Endselect
	BoxTextFont(Rtn,"Times Roman",25,0,16)
Return (Rtn) ; EndSub Init_Column_box

;
;   The artist's colour wheel (C_wheel) has twelve colours using Red, Yellow, Blue as primary colours
;   Three steps between a computer colour change matches the Artists wheel from Red --> yellow.
;   The computer has more steps in the yellow --> blue ---> Red sequence because the monitor colour
;   are Red, Green and Blue.
;
;	 C (PRIME_STAP) controls the intesity of the prime colour
;   M (THIRD_STEP) controls the amount of a third colour mixed in.
;
:Set_colour ; Sub
                                                ; Step adjustment
	If y == 26                                   ; White is first Grey step so we step down one. 
		If x < 7  Then C = 224                    ; Columns 1 (x=5) and 2(x=6) same colour level
		          Else C = 224 - ((x - 6) * 32)
	Else           
		If x < 7  Then C = INTENSITY                    
		          Else C = INTENSITY - ((x - 6) * PRIME_STEP)
	EndIf 
   If x < 7 then M = 0
		      Else M = 0 + (x - 6) * THIRD_STEP   ; Set third colour level 
  
   If C < 0   then C = 0
   If C > 255 then C = 255 
   If M < 0   then M = 0
   If M > 255 then M = 255                    

	C5 = (C + 1) / 2   ; The three steps for a colour change sequence (1/4, 1/2 and 3/4)
	C2 = C5 / 2
	C7 = C2 * 3

	Select Y                            ; Y == Row Number
	Case 1
		Colour_xy  = "%C%,%C%,%M%"         ; Artist's wheel top is yellow (Red/Green) ---> Green
		C_wheel    = "Yellow"
		Break
	Case 2
		Colour_xy  = "%C7%,%C%,%M%"           
		C_wheel    = " "
		Break
	Case 3
		Colour_xy  = "%C5%,%C%,%M%"        
		C_wheel    = "Yellow-Green"
		Break
	Case 4
		Colour_xy  = "%C2%,%C%,%M%"          
		C_wheel    = " "
		Break
	Case 5
		Colour_xy  = "%M%,%C%,%M%"          
		C_wheel    = "Green"             ; Green ---> Blue/Green
		Break
	Case 6
		Colour_xy  = "%M%,%C%,%C2%"          
		C_wheel    = " "             
		Break
	Case 7
		Colour_xy  = "%M%,%C%,%C5%"
		C_wheel    = " "
		Break
	Case 8
		Colour_xy  = "%M%,%C%,%C7%"
		C_wheel    = " "
		Break
	Case 9
		Colour_xy  = "%M%,%C%,%C%"		  ; Blue/Green ---> Green
		C_wheel    = "Blue-Green"
		Break
	Case 10
		Colour_xy  = "%M%,%C7%,%C%"
		C_wheel    = " "
		Break
	Case 11
		Colour_xy  = "%M%,%C5%,%C%"
		C_wheel    = " "
		Break
	Case 12
		Colour_xy  = "%M%,%C2%,%C%"
		C_wheel    = " "
		Break
	Case 13
		Colour_xy  = "%M%,%M%,%C%"          ; Blue ---> Blue/Red
		C_wheel    = "Blue"
		Break
	Case 14
		Colour_xy  = "%C2%,%M%,%C%"           
		C_wheel    = " "
		Break
	Case 15
		Colour_xy  = "%C5%,%M%,%C%"
		C_wheel    = "Blue-Violet"
		Break
	Case 16
		Colour_xy  = "%C7%,%M%,%C%"           
		C_wheel    = " "
		Break
	Case 17
		Colour_xy  = "%C%,%M%,%C%"       ; Blue/Red ---> Red
		C_wheel    = "Violet"
		Break
	Case 18
		Colour_xy  = "%C%,%M%,%C7%"           
		C_wheel    = " "
		Break
	Case 19
		Colour_xy  = "%C%,%M%,%C5%"
		C_wheel    = "Red-Violet" 
		Break
	Case 20
		Colour_xy  = "%C%,%M%,%C2%"           
		C_wheel    = " "
		Break
	Case 21
		Colour_xy  = "%C%,%M%,%M%"         ; Red ---> Red/Green
		C_wheel    = "Red"
		Break
	Case 22
		Colour_xy  = "%C%,%C2%,%M%"
		C_wheel    = "Red-Orange"
		Break
	Case 23
		Colour_xy  = "%C%,%C5%,%M%"
		C_wheel    = "Orange"
		Break
	Case 24
		Colour_xy  = "%C%,%C7%,%M%"
		C_wheel    = "Yellow-Orange"
		Break
	Case 25                            
		Colour_xy  = "%C%,%C%,%M%"      ; Double up on the Artist's wheel top yellow  
		C_wheel    = "Yellow"
		Break
	Case y
		Colour_xy  = "%C%,%C%,%C%"
		C_wheel    = "Gray"
		Break
	EndSelect ; Y == row number
Return (0) ; EndSub Set_colour



Article ID:   W12760
Filename:   Color Wheel Boxes Display 2.txt
File Created: 1999:04:15:16:49:26
Last Updated: 1999:04:15:16:49:26