Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Event on DrawDrawing
|
Re: Event on DrawDrawing [message #27492 is a reply to message #27488] |
Wed, 21 July 2010 08:20 |
mr_ped
Messages: 825 Registered: November 2005 Location: Czech Republic - Praha
|
Experienced Contributor |
|
|
uhmmm... DrawDrawing is not "interactive" piece of code, you give it list of draw commands and it does produce the final drawing.
What you want should be done by having some GUI drawing area where you catch mouse events, operate upon some data list which contains nodes, then produce the final drawing from the modified data. If you do it quickly enough (for not too many nodes, so GUI can be redrawn fast), such simple approach will work.
(Upp framework gives you code to create GUI, to catch mouse events, to handle nodes lists (and modify them), and to draw vector graphics, but that interactive part of changing proper nodes data and putting this into some kind of interactive loop is up to you)
If you want to create true vector editor, you should probably consider something smarter and more complex with caching parts of unchanged image/layers and operate with nodes/changes in some smart way to redraw only smaller area of picture.
|
|
|
Re: Event on DrawDrawing [message #27493 is a reply to message #27492] |
Wed, 21 July 2010 09:07 |
|
ratah
Messages: 107 Registered: July 2010
|
Experienced Member |
|
|
Usually I proceed like this
class MyProgram : public WithMyProgramLayout<TopWindow>
{
public:
typedef MyProgram CLASSNAME;
Image img; // Fond
Drawing curve; // Graphe
MyProgram();
virtual void Paint(Draw& w);
}
(...)
void MyProgram::Paint(Draw& w)
{
Size screen = GetScreenSize();
int hauteur = 250;
int largeur = (int)screen.cx - 2*(255+5) - 4;
w.DrawRect(GetSize(), WhiteGray);
w.DrawImage(261, 544, img);
w.DrawDrawing(261, 544, largeur, hauteur, curve);
}
img will receive an ImageBuffer and curve a DrawingDraw
Which one is the GUI drawing area?
Could you give me an example of GUI drawing area, and very precious an example of drawing vector graphics?
My goal is not to create true vector editor but a little graph2D where user can get data values (x,y) easily by putting mouse over curve (my nodes)
|
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 15:06:20 CEST 2024
Total time taken to generate the page: 0.03019 seconds
|