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 » Developing U++ » UppHub » StaticImage enhancement
Re: StaticImage enhancement [message #39759 is a reply to message #39748] Wed, 24 April 2013 00:02 Go to previous messageGo to previous message
Didier is currently offline  Didier
Messages: 681
Registered: November 2008
Location: France
Contributor
Hi Koldo,

Quote:

Does it exist an usc PaintCircle() function?. I could not found it.

I think you are working to much Laughing Laughing
these functions come from you're package : Controls4U (although I misspelled : it's not PaintCircle() but PaintEllipse())

fn PaintEllipse(w, left, top, right, bottom, width, color)
{
	if (width < 1)
		width = 1;
	a = (right-left)/2.;
	b = (bottom-top)/2.;
	width_2 = width/2.;
	delta = Pi()/20.;
	maxi = 2.*Pi();
	for (i = 0; i < maxi; i += delta) {
		if (i == 0) {
			x0 = left + a + (a - width_2);
			y0 = top  + b;
		} else {
			x0 = x1;
			y0 = y1;
		}
		x1 = left + a + (a - width_2) * cos(i + delta);
		y1 = top  + b + (b - width_2) * sin(i + delta);
		w.DrawLine(x0, y0, x1, y1, width, color);
	}
}

fn DrawCircle(w, cx, cy, R, width, color) {
	PaintEllipse(w, cx-R-width/2., cy-R-width/2., cx+R+width/2., cy+R+width/2., width, color);
}

fn PaintArc(w, cx, cy, R, ang0, ang1, direction, width, color)
{
	if (direction == -1) {
		c = ang0;
		ang0 = ang1;
		ang1 = c;
	}
	ang0 = ang0*Pi()/180;
	ang1 = ang1*Pi()/180;
	delta = 3*Pi()/180;
	if (ang0 > ang1)
		ang1 += 2*Pi();
	for (i = ang0; i < ang1; i += delta) {
		if (i == ang0) {
			x0 = cx + R*cos(i);
			y0 = cy - R*sin(i);
		} else {
			x0 = x1;
			y0 = y1;
		}
		x1 = cx + R*cos(i + delta);
		y1 = cy - R*sin(i + delta);
		w.DrawLine(x0, y0, x1, y1, width, color);
	}
}

fn FillEllipse(w, left, top, right, bottom, background)
{
	a = (right-left)/2.;
	b = (bottom-top)/2.;
	if (a <= 0.5 || b <= 0.5) {
		w.DrawLine(left, top, right, bottom, 1, background);
		return;
	}
	delta = Pi()/10.;
	x0 = left + a;
	y0 = top  + b;
	
	for (i = delta; i < Pi()/2.; i += delta) {
		x1 = a * cos(i);
		y1 = b * sin(i);
		w.DrawRect(x0-x1 , y0-y1, 2*x1 , 2*y1, background);
	}
	width = min(a, b)/4.;
	if (width > 1)
		PaintEllipse(w, left, top, right, bottom, width, background);
}

fn FillCircle(w, cx, cy, R, color) {
	FillEllipse(w, cx-R, cy-R, cx+R, cy+R, color);
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Functions4U doesn't compile anymore
Next Topic: Added FSMon - FileSystem Monitor class
Goto Forum:
  


Current Time: Mon Jun 17 00:58:58 CEST 2024

Total time taken to generate the page: 0.01375 seconds