|
![](/i/fill.gif) |
Orchid XP v8 <voi### [at] dev null> wrote:
> In the simple case of lines beginning and ending on pixel boundaries,
> it's pretty easy.
How so?
Ok, maybe if you assume each pixel to be a circle (instead of a square)
it would become simply calculating the distance between the (edge of the)
line and the center of the pixel. That might work as a quite accurate
approximation.
However, since pixels are squares, not circles, and if you want a very
accurate antialiasing, you would have to calculate how much of the square
is covered by the line. I'm not aware of a very trivial way of doing that.
(I'm not saying it's *complicated*. I'm saying it's *not trivial*, like
eg. a simple one-liner.)
> On the other hand, if you want lines that begin and end at fractional
> coordinates, or have rounded ends or whatever, the problem becames far
> more complicated.
The ends of the line, especially if the line is wider than one pixel
(and especially if you use antialiasing) become a quite ambiguous problem.
Should the line be essentially a rectangle? Or two circles joined by a
rectangle? What if you draw two consecutive lines, what should the joint
point look like?
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |