Re: Accessing another extensions resource.. possible?
| From: | (Uwe Steinmann) | Date: | Sat, 13 Aug 2005 16:15:41 +0000 |
| Subject: | Re: Accessing another extensions resource.. possible? | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-2753@lists.php.net to get a copy of this message | ||
On Sat, Aug 13, 2005 at 10:06:59AM -0600, Sean wrote:
> I have a question regarding resource management in PHP that I would
> absolutely appreciate any insight on-
>
> Can extension A get access to a resource created by extension B? For
> example- if I wanted to add in a new image function, could I get access to
> the GD extension's gdImage struct?
>
> I wrote an improved Breshenham line algorithm in php that renders the most
> beautiful antialiased lines I've ever seen. The problem is the php
> implementation for it is UBER slow. Hence I'm looking into writing my own
> extension to give it a speed boost. But I'm having a hard time finding the
> right approach to this.
>
> There's three ways I'm thinking this can be done-
> 1. Write my own extension based on GD from scratch
> 2. Inject my line drawing function into gd.h and gd.c (so it'd be a modified
> version of the gd extension that comes with php)
> 3. Write my own extension that is capable of accessing the gdImage struct
> from the GD extensions.
>
> I'd prefer not to write an entire image library from scratch. But I'll do
> it if 2 and 3 aren't possible/reasonable.
Have a look at the pdf extension. It can take over an image created by
gd extension and place it into a pdf document. It is possible but in the past
there were problems with compiling the pdf extension outside the php-src
tree, because the gd header files were not installed in
/usr/local/include/php4. I think this is now fixed.
That should make option 3 feasable.
Uwe
--
MMK GmbH, Universitaetsstr. 11, 58097 Hagen
Uwe.Steinmann@mmk-hagen.de
Tel: +2331 840446 Fax: +2331 843920