Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Image Control and GDI+
Message
 
To
08/07/2003 12:13:23
Todd Cottengim
Alpine Land Information Services
Redding, California, United States
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
00808060
Message ID:
00808321
Views:
13
Hi Todd,

It seems that you are using the GDI+ image class. Yes, the loading of 30-50 images may be a long process. But you can make it only once in Init event of a form and store all image objects in array. LoadPicture method takes OLE Picture object as parameter and probably cannot help you in this case.
By the way, if you are using GIFs with transparency then it may be better to use GetPixelAlpha method instead of GetPixelColor. GetPixelAlpha returns level of opacity for a pixel in range 0-255. It should return 0 for transparent pixels.

>I have a form with 30 - 50 image controls each displaying a transparent background GIF. The images themselves are irregular. The controls are overlapped, creating a mosaic effect, much like a puzzle with each image control containing one piece of the puzzle.
>
>When the user clicks on the mosaic of images, he wants to know which piece has been clicked on.
>
>Current code to determine which control has been clicked looks something like this...
>
>
>LPARAMETER pnX, pnY
>#DEFINE dnWhite RGB(255,255,255)
>WITH thisform
>  FOR EACH oCtrl IN .Controls
>    IF "Vf_images" $ oCtrl.Class ;
>	AND BETWEEN(pnX, oCtrl.Left, oCtrl.Left + oCtrl.Width) ;
>	AND BETWEEN(pnY, oCtrl.Top, oCtrl.Top + oCtrl.Height)
>
>      oImage.Load(oControl.Picture)
>
>      IF oImage.GetPixelColor(pnX - oCtrl.Left, pnY - oCtrl.Top) # dnWhite
>        ** Code here for desired piece
>      ENDIF
>    ENDIF
>  ENDFOR
>ENDWITH
>
>
>The problem is the line oImage.Load(oControl.Picture). To process each image control until I get the desired one can take for 1 to 3 seconds depending on how far down the control list the image control is.
>
>I saw a function in GDI+ called FromPicture(). It takes a picture object as a parameter and appears to replace the Load() function. The only problem is that when I try to use it and pass in the Image object, I get any error.
>
>Any suggestions.
>
>Thank you.
Previous
Reply
Map
View

Click here to load this message in the networking platform