'$ filename "t.exe"
'#include "../../inc/RTL32.inc"
'#include "../../inc/RTL64.inc"
#include "Controls.inc"
class ColorDialogBox
====================
'
indexbase 0
'
'FlatBox im1
'ShadeBox im1
NoiseBox im1
'
DialogBox d1
Slider s1,s2,s3,s4,s5,s6
Slider v1,v2,v3,v4,v5,v6,v7,v8
sys r,g,b,h,l,s,p,q
sys RgbZone,HcsZone
'
method constructor()
'
'images
'
im1<=320,160,0x7f7f7f,2
im1.create
'
'controls
'
d1<=20,40,600,400,"Procedural Noise"
s1<=100,100,10,15,50,150,100,100,"Red"
s2<=100,140,10,15,50,150,140,140,"Green"
s3<=100,180,10,15,50,150,180,180,"Blue"
s4<=100,220,10,15,50,150,220,220,"Hue"
s5<=100,260,10,15,50,150,260,260,"Luminance"
s6<=100,300,10,15,50,150,300,300,"Saturation"
s4.sc=240 'show scale
s5.sc=240 'show scale
s6.sc=240 'show scale
v1<=360,300,08,07,360,360,250,350,"A"
v2<=380,300,08,07,380,380,250,350,"B"
v3<=400,300,08,07,400,400,250,350,"C"
v4<=420,300,08,07,420,420,250,350,"D"
v5<=440,300,08,07,440,440,250,350,"E"
v6<=460,300,08,07,460,460,250,350,"F"
v7<=480,300,08,07,480,480,250,350,"G"
v8<=500,300,08,07,500,500,250,350,"H"
v1.bfeedback 128
v2.bfeedback 64
v3.bfeedback 32
v4.bfeedback 16
v5.bfeedback 8
v6.bfeedback 4
v7.bfeedback 2
v8.bfeedback 1
end method
'
method destructor
im1.destroy
end method
'
method set()
s1.set
s2.set
s3.set
s4.set
s5.set
s6.set
v1.set
v2.set
v3.set
v4.set
v5.set
v6.set
v7.set
v8.set
end method
'
method show()
d1.show
im1.rf=s1.fvalue 1
im1.gf=s2.fvalue 1
im1.bf=s3.fvalue 1
im1.nn=>
v1.bvalue,v2.bvalue,v3.bvalue,v4.bvalue,
v5.bvalue,v6.bvalue,v7.bvalue,v8.bvalue
im1.show d1.px+d1.sx-im1.w-10, d1.py+10
s1.show
s2.show
s3.show
s4.show
s5.show
s6.show
v1.show
v2.show
v3.show
v4.show
v5.show
v6.show
v7.show
v8.show
end method
'
method anchor()
d1.anchor
s1.anchor
s2.anchor
s3.anchor
s4.anchor
s5.anchor
s6.anchor
v1.anchor
v2.anchor
v3.anchor
v4.anchor
v5.anchor
v6.anchor
v7.anchor
v8.anchor
end method
method move()
d1.move(xMouse-sxMouse,yMouse-syMouse)
tx=d1.px-d1.spx 'with limits
ty=d1.py-d1.spy 'with limits
s1.move tx,ty
s2.move tx,ty
s3.move tx,ty
s4.move tx,ty
s5.move tx,ty
s6.move tx,ty
v1.move tx,ty
v2.move tx,ty
v3.move tx,ty
v4.move tx,ty
v5.move tx,ty
v6.move tx,ty
v7.move tx,ty
v8.move tx,ty
end method
'
method HcsFeedback(sys c)
ColorRGBToHLS c,h,l,s
s4.ffeedback h,240
s5.ffeedback l,240
s6.ffeedback s,240
end method
'
method RgbFeedback(sys c)
r=c and 255
shr c,8
g=c and 255
shr c,8
b=c and 255
s1.bfeedback r
s2.bfeedback g
s3.bfeedback b
end method
'
method GetHcsColor() as sys
h=s4.fvalue 240
l=s5.fvalue 240
s=s6.fvalue 240
return ColorHLStoRGB h,l,s
end method
'
method GetRgbColor() as sys
return s1.bvalue()+s2.bvalue()*0x100+s3.bvalue()*0x10000
end method
'
method zone() as sys
return d1.zone
end method
'
method zones(sys *RgbZone,*HcsZone)
RgbZone=s1.zone()+s2.zone()+s3.zone()
HcsZone=s4.zone()+s5.zone()+s6.zone()
end method
'
method action()
if mouseButton=0
anchor
q=0
end if
if q
move
elseif MouseButton
set
zones RgbZone,HcsZone
if RgbZone then
HcsFeedback GetRgbColor
elseif HcsZone
RgbFeedback GetHcsColor
elseif v1.zone() or v2.zone() or v3.zone() or v4.zone() or
v5.zone() or v6.zone() or v7.zone() or v8.zone()
'
elseif zone
q=1
end if
end if
end method
'
end class
's=recordof ColorDialogBox
'putfile "t.txt", s
new ColorDialogBox cdb
AscKey=-1
do
if EscKey then exit do
if mouseButton=0
sxMouse=xMouse
syMouse=yMouse
end if
cdb.action
if MouseButton or AscKey
ClsColor 0x606060 'cdb.GetRgbColor
cdb.show
AscKey=0
FlipBuffer
sleep 5
else
events
sleep 50
end if
end do
del cdb