Home » Developing U++ » UppHub » StaticImage enhancement
Re: StaticImage enhancement [message #39759 is a reply to message #39748] |
Wed, 24 April 2013 00:02 |
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
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);
}
|
|
|
|
|
StaticImage enhancement
By: Didier on Tue, 16 April 2013 23:15
|
|
|
Re: StaticImage enhancement
By: koldo on Wed, 17 April 2013 08:31
|
|
|
Re: StaticImage enhancement
By: Didier on Wed, 17 April 2013 23:49
|
|
|
Re: StaticImage enhancement
By: koldo on Fri, 19 April 2013 12:57
|
|
|
Re: StaticImage enhancement
By: Didier on Fri, 19 April 2013 15:44
|
|
|
Re: StaticImage enhancement
By: koldo on Sat, 20 April 2013 00:05
|
|
|
Re: StaticImage enhancement
By: Didier on Mon, 22 April 2013 20:14
|
|
|
Re: StaticImage enhancement
By: koldo on Tue, 23 April 2013 09:09
|
|
|
Re: StaticImage enhancement
By: Didier on Wed, 24 April 2013 00:02
|
|
|
Re: StaticImage enhancement
By: koldo on Wed, 24 April 2013 08:29
|
|
|
Re: StaticImage enhancement
By: Didier on Thu, 25 April 2013 20:45
|
Goto Forum:
Current Time: Mon Jun 17 00:58:58 CEST 2024
Total time taken to generate the page: 0.01375 seconds
|