Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Color generation Part II
Message
 
 
À
19/04/2002 02:43:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00643022
Message ID:
00646819
Vues:
22
Hi!

See corretion in the code.
One is omission (probably becaue copy/paste) and one is about the width of field for colour text: you need at least 11 characters for it.

>>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(11)) && !! fixed width of field from 6 to 11
>
>* 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, Sat],aN[Lum, Sat]) && !! use "Sat" instead of "Hue" as index for second dimention of arrays
>   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
>
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform