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 » U++ Library : Other (not classified elsewhere) » RectTracker & MaxRect
RectTracker & MaxRect [message #17960] Thu, 04 September 2008 21:18 Go to next message
Dochy is currently offline  Dochy
Messages: 2
Registered: September 2008
Location: Czech rep.
Junior Member
Hi,
I have problem with RectTracker. I used RectTracker with ALIGN_NULL for user-specific begin of drawing rect. I want to mark part of drawn image. MaxRect is good for limit to bottom and to right, but top and left coordinates aren't limited.

So in view with borders (0,0,10,10) i can't get rect (5,5,20,20) but only (5,5,10,10) - I expected it and want it Smile
But I can get (-10,-10,5,5) - if (5,5) is origin - and I don't want this Sad .

Am I wrong or there is error?
Thanks

I naturaly can check and handle it, but I think that there must be better way Cool

void LeftDown(Point p, dword keyflags){
	// Vyrez z obrazku
	RectTracker tr(*this);
	Size sz = GetSize();
tr.Dashed().Animation(40).MaxRect(RectC(0,0,GetSize().cx,GetSize().cy));
	vyrez=RectC(p.x,p.y,0,0);
	vyrez=tr.Track(vyrez,ALIGN_NULL,ALIGN_NULL);
	Refresh();	
};


Edit:
I made modified copy of RectTracker class, that correspond to my need now. But I think that this class (RectTracker) schould be modified or there can be made a new class for clearly defined pixel based operations. Maybe someday I try it. Now I'm beginner only Smile

[Updated on: Sat, 06 September 2008 10:35]

Report message to a moderator

Re: RectTracker & MaxRect [message #18016 is a reply to message #17960] Sat, 06 September 2008 21:09 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Try using a different align. ALIGN_NULL means you have full freedom to drag in any direction.
Re: RectTracker & MaxRect [message #18031 is a reply to message #18016] Sun, 07 September 2008 11:42 Go to previous message
Dochy is currently offline  Dochy
Messages: 2
Registered: September 2008
Location: Czech rep.
Junior Member
Quote:

Try using a different align. ALIGN_NULL means you have full freedom to drag in any direction.


I know. But it is what I want. Anywhere in view area begin and anywhere end. Problem is only, that I want restricted position of end to border of view, but now there is restriction to right and bottom only. I solved it by simply modification of RectTracker::MouseMove
if(tx == ALIGN_NULL) {
	rect.right = min(org.right - op.x + p.x, maxrect.right);
	if (rect.right < rect.left) {
		Swap(rect.right, rect.left);
		rect.InflateHorz(1);
	}
}

to:
if(tx == ALIGN_NULL) {
	pom.x = min(org.right - op.x + p.x, maxrect.right);
	rect.right = max(pom.x, maxrect.left);
	if (rect.right < rect.left) {
		Swap(rect.right, rect.left);
	}
}

But it is not clear enaugh. There are variations of +-1 pixel depending of draw direction.
Now it's adequate for me, but not as final solution.

Thanks for interest.
Previous Topic: exit() -> heap leaks detected.
Next Topic: My mistake... Sorry
Goto Forum:
  


Current Time: Fri Apr 19 02:24:28 CEST 2024

Total time taken to generate the page: 0.04388 seconds