Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Color generation Part II
Message
From
19/04/2002 02:43:01
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00643022
Message ID:
00646798
Views:
20
>It also looks like it is displayed incomplete in the grid's column. On my computer I see all 3 values ok even for 255,255,0.

Here's the small update I have done as I need to have that in a browse.
CREATE CURSOR AAA(COULEUR I,COULEURTEXT C(6))

* prepare base (rainbow) colors
* note that we skip the 0 and 32 brightness to do not show RGB(0,0,0) and RGB(255,255,255
* in all 24 columns in the first row
for Hue = 1 to BaseColours 
   for Lum = 1 to Brightnesses - 1 
      nColor = HLStoRGB( (Hue-1)*(HLSMAX/BaseColours ), Lum*(HLSMAX/Brightnesses ),;
       HLSMAX-abs(Lum*(HLSMAX/Brightnesses)*2 - HLSMAX))
      aC[Lum, Hue] = nColor
      aN[Lum, Hue] = allt(str(nColor % 256)) + "," + ;
       allt(str(int(nColor/256) % 256)) + "," + allt(str(int(nColor/65536) % 256))
INSERT INTO AAA (COULEUR,COULEURTEXT) VALUES (aC[Lum, Hue],aN[Lum, Hue])
   endfor
endfor
* prepare other (shadow) colors
for Sat = BaseColours+1 to BaseColours + ShadowColours
   for Lum = 1 to Brightnesses - 1 
      nColor = HLStoRGB( (Sat-BaseColours-1)*(HLSMAX/ShadowColours ),;
       Lum*(HLSMAX/Brightnesses ), abs(Lum*(HLSMAX/Brightnesses )*2 - HLSMAX))
      aC[Lum, Sat] = nColor
      aN[Lum, Sat] = allt(str(nColor % 256)) + "," + ;
      allt(str(int(nColor/256) % 256)) + "," + allt(str(int(nColor/65536) % 256))
INSERT INTO AAA (COULEUR,COULEURTEXT) VALUES (aC[Lum, Hue],aN[Lum, Hue])
   endfor
endfor
* prepare greyscale colors. Note the difference - to show black and white colours we
* divide brightness by another way
for Lum = 1 to Brightnesses - 1 
   nColor = min((Lum-1) * (256/(Brightnesses-2)),255)
   nColor = RGB(nColor,nColor,nColor)
   aC[Lum, BaseColours+ShadowColours+1] = nColor
   aN[Lum, BaseColours+ShadowColours+1] = allt(str(nColor % 256)) + "," + ;
   allt(str(int(nColor/256) % 256)) + "," + allt(str(int(nColor/65536) % 256))
INSERT INTO AAA (COULEUR,COULEURTEXT) VALUES;
 (aC[Lum,  BaseColours+ShadowColours+1],aN[Lum, BaseColours+ShadowColours+1])
endfor

BROWSE
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform