i plotted a parabola....when i try to join the previous pixel with the next pixel,it does not come out to be straight???cant we draw a smooth curve....joing pixels???if no then why???

Recommended Answers

All 7 Replies

Well until you post code, and tell us which OS/Compiler/Graphics library you're using (not that I'm expecting it to be anything other than fossil TurboC and BGI), don't expect an answer.

The way to make the curve appear smoother is to reduce the interval between sample points.

well I AM USIING TURBO C++,OS IS WINDOWS XP PROFESSIONAL,AND I AM USING PUTPIXEL COMMAND...WE CANT REDUCE THE THE DISTANCE BETWEEN THE POINTS BECAUSE PUTPIXEL COMMAND ACCEPTS ONLY INTEGER VALUES,SO IF A FLOATING POINT VALUE WILL BE USED IT WILL BE TRUNCATED...EG..PUTPIXEL(31,50,2) 31 IS THE X COORDIANTE,50 =Y COORDINATE, 2 IS THE COLOR OF TEH PIXEL...
IS SAME AS PUTPIXEL(31.4,50.3,2);

and i am using graphics.h

well it is better if u can give straight 4wd answers...salem....we are here to discuss the querys...

>well it is better if u can give straight 4wd answers...
Salem's answer not only was as thorough as possible given the complete lack of information you provided, it was also useful in other ways. So drop the attitude.

commented: well said +11

OK, so you've recognised that pixel plotting is integer based, so what's the problem?

To draw a pixel at a fractional position, you have to resort to Anti-aliasing.

Now, if you were using a modern compiler, with a modern graphics library (and not that stone-age fossil everyone seems to love for some unknown reason), then you might be able to get some built-in support. But as it is, expect to get down to doing some serious maths to make your images look good.

The first problem you'll come across is the utter lack of a decent colour space in your fossil graphics library. AA works best on say an 8:8:8 colour space, but with something crude like 3:3:2 or even a 256-palette, your options are severely limited.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.