Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draw_py for Python algos & aaline testing #535

Merged
merged 18 commits into from Oct 9, 2018

Conversation

Projects
None yet
2 participants
@e1000
Copy link

e1000 commented Sep 9, 2018

  • introduce src_py/draw_py.py for Python implementation of drawing algorithms
  • implement and test Python version for draw.polygon
  • tests for aaline conforming to the suggestions made in #522
  • [edit] some draw.c cleanup

Remark: it seems that, within the src_py/draw_py.py module,
the following code does not work in Python2 :

from __future__ import relative_imports
from math import floor, ceil, trunc

Instead, math is interpreted as pygame.math and Python does not find the
functions ... But I would like to use those functions for an aaline algorithm.
(I ll try to investigate this).

@illume

This comment has been minimized.

Copy link
Member

illume commented Oct 9, 2018

I guess pygame.math was a bad naming choice considering there is a math builtin module.

BOTTOM_EDGE = 0x4
TOP_EDGE = 0x8

def encode(x, y, left, top, right, bottom):

This comment has been minimized.

Copy link
@illume

illume Oct 9, 2018

Member

encode could use documentation

REJECT = lambda a, b: a and b


def clip_line(line, left, top, right, bottom):

This comment has been minimized.

Copy link
@illume

illume Oct 9, 2018

Member

needs docs

y1 = top


def clip_and_draw_line(surf, rect, color, pts):

This comment has been minimized.

Copy link
@illume

illume Oct 9, 2018

Member

needs docs

return 1


# Variant of https://en.wikipedia.org/wiki/Bresenham's_line_algorithm

This comment has been minimized.

Copy link
@illume

illume Oct 9, 2018

Member

Needs docs.

@illume

This comment has been minimized.

Copy link
Member

illume commented Oct 9, 2018

Documentation improvements could go into a future PR. Going to merge this now.

Thanks :)

@illume illume merged commit 60b3803 into pygame:master Oct 9, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@illume illume referenced this pull request Oct 16, 2018

Closed

1.9.5 release notes. #561

4 of 4 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.