Skip Menu |

This queue is for tickets about the GD CPAN distribution.

Report information
The Basics
Id: 123194
Status: resolved
Priority: 0/
Queue: GD

Owner: Nobody in particular
Requestors: andrewg.gray [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

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 [...]'" <bug-GD [...]>
From: "GRAY Andrew G (SPARQ)" <andrewg.gray [...]>
Download (untitled) / with headers
text/plain 2.6k
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 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. *************************************************************************************
Download image001.png
image/png 1.7k
Download image002.png
image/png 1.9k
Download (untitled) / with headers
text/plain 712b
Thanks. To me it's obvious looking at the docs: # Create a brush at an angle $diagonal_brush = new GD::Image(5,5); $white = $diagonal_brush->colorAllocate(255,255,255); $black = $diagonal_brush->colorAllocate(0,0,0); $diagonal_brush->transparent($white); $diagonal_brush->line(0,4,4,0,$black); # NE diagonal # Set the brush $myImage->setBrush($diagonal_brush); This is not a truecolor image, but palette. I've improved the docs: setBrush: You can draw lines and shapes using a brush pattern. Brushes are just palette, not TrueColor, images that you can create and manipulate in the usual way. When you draw with them, their contents are used for the color and shape of the lines. -- Reini Urban
The doc improvements will be in the next release, thanks. -- Reini Urban

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to