Drawing a straight 2D diagonal line

edited September 2015 in Programming Questions

Hi,

I am using processing to draw lines on canvas. My code is quite simple - processing.line(line.origin.x, line.origin.y, line.destination.x, line.destination.y);

But I get pixelated lines. Please see an example here - https://www.dropbox.com/s/gmu0kqwgdx0ozs8/Screenshot 2015-09-15 16.28.02.png?dl=0

Could you help tell me how to solve this problem?

Thanks.

Warmest Regards, Shubham.

Tagged:

Answers

  • Are you using scale()? smooth()? Post example code that we can copy, paste, and run to illustrate your issue.

  • this could be an anti-aliasing problem (can't really tell without seeing the code)

    http://forum.processing.org/two/discussion/8075/why-are-text-and-graphics-so-ugly-and-blocky

  • edited September 2015

    Often, this «error» happens when you draw the same line over and over, without using the background() at the begin of your main draw function to erase your sketch and to clean your surface. Instead, you leave a trace of the same line at the same location, and with the accumulation, it gets ugly.
    Oups! Now I noticed that koogs insert a link showing exactly this kind of mistake, as describe in the post from PhiLho.

Sign In or Register to comment.