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

aggdraw.Draw, aggdraw.Pen, aggdraw.Brush, etc... are not extendable (apparently) #68

Closed
ismaelharunid opened this issue Jun 13, 2020 · 1 comment

Comments

@ismaelharunid
Copy link

aggdraw.Draw, aggdraw.Pen, aggdraw.Brush, and the other classes are not sub-classable / extendable (apparently.)

They are not even considered classes at all by python. Taking the type of an instance dos deliver something that are considered classes. But they are not extendable nor typable.

Can I request that some way to subclass the classes be provided. Or some hooks to enable subclassing.

Any details needed for this request please ask.

The why, is because it is very desirable in many situations to sub-class those classes. Wrapping and proxying them will work except that doing an instance class check still becomes impossible.

Thank you.

@djhoese
Copy link
Member

djhoese commented Jun 13, 2020

See #58 and #45. Basically aggdraw was written a long time ago and does some questionable things to produce instance objects. The "classes" are essentially C functions that return instances of the object class with the necessary pieces filled in. The side effects of this are as you described, aggdraw's classes can't be used like normal classes. Things like type(instance_obj) can cause segmentation faults. Aggdraw "classes" can't be subclassed.

In #45 I describe how we should convert aggdraw to use Cython to wrap the low-level C++ library. However, we first need to resolve #67 as our master branch is producing inconsistent results with old versions of aggdraw. This wasn't figured out until after the major migration to the new agg library. Due to limited time (this is a volunteer project) I can't justify cython-izing old versions of aggdraw knowing that I'd have to do major work to do it again with the new agg library.

If you don't mind I'm going to close this as a duplicate of #45. If you feel strongly about it we can reopen this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants