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
 
To
27/11/2006 10:58:43
Mike Sue-Ping
Cambridge, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
01172682
Message ID:
01172704
Views:
20
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
Next
Reply
Map
View

Click here to load this message in the networking platform