[futurebasic] Re: [FB] Colour Intensity

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1999 : Group Archive : Group : All Groups

From: Mel Patrick <mel@...>
Date: Sun, 24 Oct 1999 11:25:39 -0700
>I am trying to control the colour intensity (roughly the same 
>colour, just lighter or darker) for drawing.
>Just taking a percentage of the RGB colour and either adding or 
>subtracting doesn't seem to make the colour lighter or darker.

Aha! Found it! Amazing what you find hidden all over the place... If 
anyone else was interested here's the snippet.

   DIM orgColour;0,orgR,orgG,orgB:'          save the rgn record for each colour
   DIM hsvColour;0,hue,sat,light

     orgR=65535:' nice bright red

     CALL RGB2HSV(orgColour,hsvColour):'            convert to HSV style
     fixed&=FN SMALLFRACT2FIX(light):'             get the SMALLFRAC out
     fixed&=fixed&/100*60:'                use 60% of the original value
     light=FN FIX2SMALLFRACT(fixed&):'  convert back to a small fraction
     CALL HSV2RGB(hsvColour,orgColour):'    convert back to RGB standard
     CALL RGBFORECOLOR(#@orgColour):'                     set new colour
     CALL MOVETO(0,0):'                          set a point for testing
     CALL LINETO(200,200):'               draw a full line to this point

HSV is the Hue, Saturation and Light (or intensity). This is an FBII 
code snippet.

Since none of my projects will sucessfully convert to FB3, FB3 might 
be different. I don't know.

Mel Patrick