libgd patch for alpha-channel mixing
| From: | Tim Toohey | Date: | Wed, 21 Aug 2002 09:19:33 +0000 |
| Subject: | libgd patch for alpha-channel mixing | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-87251@lists.php.net to get a copy of this message | ||
This is a patch to add nicer alpha-channel mixing to the GD module.
It introduces two new PHP functions:
ImageLayerEffect() & ImageColorMatch()
ImageLayerEffect() is similar to the existing ImageAlphaBlending() function in
that it affects the way pixel drawing will be done during any kind of drawing
function. It extends the functionality by allowing you to use new effect
modes. There are four modes: replace, alpha, normal and overlay. Replace and
alpha are like ImageAlphaBlending(FALSE) and ImageAlphaBlending(TRUE)
respectively. "Normal" mode is like alpha but works on transparent and
semi-transparent backgrounds. "Overlay" is like the overlay layer effect in
graphics programs.
The ImagePSText() function can now draw on arbitrary backgrounds using the
normal layer effect (my technique is to use a text background colour that has
the same RGB as the text foreground but a transparent alpha.)
ImageColorMatch() is a function I've been using to tweak the
ImageTrueColorToPalette() results. I find that the generated palette gets
close, but doesn't quite match sometimes. This function fixes that "problem"
(at least it works for me).
Any thoughts? Should I go ahead and commit this? I've never committed to PHP
before so go easy on me :-). I've been using essentially the same code on a
PHP-4.1.0 installation for a while now and I believe it works OK.
Tim
Attachment: [text/x-diff] php-4.3.0ttoohey-0.1.diff
Attachment: [text/x-diff] php-4.3.0ttoohey-0.1.diff