Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GDI + capabilities
Message
From
10/01/2012 10:52:13
 
 
To
09/01/2012 15:09:39
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01532486
Message ID:
01532617
Views:
41
Thank you Al, good points to think about. I have to get my feet wet into this soon.


>>I'm looking into the graphic capabilities of GDI +. Basically I have an image of the corner of a frame (as in a frame of an art piece), I want to grab this corner and from this corner recreate the entire frame.
>>
>>The purpose of this is to have an image and then according to the size of the image draw around the image the frame using the corner frame image.
>>
>>Can GDI + do this?
>
>If you haven't already looked at it, you will probably want to investigate the GDIPlusX project at VFPX: http://vfpx.codeplex.com/wikipage?title=GDIPlusX . It's been a long time since I used it, and at the time I barely scratched the surface, but it should have plenty of functions (primitives) to help you.
>
>The corners are conceptually not that difficult. You take your original image and place it on the drawing canvas. You then create copies rotated 90, 180, and 270 degrees, and move them to the correct corners. In case the frame left and right sides are not the same width as the top/bottom, you could flip the corner image vertically or horizontally. In fact, that's probably a better approach anyways, because with an image the sides may not appear the same width even if they are the same.
>
>The sides are more difficult. Suppose you have an image of the lower left corner of the frame. Let's also assume that, whether it's a plain or an ornate corner, the image includes stubs of the lower side of the frame (at the right side of the image) and the left side of the frame (at the top side of the image). Let's further assume there's no border around the original corner image i.e. that the stubs continue all the way to the right and top edges of the image.
>
>For the lower side of the frame, you would then take a copy of the right edge of the original image, a 1 pixel wide slice, and duplicate that to the right, until it meets the lower right corner image. Similarly, for the left side of the frame, you would take a copy of the top edge of the original image, a 1 pixel tall slice, and duplicate that upwards, until it meets the upper left corner image.
>
>For the upper and right sides of the frame, you would rotate (or flip) your slices 180 degrees, and duplicate them appropriately.
>
>The trickiest thing is actually determining where to place the 4 corner images on the drawing canvas. You have to place them such that the inside corners of the corner images match the outside corners of the image to be framed. That means you have to detect the locations of the inside corners of the corner images. That becomes an exercise in edge detection - you need to detect the two edges that make the corner, then calculate where they meet. Since that needs to be done only once per corner image, you could either use image processing (non-trivial) to figure it out, or get a human being to mark the corner point. In either case you could permanently store the corner co-ordinates along with the image.
>
>If you know your original corner image dimensions, and the location of the inside corner, this whole thing just becomes an exercise in geometry.
>
>Your images will probably need to be lit perpendicularly (not from above, below, or to the side) or the finished frame will look weird when the corner images get rotated or flipped.
Previous
Reply
Map
View

Click here to load this message in the networking platform