line function doesn't work with 16 bit color

Bug #199695 reported by gilf
2
Affects Status Importance Assigned to Milestone
GASP Core
Incomplete
High
James Hancock

Bug Description

I've just been trying to learn Python using "How to Think Like a Computer Scientist". I reached this point where it refers to GASP and provides examples:

http://openbookproject.net//thinkCSpy/chap04.xhtml

Unfortunately Gasp wasn't included in the Ubuntu Python so went to FAQ 31 here, had a few false starts downloading and installing, but finally did.

Then tried the first example on that page above, and the circle drew and the box drew but the line errored out with:

>>> Line((100, 400), (580, 200))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/gasp/api.py", line 87, in __init__
    backend.create_line(self)
  File "/usr/lib/python2.5/site-packages/gasp/backend.py", line 180, in create_line
    (end[0], flip_coords(end[1], obj.sprite.rect)), False)
ValueError: unsupported bit depth for aaline draw (supports 32 & 24 bit)

I don't know if this applies but I use a Thinkpad 600E and it has its graphics mode set to 16 bit color -- I have to do that to be able to run reasonably fast in Ubuntu. Other than GASP's line drawing function, I haven't had a single problem running anything else graphically in Ubuntu -- including vector graphics draw programs, 3D CAD renderers, and videos.

In fact the GASP box and circle functions drew fine -- only the line function had this problem.

Computer:Thinkpad 600E, Ubuntu 7.10, Python, 1024 x 768 x 16 bit color

Jeffrey Elkner (jelkner)
Changed in gasp-code:
assignee: nobody → jlhancock
importance: Undecided → High
milestone: none → 0.2
status: New → Confirmed
Revision history for this message
James Hancock (jlhancock) wrote :

To fix this bug you will need to create a pygame.display.Info() instance and use that to find the bit display of the current display window.

then draw lines(blah...) if it is 16 bit
and aalines(blah) for everything else.

cheers,
James Hancock

Revision history for this message
Nick Fenger (nick-trilliumcharterschool) wrote :

A vertical line works:
Line((10,10),(10,200))
A horizontal line works
Line((10,10),(200,10))
But, any diagonal line such as:
Line((11,10),(10,200))
gives me the "unsupported bit depth" error

Revision history for this message
Luke Faraone (lfaraone) wrote :

Hi,

Can you see if this is still a problem in GASP 0.3.1?

Changed in gasp-code:
status: Confirmed → Incomplete
Revision history for this message
odavgrsml (owengreensmile) wrote :

the only way it would work is, if it were double the pixel width.

Revision history for this message
odavgrsml (owengreensmile) wrote :

...but only with 16 bits or lower.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.