|
-
Apr 11th, 2008, 09:53 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Build Vector image w/ zoom, pan, etc.
I'm building a program that imports AutoCAD DXF files, draws them on the screen, and later builds a special output file. I would like to have a window were the image will be built (using lines, arcs, circles, and possibly text), and then using the mouse be able to zoom, pan, resize, etc.
Is this something I need to use like DirectDraw or something? Or is there a simpler way of doing this. I dont need it running at break-neck speeds, just something usable and easy to code. Right now I have it drawing on the form, but this is not the best way to do it. How should I go about doing this?
**EDIT - It would also be handy to be able to add layers. Be able to turn on/off layers say (Layer1 = imported image, Layer2 = Computer interpreted output image)
Last edited by MotoMan_Yz400; Apr 11th, 2008 at 10:02 AM.
-
Apr 11th, 2008, 11:04 AM
#2
Re: Build Vector image w/ zoom, pan, etc.
You could do it with GDI+, but for things like layers and complex models, you may want to look into DirectX routines, which are different, but not as overly complex as you may think.
-
Apr 11th, 2008, 01:49 PM
#3
Thread Starter
Addicted Member
Re: Build Vector image w/ zoom, pan, etc.
So can GDI+ handle zoom and pan?
Currently I have a "scale factor", "DeltaX" and "DeltaY" factored into my drawline command. So every time the screen needs to update to the new zoom setting or pan position, I have to clear and redraw (causing glitchiness).
I was wondering if there is a way I can set up a window where I pass points for lines, circles, etc to and define zoom, and pan position. So that way I can deal with the redrawing on a lower level. (I think DirectX can do this with 3D, but not sure how to do it in 2D).
-
Apr 11th, 2008, 01:53 PM
#4
Re: Build Vector image w/ zoom, pan, etc.
Not automatically, you'll have to scale and translate the points yourself. With DirectX, you could effectively convert the DXF to a 3D mesh and use the 3D manipulation functions to scale and translate it.
-
Apr 11th, 2008, 01:58 PM
#5
Thread Starter
Addicted Member
Re: Build Vector image w/ zoom, pan, etc.
Well to do DirectX do I really need to make a 3D sketch even if it's a 2D vector points?
If I did choose to go with DirectX for this, do I need to download the DirectX SDK pack? or is there something I need to call or define in my program before hand?
-
Apr 11th, 2008, 02:12 PM
#6
Re: Build Vector image w/ zoom, pan, etc.
You do if you don't want to write transformation routines to zoom and scale your collection of points. There's no difference between 2D meshes and 3D meshes these days, they use the same 3D acceleration on video cards and the same functions to manipulate them.
Yes, you need the DirectX SDK pack. It has the DirectX assemblies you'll need to call.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|