Graphic vector editor .
To implement graphics, it is advisable to use graphics.h and also if you need windows.h. In the process of writing, there were problems with some things:
1) How to implement editable geometric primitives (polyline, rectangle, circle, ellipse, segment, polygon, at least just to understand how this is implemented).
2) How to make buttons for opening an image and saving it.
3) How to make undo / redo buttons.
4) In my current code, the work area is a fixed area inside the program window, that is, it is just a rectangle filled with (initially white) inside the window.
Are there any books that can somehow guide me or help in writing something like this, or advise something if you have come across something like that or are just ready to help. I would be grateful for every advice. Thank!
Closed due to the fact that the issue is too common for participants 0xdb , D-side , insolor , Kromster , jfs Apr 29 '18 at 18:18 .
Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .
- Use Direct2D. - VTT
- Try to ask a narrow, specific question and paint it as detailed as possible. Do not ask a few questions in one. Read the article " What questions are better not to ask " in the help. - default locale
1 answer
- If not satisfied with the line function, use Bresenham . Listed below, everything is constructed from lines, for example, points of a circle, obviously so:

First, decide on the data structure (this is item 0), if according to the problem statement you do not need to generate the real vector format, save it in any convenient way to restore to a simple text file. Otherwise - see for example here.
There are several options, the most obvious idea is to have an array (stack) of
history, andpushgenerated vector into this array with each action. The "UNDO" button, respectively, makes apop, puts theredoHistoryreceived on the stack, displays the last vector from the stack remaining on the screen. The "REDO" button does the same with theredoHistorystack. With any other action,redoHistoryis cleared. Another option is correct, tree-like and recursive, but for example in Windows, the Undo function does not usually do that.All OK. But if you need much beauty and simplicity, take the SDL or Allegro
Google will show a lot of books on C ++ graphics, but you can just read the source code and articles with code.
- Thank you very much, very informative, and most importantly useful) - zzronn
- Hello, can you please tell me how to make the opening dialog box for selecting a text file which will be the input file stream, I have already done saving via a text document. Thank you in advance! - zzronn pm