Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to make GetPixelColor() work with gpimage?
Message
From
16/10/2005 18:50:12
 
 
To
16/10/2005 03:12:50
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01059480
Message ID:
01059527
Views:
10
#include gpImage.h
If Not "gpImage" $ Set("Procedure")
   Set Procedure To gpImage Additive
EndIf

gdip = CreateObject("gpInit")
img  = CreateObject("gpImage")

** Loading Image
lcFile = GetPict("jpg;gif;bmp")
img.Load(lcFile)

** To get the selected color 
? img.GetPixelColor(0, 0)
I always like to close the objects after using them, to minimize the use of memory and handles
img = NULL
gdip = NULL 
With these functions you can have the individual components of the RGB color :
FUNCTION GetRed(tnColor) 
   RETURN BITAND(tnColor, 0x000000FF) 
ENDFUNC 
FUNCTION GetGreen(tnColor) 
   RETURN BITRSHIFT(BITAND(tnColor, 0x0000FF00), 8) 
ENDFUNC 
FUNCTION GetBlue(tnColor) 
   RETURN BITRSHIFT(BITAND(tnColor, 0x00FF0000), 16) 
ENDFUNC 
You can have also a look at an enhanced version of this class at
http://cchalom.sites.uol.com.br/GPIMAGE/index.htm

Regards
Cesar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform