Subject: | doc update requried, brush images must be palette and not truecolor images. |
Date: | Thu, 5 Oct 2017 02:10:21 +0000 |
To: | "'bug-GD [...] rt.cpan.org'" <bug-GD [...] rt.cpan.org> |
From: | "GRAY Andrew G (SPARQ)" <andrewg.gray [...] sparq.com.au> |
Documentation should explicitly state the brushes must be palette.
The example shown in the doc is a palette image, but this is implied rather than stated explicity.
Output when brush is a truecolour
[cid:image001.png@01D33DD2.853A8DF0]
Output when brush is palette image (correct/expected behaviour).
[cid:image002.png@01D33DD2.EAEE5230]
[root@compiler ag118]# diff sample.pl.base sample.pl
12c12
< my $brush = new GD::Image(12,12,1) || die "died creating GD image brush?\n";
---
Show quoted text
> my $brush = new GD::Image(12,12) || die "died creating GD image brush?\n";
#!/usr/bin/perl
use strict;
use warnings;
use GD;
use constant { true=>1, false=>0 };
my $dbug=true;
# create a brush to use
my $brush = new GD::Image(12,12,1) || die "died creating GD image brush?\n";
my $brbkgnd = $brush->colorAllocate(128,128,128); # grey
my $brcolor = $brush->colorAllocate(255,255,0); # yellow
$brush->transparent($brbkgnd);
$brush->filledEllipse(4,4,8,8,$brcolor);
# create new image canvas
my $img = new GD::Image(512,512,1) || die "died creating GD image object?\n";
my $bg = $img->colorAllocate(5,5,5); # black'ish
my $colour = $img->colorAllocate(255,0,0); # red
$img->transparent($bg);
$img->setBrush($brush);
$img->setAntiAliased($colour);
$img->arc(256,256,150,150,0,360,gdBrushed); # draw a fat line 8 pixels wide
open(OF,'>','sample.png') || die "Cant write-open output\n";
binmode OF;
print OF $img->png;
close(OF);
Regards,
Andrew G Gray,
Unix Administration, Control Systems/SCADA
*************************************************************************************
This email message (including any file attachments transmitted with it) is for the sole use of the intended recipient(s) and may contain confidential and legally privileged information. Any unauthorised review, use, alteration, disclosure or distribution of this email (including any attachments) by an unintended recipient is prohibited. If you have received this email in error, please notify the sender by return email and destroy all copies of the original message. Any confidential or legal professional privilege is not waived or lost by any mistaken delivery of the email. SPARQ Solutions accepts no responsibility for the content of any email which is sent by an employee which is of a personal nature.
Sender Details:
SPARQ Solutions
PO Box 15760 City East, Brisbane QLD Australia 4002
1800 814 757
SPARQ Solutions policy is to not send unsolicited electronic messages. Suspected breaches of this policy can be reported by replying to this message including the original message and the word "UNSUBSCRIBE" in the subject.
*************************************************************************************