Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anil Tayal
  Where is Anil Tayal?
 Delhi
 India
 Anil Tayal
 To: Simon Arnold
  Where is Simon Arnold?
 Halifax
 United Kingdom
 Simon Arnold
 Tags
Subject: RE: getcolor
Thread ID: 15656 Message ID: 15751 # Views: 0 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Sunday, September 29, 2002 6:51:41 AM         
   


> > Hi All,
> >
> > I want to record the values of R,G,B while getcolor() only returns a single number. How can I get them ? Also, how can I change the luminance or brightness of a color ? If I simply add a few thousand to the RGB value the color sometimes changes to an altogether different shade. Please Help.
> >
> > Thanx
> >
> > Anil
> >
>
> This Code should help
>
>
> LOCAL nR,nG, nB
> x = GETCOLOR()
> =RGBComp(x,@nR,@nG,@nB)
> 
> ? "Red = " + TRANSFORM(nR)
> ? "Green= " + TRANSFORM(nG)
> ? "Blue= " + TRANSFORM(nB)
> 
> 
> 
> PROCEDURE RGBComp( nRGBColor, nRed, nGreen, nBlue )
> 
> 	LOCAL nColor
> 
> 	nColor = nRGBColor
> 
> 	IF nColor <> -1  
> 	   nBlue  = INT( nColor / (256 ^ 2) )
> 	   nColor = MOD( nColor , (256 ^ 2) )
> 	   nGreen = INT( nColor / 256)
> 	   nRed   = MOD( nColor , 256)
> 	ELSE
> 	   STORE -1 to nBlue, nGreen, nRed
> 	ENDIF
> 
> ENDPROC
> 

>
> Simon Arnold.

Thanx a lot, this was very helpful. But one more thing , I want to change the brightness of a color. How do I do that ?

Anil


ENTIRE THREAD

getcolor Posted by aktayal @ 9/26/2002 10:05:49 PM
RE: getcolor Posted by Tamar Granor @ 9/26/2002 10:46:35 PM
RE: getcolor Posted by Simon Arnold @ 9/26/2002 10:46:36 PM
RE: getcolor Posted by aktayal @ 9/29/2002 6:51:41 AM