home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
aminet
/
jdlib4_6.lha
/
Procs
/
_Colour_Requester.AMOS
/
_Colour_Requester.amosSourceCode
Wrap
AMOS Source Code
|
2008-12-10
|
11KB
|
452 lines
Dim ZYCLUS(2)
STDSCREEN
CHANGERGB
Procedure STDSCREEN
Default
Close Editor
Close Workbench
Screen Open 0,680,257,4,Hires
Screen Offset 0,0,0
Limit Mouse 112,42 To 447,298
Curs Off : Flash Off
Colour 0,0 : Colour 1,$90 : Colour 2,$8F8 : Colour 3,$E0 : Rem Gruen
' Colour 0,0 : Colour 1,$555 : Colour 2,$EEE : Colour 3,$AAA : Rem Grau
RES_SCREEN[0]
End Proc
Procedure RES_SCREEN[X]
Gr Writing 1 : Ink 2,1 : Pen 2 : Paper 1
If X=0 Then Cls
End Proc
Procedure CHANGERGB
Every Off
Shared ZYCLUS()
Dim RGB(31)
FINDRES : NRES=Param+1 : RES=NRES
For A=0 To 31 : RGB(A)=Colour(A) : Next
AGAIN:
Flash Off : Curs Off
FC=2 : BC=0
Cls : Show
Reserve Zone 58
Ink 0,0
Bar 13,8 To 317,179
Ink FC,BC
Bar 8,3 To 312,174
Ink BC,FC
Box 9,4 To 311,173
Ink BC,FC
Text 19,114,"R" : Text 39,114,"G" : Text 60,114,"B"
A=0 : Repeat
Bar 15+A*20,6 To 30+A*20,104
Set Zone A+1,15+A*20,6 To 30+A*20,104
Inc A
Until A=3
A=0 : Repeat
Draw 10,6+A*6 To 75,6+A*6
Inc A
Until A=17
A=0 : Repeat
Ink A,A : X=A mod 8 : Y=A/8
Bar X*16+80,Y*16+8 To X*16+95,Y*16+23
Set Zone A+4,X*16+80,Y*16+8 To X*16+95,Y*16+23
Inc A : Until A>Min(31,Screen Colour-1)
Ink BC,FC
Box 79,7 To 96+16*X,24+16*Y
Box 80,90 To 140,100 : Text 86,98,"Cancel" : Set Zone 36,80,90 To 140,100
Box 152,90 To 202,100 : Text 165,98,"Use" : Set Zone 37,152,90 To 202,100
Box 80,105 To 202,115 : Text 121,113,"Reset" : Set Zone 38,80,105 To 202,115
Box 152,75 To 202,85 : Text 162,83,"Save" : Set Zone 39,152,75 To 202,85
Box 80,75 To 140,85 : Text 95,83,"Load" : Set Zone 40,80,75 To 140,85
Box 15,120 To 42,130 : Text 17,128,"B/W" : Set Zone 41,15,120 To 42,130
Box 47,120 To 74,130 : Text 49,128," A " : Set Zone 42,47,120 To 74,130
Box 15,135 To 68,145 : Text 25,143,"COPY" : Set Zone 43,15,135 To 68,145
Box 73,135 To 140,145 : Text 75,143,"EXCHANGE" : Set Zone 44,73,135 To 140,145
Box 145,135 To 202,145 : Text 150,143,"SPREAD" : Set Zone 45,145,135 To 202,145
Box 15,150 To 48,160 : Text 21,158,"NEG" : Set Zone 53,15,150 To 48,160
Box 51,150 To 84,160 : Text 52,158,"COMP" : Set Zone 54,51,150 To 84,160
Box 87,150 To 120,160 : Text 93,158,"RED" : Set Zone 55,87,150 To 120,160
Box 123,150 To 166,160 : Text 125,158,"GREEN" : Set Zone 56,123,150 To 166,160
Box 169,150 To 202,160 : Text 170,158,"BLUE" : Set Zone 57,169,150 To 202,160
Box 213,145 To 301,155 : Text 238,153,"RANGE" : Set Zone 58,213,145 To 301,155
Box 213,20 To 301,137 : Text 218,30,"CHANGE RES"
Box 215,35 To 299,45 : Text 222,43,"LOWRES 4" : Set Zone 46,215,35 To 299,45
Box 215,50 To 299,60 : Text 222,58,"LOWRES 8" : Set Zone 47,215,50 To 299,60
Box 215,65 To 299,75 : Text 222,73,"LOWRES 16" : Set Zone 48,215,65 To 299,75
Box 215,80 To 299,90 : Text 222,88,"LOWRES 32" : Set Zone 49,215,80 To 299,90
Box 215,95 To 299,105 : Text 222,103,"HIRES 4" : Set Zone 50,215,95 To 299,105
Box 215,110 To 299,120 : Text 222,118,"HIRES 8" : Set Zone 51,215,110 To 299,120
Box 215,125 To 299,135 : Text 222,133,"HIRES 16" : Set Zone 52,215,125 To 299,135
Ink SELCOL
Bar 195,120 To 201,129
Ink BC : Box 194,119 To 202,130
SFADERS[SELCOL]
AGAIN2:
OK=0 : While OK=0
While Mouse Key=0 : Wend : YM=Y Screen(Y Mouse) : Z=Mouse Zone
If Z>0 and Z<4
CFADERS[SELCOL,Z-1,YM]
SFADERS[SELCOL]
End If
If Z>3 and Z<36
SELCOL=Z-4
Ink SELCOL
Bar 195,120 To 201,129
SFADERS[SELCOL]
Ink SELCOL
End If
If Z=37
OK=1
End If
If Z<>39 Then Goto T40
FINDRES : NRES=Param+1
DD$=Fsel$("","","Farben speichern")
If DD$="" Then Goto T40
Open Out 1,DD$
Print #1,NRES
For X=0 To 31
Print #1,Colour(X)
Next
For X=0 To 2
Print #1,ZYCLUS(X)
Next
Close
T40:
If Z<>40 Then Goto E40
FINDRES : NRES=Param+1
DD$=Fsel$("","","Farben laden")
If DD$="" Then Goto E40
Open In 1,DD$
Input #1,NNRES
Close 1
If NRES<>NNRES Then CHANGERES[NNRES-1]
Open In 1,DD$
Input #1,NRES
For X=0 To 31
Input #1,FW
Colour X,FW
Next
For X=0 To 2
Input #1,ZYCLUS(X)
Next
Close 1
Goto AGAIN
E40:
If Z>52 Then Goto SPEC
If Z>45 Then Goto CRES
SPEC:
If Z=53 Then NEGATIV
If Z=54 Then COMPLEMENT
If Z=55 Then RED
If Z=56 Then GREEN
If Z=57 Then BLUE
If Z=58 Then RANGE
If Z=36 Then Gosub RESET : OK=1
If Z=38 Then Gosub RESET : Goto AGAIN
If Z=41 Then BW
If Z=42 Then ANTIK
If Z=43 Then Change Mouse 2 : COPCOL : Change Mouse 1
If Z=44 Then Change Mouse 2 : EXCOL : Change Mouse 1
If Z=45 Then Change Mouse 2 : SPREAD : Change Mouse 1
While Mouse Key=1 : Wend
SFADERS[SELCOL]
Wend
Cls : Flash Off : Curs Off
Pop Proc
RESET:
FINDRES : If Param<>RES-1 Then CHANGERES[RES-1]
For A=0 To Screen Colour-1
Colour A,RGB(A) : SPCOL[A,RGB(A)]
Next
Return
CRES:
NRES=Z-46
FINDRES : If Param=NRES Then Goto AGAIN2
CRES2:
CHANGERES[NRES]
FINDRES : NRES=Param
Goto AGAIN
End Proc
Procedure CFADERS[S,F,YM]
Dim R(2)
C=Colour(S)
R(0)=C/256
R(1)=(C/16) mod 16
R(2)=C mod 16
V=Max(0,Min(15,15-(YM-7)/6))
R(F)=V
Colour S,(R(0)*256+R(1)*16+R(2))
SPCOL[S,Colour(S)]
End Proc
Procedure SFADERS[S]
Shared RGBO
FC=2 : BC=0
Dim R(2)
C=RGBO
R(0)=C/256
R(1)=(C/16) mod 16
R(2)=C mod 16
Ink BC,BC
A=0 : Repeat
V=(15-R(A))*6 : Bar 17+20*A,7+V To 28+20*A,12+V
Inc A
Until A=3
C=Colour(S)
RGBO=C
R(0)=C/256
R(1)=(C/16) mod 16
R(2)=C mod 16
Ink BC,BC
Bar 80,121 To 191,128
Ink FC,BC
Text 80,128,"Col"+Right$(" "+Str$(S),2)+" Val:$"+Right$("000"+Mid$(Hex$(RGBO),2),3)
Ink BC,FC
A=0 : Repeat
Ink FC,FC
V=(15-R(A))*6 : Box 17+20*A,7+V To 28+20*A,12+V
Ink S
Bar 18+20*A,8+V To 27+20*A,11+V
Inc A
Until A=3
End Proc
Procedure SPCOL[A,B]
If Length(1)>0
Doke Start(1)+2+8*Length(1)+2*A,B
End If
End Proc
Procedure BW
For X=0 To Screen Colour-1
RGBA=Colour(X)
C1=RGBA/256
C2=(RGBA/16) mod 16
C3=RGBA mod 16
C=C1+C2+C3
C1=C/3
C2=C/3
C3=C/3
C=(C1*256)+(C1*16)+C3
Colour X,C
SPCOL[X,C]
Next
End Proc
Procedure ANTIK
For X=0 To Screen Colour-1
RGBA=Colour(X)
C1=RGBA/256
C2=(RGBA/16) mod 16
C3=RGBA mod 16
C=C1+C2+C3
C1=C/3
C2=C/4
C3=C/5
C=(C1*256)+(C1*16)+C3
Colour X,C
SPCOL[X,C]
Next
End Proc
Procedure RED
For X=0 To Screen Colour-1
RGB$=Hex$(Colour(X),3)
Mid$(RGB$,3,2)="00"
Colour X,Val(RGB$)
Next
End Proc
Procedure GREEN
For X=0 To Screen Colour-1
RGB$=Hex$(Colour(X),3)
Mid$(RGB$,2,1)="0"
Mid$(RGB$,4,1)="0"
Colour X,Val(RGB$)
Next
End Proc
Procedure BLUE
For X=0 To Screen Colour-1
RGB$=Hex$(Colour(X),3)
Mid$(RGB$,2,2)="00"
Colour X,Val(RGB$)
Next
End Proc
Procedure NEGATIV
For X=0 To Screen Colour-1
RGB=Colour(X)
RGB= Not RGB
Colour X,RGB
Next
End Proc
Procedure COMPLEMENT
For X=0 To Screen Colour-1
RGB$=Hex$(Colour(X),3)
R$=Mid$(RGB$,2,1)
B$=Mid$(RGB$,4,1)
Mid$(RGB$,2,1)=B$
Mid$(RGB$,4,1)=R$
Colour X,Val(RGB$)
Next
End Proc
Procedure COPCOL
M$="COPY FROM:"
Text 15,170,M$
Z=0 : ZZ=0
CL1:
While Mouse Key=0 : Wend
Z=Mouse Zone
If Z<4 Then Goto CL1
If Z>35 Then Goto CL1
Z=Z-4
RGBA=Colour(Z)
M$=M$+Str$(Z)+" TO:" : Text 15,170,M$
CL2:
While Mouse Key<>0 : Wend
While Mouse Key=0 : Wend
ZZ=Mouse Zone
If ZZ<4 Then Goto CL2
If ZZ>35 Then Goto CL2
ZZ=ZZ-4
Colour ZZ,RGBA
M$=M$+Str$(ZZ) : Text 15,170,M$ : Wait 20
For X=1 To Len(M$) : Mid$(M$,X,1)=" " : Next : Text 15,170,M$
End Proc
Procedure RANGE
Shared ZYCLUS()
M$="RANGE FROM:"
Text 15,170,M$
Z=0 : ZZ=0
CL1:
While Mouse Key=0 : Wend
Z=Mouse Zone
If Z<4 Then Goto CL1
If Z>35 Then Goto CL1
Z=Z-4
M$=M$+Str$(Z)+" TO:" : Text 15,170,M$
CL2:
While Mouse Key<>0 : Wend
While Mouse Key=0 : Wend
ZZ=Mouse Zone
If ZZ<4 Then Goto CL2
If ZZ>35 Then Goto CL2
ZZ=ZZ-4
M$=M$+Str$(ZZ) : Text 15,170,M$ : Wait 20
For X=1 To Len(M$) : Mid$(M$,X,1)=" " : Next : Text 15,170,M$
ZYCLUS(2)=0
If ZYCLUS(0)<>ZYCLUS(1) Then ZYCLUS(2)=1
End Proc
Procedure EXCOL
M$="EXCHANGE:"
Text 15,170,M$
Z=0 : ZZ=0
CL1:
While Mouse Key=0 : Wend
Z=Mouse Zone
If Z<4 Then Goto CL1
If Z>35 Then Goto CL1
Z=Z-4
RGBA=Colour(Z)
M$=M$+Str$(Z)+" WITH:" : Text 15,170,M$
CL2:
While Mouse Key<>0 : Wend
While Mouse Key=0 : Wend
ZZ=Mouse Zone
If ZZ<4 Then Goto CL2
If ZZ>35 Then Goto CL2
ZZ=ZZ-4
M$=M$+Str$(ZZ) : Text 15,170,M$ : Wait 20
RGBB=Colour(ZZ)
Colour ZZ,RGBA
Colour Z,RGBB
For X=1 To Len(M$) : Mid$(M$,X,1)=" " : Next : Text 15,170,M$
End Proc
Procedure SPREAD
M$="SPREAD FROM:"
Text 15,170,M$
CL1:
While Mouse Key=0 : Wend
X=Mouse Zone
If X<4 Then Goto CL1
If X>35 Then Goto CL1
X=X-4
M$=M$+Str$(X)+" TO:" : Text 15,170,M$
CL2:
While Mouse Key<>0 : Wend
While Mouse Key=0 : Wend
Y=Mouse Zone
If Y<4 Then Goto CL2
If Y>35 Then Goto CL2
Y=Y-4
M$=M$+Str$(Y) : Text 15,170,M$ : Wait 20
If Y<X Then Swap X,Y
RGBA=Colour(X)
RGBB=Colour(Y)
DIFF=Y-X : If DIFF>-2 and DIFF<2 Then Goto EX
R1=RGBA/256
G1=(RGBA/16) mod 16
B1=RGBA mod 16
R2=RGBB/256
G2=(RGBB/16) mod 16
B2=RGBB mod 16
DIFF1=(R2-R1)/DIFF
DIFF2=(G2-G1)/DIFF
DIFF3=(B2-B1)/DIFF
DIFFER=(DIFF1*256)+(DIFF2*16)+DIFF3
X=X+1 : Y=Y-1
If X<=Y
For Z=X To Y
RGB=RGBA+DIFFER
RGBA=RGB
Colour Z,RGB
SPCOL[Z,RGB]
Next
End If
If X>Y
For Z=X To Y Step -1
RGB=RGBA+DIFFER
RGBA=RGB
Colour Z,RGB
SPCOL[Z,RGB]
Next
End If
EX:
For X=1 To Len(M$) : Mid$(M$,X,1)=" " : Next : Text 15,170,M$
End Proc
Procedure CHANGERES[REZ]
Restore INFO : For A=0 To REZ : Read SX,NC,ST : Next A
SW=Screen Width
If Extension_22_00AA =Hires Then If ST=Lowres Then SW=Screen Width/2
If Extension_22_00AA =Lowres Then If ST=Hires Then SW=Screen Width*2
Dim C(31)
For X=0 To 31
C(X)=Colour(X)
Next
SS=Screen
INFO:
Data 320,4,Lowres
Data 320,8,Lowres
Data 320,16,Lowres
Data 320,32,Lowres
Data 640,4,Hires
Data 640,8,Hires
Data 640,16,Hires
Screen Open SS,SW,Screen Height,NC,ST
Curs Off : Flash Off
For X=0 To 31
Colour X,C(X)
Next
End Proc
Procedure FINDRES
B=Screen Colour : C= Extension_22_00AA
RES=-1
Restore INFO
NR:
RES=RES+1
Read SX,NC,ST
If NC=B Then If ST=C Then Goto EX
If RES=6 Then Print "error" : Stop
Goto NR
INFO:
Data 320,4,Lowres
Data 320,8,Lowres
Data 320,16,Lowres
Data 320,32,Lowres
Data 640,4,Hires
Data 640,8,Hires
Data 640,16,Hires
EX:
End Proc[RES]