Skip to content

Commit

Permalink
Cleaned docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mzivic7 committed Oct 4, 2024
1 parent c845d91 commit eb8c005
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions docs/reST/ref/draw.rst
Original file line number Diff line number Diff line change
Expand Up @@ -461,70 +461,6 @@ object around the draw calls (see :func:`pygame.Surface.lock` and
Draws a straight antialiased line on the given surface. There are no endcaps.
For thick lines the ends are squared off.

The line has a thickness of one pixel and the endpoints have a height and
width of one pixel each.

The way a line and its endpoints are drawn:
If both endpoints are equal, only a single pixel is drawn (after
rounding floats to nearest integer).

Otherwise if the line is not steep (i.e. if the length along the x-axis
is greater than the height along the y-axis):

For each endpoint:

If ``x``, the endpoint's x-coordinate, is a whole number find
which pixels would be covered by it and draw them.

Otherwise:

Calculate the position of the nearest point with a whole number
for its x-coordinate, when extending the line past the
endpoint.

Find which pixels would be covered and how much by that point.

If the endpoint is the left one, multiply the coverage by (1 -
the decimal part of ``x``).

Otherwise multiply the coverage by the decimal part of ``x``.

Then draw those pixels.

*e.g.:*
| The left endpoint of the line ``((1, 1.3), (5, 3))`` would
cover 70% of the pixel ``(1, 1)`` and 30% of the pixel
``(1, 2)`` while the right one would cover 100% of the
pixel ``(5, 3)``.
| The left endpoint of the line ``((1.2, 1.4), (4.6, 3.1))``
would cover 56% *(i.e. 0.8 * 70%)* of the pixel ``(1, 1)``
and 24% *(i.e. 0.8 * 30%)* of the pixel ``(1, 2)`` while
the right one would cover 42% *(i.e. 0.6 * 70%)* of the
pixel ``(5, 3)`` and 18% *(i.e. 0.6 * 30%)* of the pixel
``(5, 4)`` while the right
Then for each point between the endpoints, along the line, whose
x-coordinate is a whole number:

Find which pixels would be covered and how much by that point and
draw them.

*e.g.:*
| The points along the line ``((1, 1), (4, 2.5))`` would be
``(2, 1.5)`` and ``(3, 2)`` and would cover 50% of the pixel
``(2, 1)``, 50% of the pixel ``(2, 2)`` and 100% of the pixel
``(3, 2)``.
| The points along the line ``((1.2, 1.4), (4.6, 3.1))`` would
be ``(2, 1.8)`` (covering 20% of the pixel ``(2, 1)`` and 80%
of the pixel ``(2, 2)``), ``(3, 2.3)`` (covering 70% of the
pixel ``(3, 2)`` and 30% of the pixel ``(3, 3)``) and ``(4,
2.8)`` (covering 20% of the pixel ``(2, 1)`` and 80% of the
pixel ``(2, 2)``)
Otherwise do the same for steep lines as for non-steep lines except
along the y-axis instead of the x-axis (using ``y`` instead of ``x``,
top instead of left and bottom instead of right).

.. note::
Regarding float values for coordinates, a point with coordinate
consisting of two whole numbers is considered being right in the center
Expand Down

0 comments on commit eb8c005

Please sign in to comment.