home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
601-625
/
apd616
/
source
/
palette_proc_addon.amos
/
palette_proc_addon.amosSourceCode
Wrap
AMOS Source Code
|
1994-05-23
|
8KB
|
346 lines
'
' *** Palette Requester Procedure.
'
Procedure _PALETTEREQUESTER[S]
'
' S - This is the screen number to change the palette on.
'
' *** Backup Dialog String.
'
B_DLG$=_DIALOGBUTTON$
_DIALOGBUTTON$=""
'
SY=70
'
_OPENDIALOGSCREEN[7,80,SY]
'
Screen S
SC=Screen Colour
If SC>64
SC=16
FF=16
Else
FF=SC
End If
C=1
'
Screen Open 6,320,20,SC,Lowres
Screen Display 6,,SY+81,,
Curs Off
Flash Off
Cls 0
'
Get Palette S
'
STP=320/SC
LOP=0
While LOP<SC+1
Ink LOP
Bar LOP*STP,2 To LOP*STP+STP,20
Inc LOP
Wend
Gosub _LINE
'
Screen 7
'
_DRAW3DBOX[0,0,639,79,"",0,0,3]
_DRAW3DBOX[46,0,639,12,"Palette Requester V1.0",1,_TEXT,_COLOUR]
'
_ADDBUTTON[0,0,44,12,"OK",11]
'
_DRAW3DBOX[10,16,38,34,"R",1,_TEXT,_BACK]
_DRAW3DBOX[10,36,38,54,"G",1,_TEXT,_BACK]
_DRAW3DBOX[10,56,38,74,"B",1,_TEXT,_BACK]
'
_HORIZONTALSLIDER[42,16,460,34,16,1,""]
_HORIZONTALSLIDER[42,36,460,54,16,1,""]
_HORIZONTALSLIDER[42,56,460,74,16,1,""]
'
_ADDBUTTON[462,19,476,31,"(S)LAR",1]
_ADDBUTTON[462,39,476,51,"(S)LAR",2]
_ADDBUTTON[462,59,476,71,"(S)LAR",3]
_ADDBUTTON[478,19,492,31,"(S)RAR",4]
_ADDBUTTON[478,39,492,51,"(S)RAR",5]
_ADDBUTTON[478,59,492,71,"(S)RAR",6]
'
_DRAW3DBOX[495,16,521,34,"",0,_TEXT,_COLOUR]
_DRAW3DBOX[495,36,521,54,"",0,_TEXT,_COLOUR]
_DRAW3DBOX[495,56,521,74,"",0,_TEXT,_COLOUR]
_DRAW3DBOX[497,17,519,33,"",1,_TEXT,_BACK]
_DRAW3DBOX[497,37,519,53,"",1,_TEXT,_BACK]
_DRAW3DBOX[497,57,519,73,"",1,_TEXT,_BACK]
'
_ADDBUTTON[525,16,629,30,"Spread",7]
_ADDBUTTON[525,31,629,45,"Swap",8]
_ADDBUTTON[525,46,629,60,"Copy",9]
_ADDBUTTON[525,61,629,75,"Reset",10]
'
Gosub _GET
Gosub _LINE
Gosub _R_SLIDER
Gosub _G_SLIDER
Gosub _B_SLIDER
'
Do
'
_CHECKBUTTONS
ZN=Param
'
_CHECKZONE[46,0,639,12,0]
If Param
YY=Y Screen(Y Mouse)
While Mouse Key
If Y Mouse>42 and Y Mouse<200
SY=Y Mouse
Screen Display 7,,SY-YY,,
Screen Display 6,,SY-YY+81,,
End If
Wend
End If
'
If ZN=11
Goto FIN
End If
'
If ZN=1 and R>0
Dec R
Gosub _R_SLIDER
Gosub _CHANGE
End If
'
If ZN=4 and R<15
Inc R
Gosub _R_SLIDER
Gosub _CHANGE
End If
'
If ZN=2 and G>0
Dec G
Gosub _G_SLIDER
Gosub _CHANGE
End If
'
If ZN=5 and G<15
Inc G
Gosub _G_SLIDER
Gosub _CHANGE
End If
'
If ZN=3 and B>0
Dec B
Gosub _B_SLIDER
Gosub _CHANGE
End If
'
If ZN=6 and B<15
Inc B
Gosub _B_SLIDER
Gosub _CHANGE
End If
'
If ZN=7
'
_DRAW3DBOX[26,0,639,12,"Select Colour To Spread To (ESC Exits)",2,_LIGHT,_COLOUR]
'
CC=C
Screen 6
'
Repeat
If Mouse Key
CC=Point(X Screen(6,X Mouse),Y Screen(6,Y Mouse))
End If
Until Inkey$=Chr$(27) or(CC<>C and CC<FF)
'
If CC<>C
TC=C
E=CC
If TC>E
Swap TC,E
End If
Screen 6
For A=TC+1 To E-1
CDIF=E-A+1
RDIF=((Colour(E) and 3840)/256)-((Colour(A-1) and 3840)/256)
RA=((Colour(A-1) and 3840)/256)+(RDIF/CDIF)
GDIF=((Colour(E) and 240)/16)-((Colour(A-1) and 240)/16)
GA=((Colour(A-1) and 240)/16)+(GDIF/CDIF)
BDIF=(Colour(E) and 15)-(Colour(A-1) and 15)
BA=(Colour(A-1) and 15)+(BDIF/CDIF)
Colour A,(RA*256+GA*16+BA)
Next A
End If
'
Screen 7
_DRAW3DBOX[26,0,639,12,"Palette Requester V1.0",2,_TEXT,_COLOUR]
'
Gosub _GET
Gosub _R_SLIDER
Gosub _G_SLIDER
Gosub _B_SLIDER
'
End If
'
If ZN=8
_DRAW3DBOX[26,0,639,12,"Select Colour To Swap With (ESC Exits)",2,_LIGHT,_COLOUR]
'
CC=C
Screen 6
'
Repeat
If Mouse Key
CC=Point(X Screen(6,X Mouse),Y Screen(6,Y Mouse))
End If
Until Inkey$=Chr$(27) or(CC<>C and CC<FF)
'
TMP=Colour(C)
Colour C,Colour(CC)
Colour CC,TMP
Screen 7
'
_DRAW3DBOX[26,0,639,12,"Palette Requester V1.0",2,_TEXT,_COLOUR]
'
Gosub _GET
Gosub _R_SLIDER
Gosub _G_SLIDER
Gosub _B_SLIDER
'
End If
'
If ZN=9
'
_DRAW3DBOX[26,0,639,12,"Select Colour To Copy To (ESC Exits)",2,_LIGHT,_COLOUR]
'
CC=C
Screen 6
'
Repeat
If Mouse Key
CC=Point(X Screen(6,X Mouse),Y Screen(6,Y Mouse))
End If
Until Inkey$=Chr$(27) or(CC<>C and CC<FF)
'
Colour C,Colour(CC)
'
Screen 7
_DRAW3DBOX[26,0,639,12,"Palette Requester V1.0",2,_TEXT,_COLOUR]
'
Gosub _GET
Gosub _R_SLIDER
Gosub _G_SLIDER
Gosub _B_SLIDER
'
End If
'
If ZN=10
Screen 6
Get Palette S
Screen 7
Gosub _GET
Gosub _R_SLIDER
Gosub _G_SLIDER
Gosub _B_SLIDER
End If
'
If Scin(X Mouse,Y Mouse)=6
Gosub _PICK
End If
'
_CHECKZONE[42+(R*26),16,42+(R*26)+24,34,0]
If Param
While Mouse Key and X Screen(X Mouse)>46 and X Screen(X Mouse)<454
R=(X Screen(X Mouse)-42)/26
Gosub _R_SLIDER
Gosub _CHANGE
Wend
End If
'
_CHECKZONE[42+(G*26),36,42+(G*26)+24,54,0]
If Param
While Mouse Key and X Screen(X Mouse)>46 and X Screen(X Mouse)<454
G=(X Screen(X Mouse)-42)/26
Gosub _G_SLIDER
Gosub _CHANGE
Wend
End If
'
_CHECKZONE[42+(B*26),56,42+(B*26)+24,74,0]
If Param
While Mouse Key and X Screen(X Mouse)>46 and X Screen(X Mouse)<454
B=(X Screen(X Mouse)-42)/26
Gosub _B_SLIDER
Gosub _CHANGE
Wend
End If
'
Loop
'
FIN:
Screen S
Get Palette 6
Screen Close 7
Screen Close 6
'
_DIALOGBUTTON$=B_DLG$
B_DLG$=""
'
Pop Proc
'
_PICK:
While Scin(X Mouse,Y Mouse)=6
'
Screen 6
'
If Mouse Key
C=Point(X Screen(6,X Mouse),Y Screen(6,Y Mouse))
Gosub _GET
Gosub _LINE
Gosub _R_SLIDER
Gosub _G_SLIDER
Gosub _B_SLIDER
End If
'
Wend
'
Screen 7
Return
'
_LINE:
Screen 6
Ink 0
Draw 0,0 To 319,0
Ink 1
Draw C*STP,0 To C*STP+STP,0
Screen 7
Return
'
_GET:
R=Colour(C)/256
G=Colour(C)/16 mod 16
B=Colour(C) mod 16
Return
'
_R_SLIDER:
_HORIZONTALSLIDER[42,16,460,34,16,R+1,""]
_DRAW3DBOX[497,17,519,33,Str$(R)-" ",2,_TEXT,_BACK]
Return
'
_G_SLIDER:
_HORIZONTALSLIDER[42,36,460,54,16,G+1,""]
_DRAW3DBOX[496,37,519,53,Str$(G)-" ",2,_TEXT,_BACK]
Return
'
_B_SLIDER:
_HORIZONTALSLIDER[42,56,460,74,16,B+1,""]
_DRAW3DBOX[497,57,519,73,Str$(B)-" ",2,_TEXT,_BACK]
Return
'
_CHANGE:
R$=Hex$(R)
G$=Mid$(Hex$(G),2,1)
B$=Mid$(Hex$(B),2,1)
Screen 6
Colour C,Val(R$+G$+B$)
Screen 7
Return
'
End Proc