re: Blending images with alpha (patches inside)
[email protected] (patrick keshishian)
| Newsgroups | php.gd.devel |
|---|---|
| Message-ID | <[email protected]> |
Greetings Pierre,
I didn't receive a reply regarding my post to the gd-devel list
but I did see your reply at http://news.php.net/php.gd.devel/,
so excuse me for not quoting your reply directly.
Maybe I misunderstood what you were trying to demonstrate with
your Php example, but I never claimed the there were any issues
with the 'image copy' function.
What I was trying to accomplish with my patch was to provide for
a method by which the user/programmer could change the level of
opacity of a source image at run-time.
Something like this Perl code snippet:
my $iw = GD::Image->new('circ.png'); # Watermark image
my $is = GD::Image->new('test_in.jpg');
# ... Set up vars
# Blend the watermark at 100%, 65%, 35% and 10% opacities.
$is->blend($iw, $dx, $dy, $sx, $sy, $sw, $sh, 100);
$is->blend($iw, $dx + $sw, $dy, $sx, $sy, $sw, $sh, 65);
$is->blend($iw, $dx, $dy + $sh, $sx, $sy, $sw, $sh, 35);
$is->blend($iw, $dx + $sw, $dy + $sh, $sx, $sy, $sw, $sh, 10);
# ... Write resulting image.
This will blend the watermark image onto the the test_in.jpg
four times, in four quadrants at four different opacity levels.
Here is the result from the code:
http://sidster.org/code/gd/gd_blend_test.jpg
Best,
--patrick