Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Event on DrawDrawing
Event on DrawDrawing [message #27488] Tue, 20 July 2010 15:38 Go to next message
ratah is currently offline  ratah
Messages: 107
Registered: July 2010
Experienced Member
Is it possible to attach an event on Drawing to produce a vectorial image? So user can move nodes!!
Or simply get data at a node (x,y) when the mouse is over

Thanks
Re: Event on DrawDrawing [message #27492 is a reply to message #27488] Wed, 21 July 2010 08:20 Go to previous messageGo to next message
mr_ped is currently offline  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 Go to previous messageGo to next message
ratah is currently offline  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)
Re: Event on DrawDrawing [message #27497 is a reply to message #27488] Wed, 21 July 2010 10:58 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
Try to look at Bazaar/TestScatter2 package, maybe it will give you some ideas, although it may be a bit overwhelming as the Scatter control is probably somewhat too complex for what you want.

From your short piece of code... the "w" is the drawing area, where you output picture for user. If you would change "curve" dynamically, each repaint you will get moving curve. If you will react to mouse events somehow (check scatter demo, it does show tooltip with mouse position in graph on left click), your program will be interactive.
Re: Event on DrawDrawing [message #27499 is a reply to message #27497] Wed, 21 July 2010 11:27 Go to previous message
ratah is currently offline  ratah
Messages: 107
Registered: July 2010
Experienced Member
It's OK, I analyse quietly.
Previous Topic: Image from URL
Next Topic: libjpeg-turbo
Goto Forum:
  


Current Time: Thu Mar 28 22:14:56 CET 2024

Total time taken to generate the page: 0.00850 seconds