PDA

View Full Version : Drawing an arc.



munna
6th June 2006, 09:55
Hi,

I want to draw a few arcs but i see that the arc drawing not very consistent. Can some one please help me?

I use the following code :




paint->drawArc(left,top,15,20,16*80,16*100);
paint->drawArc(right,top,15,20,0,16*100);



And I get the following result.

http://img127.imageshack.us/img127/7606/arcs1gl.png (http://imageshack.us)

Note that for the images to be mirror of each other the two red pixels should be drawn which QPainter is not drawing. Can some one please tell me why is this happening?
Is my code right?

Thanks a lot.

jpn
6th June 2006, 10:56
It's caused by rounding in integer arithmetic.

If you want to make it look better, use the QPainter::drawArc() method which uses floating point precision and maybe even set antialiasing on (QPainter::setRenderHint()).

munna
6th June 2006, 10:58
The problem is that I currently on Qt 3.3.6.:(

munna
6th June 2006, 12:33
Any ideas on how I can solve this problem. I want a mirror image of one of them.

Thanks a lot.

munna
12th June 2006, 15:06
I have been try hard to solve this problem but in vain.

Can you guys help me making the mirror image of the one which is correct ?

I tried rotating the QPainter but its not working.

Pls Help
Thanks a lot

jacek
12th June 2006, 15:42
I tried rotating the QPainter but its not working.
You should rather scale it by (-1, 1) and then translate by (width, 0).

munna
13th June 2006, 05:36
You should rather scale it by (-1, 1) and then translate by (width, 0).

I tried this but scale is not working.

Pls Help

Thanks.