Re: [PROPOSAL] Package 'ImageText'
| From: | Stefan Neufeind | Date: | Fri, 10 Oct 2003 22:14:52 +0000 |
| Subject: | Re: [PROPOSAL] Package 'ImageText' | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-22575@lists.php.net to get a copy of this message | ||
On 10 Oct 2003 at 14:49, Tobias Schlitt wrote:
> <zitiere wer="Pierre-Alain Joye">
>
> >> <zitiere wer="Pierre-Alain Joye">
>
> >> > Text itself should have a lot of things you do not have in your
> >> > class. I think about: - borders (rounded corners, line
> >> > corners,...) - antialiasing on/off (negative colors) -
> >> > vertical/horizontal/custom angle - Shadow - patterns/tiles filled
>
> >> I think all of that would be part of the GD2 package. Borders, etc.
> >> are not part of text manipulation. When the GD2 package will be
> >> developed, it should contain a baseclass for GD2 objects, where
> >> borders, antialiasing, and so an can be defined. ImageText will
> >> then inherit that.
>
> > Antialiasing is a text property you should allow the user to set it
> > on/off in the text class, that has nothing to do with the AA lines
> > or polygons.
>
> I think the implementation of antialiasing is not so hard...
>
> > A text/paragraph uses to have border property, having it in
> > Image_Text sounds good to me.
>
> Even no prob, IMHO.
>
> > I'm wondering how you will manage shadows for text using a generic
> > function, except the mask creation, everything requires the gd text
> > functions.
>
> IMHO doing a shadow can be done by outputting the text a second time
> in a light gray (or another shadow color) and some pixels moved from
> the original position, before the original text is rendered.
Hmm - you should consider using certain alpha-values for the shadows.
GD2 has support for this.
> > What's about the vertical/horizontal/custom options? :)
>
> You mean rotation? I think a real rotation is not implementable. If
> the user decides to turn the text around 23 degrees the width and
> heights are no more managable. But IMHO turns by 90 degrees (90, 180,
> 270) are implementable.
There are two things on my mind:
a) First I'd like to propose writing text from left-to-right or
easily from top-to-down (which should be doable).
b) You can draw text onto a new GD2-canvas, and rotate it by an
arbitrary angle using:
http://de3.php.net/manual/en/function.imagerotate.php
afaik. And using a transparent background for the newly created gd2-
canvas it might be doable to paste that text over the original image,
right? Haven't tried, but should work.
> >> Tha class itself until now was a little hack for myself. I think, I
> >> missed some things, while making it CS compliant! ;)
>
> > Nice hack btw :)
>
> Thx! ;)
>
> >> > If you drop the idea of a GD2 package, it will be nice to accept
> >> > 2 kind of arguments for the image destination:
>
> >> > - A gd2 ressource
> >> > Then options should contain the clip positions and size
> >> > - A surface definition
> >> > width and height
>
> >> Sorry, I didn't get that. Can you explain that again? You mean the
> >> toImage() method or what?
>
> > $imgressources = imagecreatefrompng('foobar.png');
> > ...
> > $options = array('surface' = $imgressource);
> > or
> > $options = array('surface' = array(200,200));
>
> That's a quite nice approach. My idea until now was to enable the user
> to drop his text into an image by the class. Your approach would
> implement rendering a whole image only with text, which is a nice
> feature.
>
> >> > Then the class should return either a new image (gd2 ressource)
> >> > or output the result to a file, to stdout (options contain the
> >> > imageformat), or both file and stdout.
>
> > stdout:
> > $imgtext->out('png');
>
> > file:
> > $imgtext->save('foo.png');
> >
> > file & stdout (usefull to cache and stdout at the same time):
> > $imgtext->save('png',true);
Hmm - is saving and outputting at the same time used often? Pierre,
you mean for caching an image? Why wouldn't you just write it into a
variable and save / output it? Because files might get too large?
> >> I know that the class is far away from being ready-to-use. I only
> >> wanted to propose it to PEAR to know, if it's worth working it out
> >> more. I didn't want to release a package yet, just to get some
> >> comments and ideas on it and maybe reserve the package name and put
> >> some sources into CVS.
>
> > The name should be Image_Text imho.
>
> Right.
Hmm - maybe, well okay. I hoped that Tobias might come up with a gd-
util-class ... If he plans to integrate it into a gd-utility-class
later then maybe we shouldn't consider a Image_Text-release?
Stefan