Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can GDI be used to create a 'lighter' version of a color
Message
From
27/11/2006 15:23:44
 
 
To
27/11/2006 13:19:30
Mike Sue-Ping
Cambridge, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
01172682
Message ID:
01172760
Views:
19
You're wellcome !
Glad to know it helped you.

Cesar

>Hi Cesar,
>
>I was wondering when the "GDI Guru" would show up :)
>
>Thanks for the sample code. It works the way I needed!
>
>Mike
>
>
>>Hi Mike,
>>Hi Mike ! :-)
>>
>>I've just posted a sample "on demand" with a simple function that I've created some time ago.
>>Pls check it out and tell me how it works.
>>
>>http://weblogs.foxite.com/cesarchalom/archive/2006/11/27/2974.aspx
>>
>>PS: No need of GDI+ for that !
>>
>>Regards
>>
>>Cesar
>>
>>>Hi Mike,
>>>
>>>Thanks for the sample. I've seen some code very similar to this that "dims" the controls on a form. What I'm looking for, I suppose, is the opposite effect where the colors get "brighter". I'm clueless about the GDI library, its classes and RGB color values.
>>>
>>>Mike
>>>
>>>
>>>
>>>>Yes you can. This example is not exactly what you want, but it can get you started. The following change a colored JPEG image to a grayscale image. The function is too slow to be used as is, but you will get the idea.
>>>>
cImage = Getpict('jpg')
>>>>ConvertToGrayscale(cImage)
>>>>
>>>>Function ConvertToGrayscale(lcImage)
>>>>Set Classlib To Home()+'ffc/_gdiplus.vcx' Additive
>>>>oLogoImage = Newobject('gpBitmap',Home()+'ffc/_gdiplus.vcx')
>>>>oLogoImage.CreateFromFile(lcImage)
>>>>Private x,Y,nColor
>>>>lnWidth = oLogoImage.imagewidth
>>>>lnHeight = oLogoImage.imageheight
>>>>For Y=0 To lnHeight-1
>>>>	For x=0 To lnWidth-1
>>>>		Wait Window Nowait "Width in pixels: "+Transform(x)+", height pixels :" +Transform(Y)
>>>>		nColor = oLogoImage.GetPixel(x,Y)
>>>>		oColor = Createobject("gpColor",nColor)
>>>>		oAvg = (oColor.Red+oColor.Green+oColor.Blue)/3
>>>>		oColor.Set(Int(oAvg),Int(oAvg),Int(oAvg))
>>>>		oLogoImage.SetPixel(x,Y,oColor.ARGB)
>>>>	Next
>>>>Next
>>>>oLogoImage.SaveToFile("c:\ex.jpg","image/jpeg", "quality=100" )
>>>>Endfunc
>>>>
>>>>>Hi,
>>>>>
>>>>>Is it possible to use the GDI+ library to make a "lighter" version of a specified color?
>>>>>
>>>>>For example, if I have a known color like Blue, RGB(0,0,255), can I use GDI to make a lighter blue having RGB(210,210,255)?
>>>>>
>>>>>TIA
>>>>>
>>>>>Mike
Previous
Reply
Map
View

Click here to load this message in the networking platform