Add antialiasing support
fgm - August 2, 2009 - 17:38
| Project: | Guitar |
| Version: | 6.x-1.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
It would be nice if the image background could be transparent instead of white (as a module setting). Since these are PNGs it doesn't seem to be complicated, would it ?

#1
Generating transparent PNGs is not difficult, but you lose anti-aliasing (see http://www.php.net/manual/en/function.imageantialias.php). However, if anyone comes up with a patch that does transparency with anti-aliasing I'd be happy to review it/commit it.
An alternative that I've been thinking about would be to replace the PNGs and render the diagrams with the HTML5 canvas element, or svg, but you would lose some cross-browser compatibility.
#2
Well, there does not seem to be any antialiasing in the current version anyway.
Here is a patch adding it, along with the removal of a E_STRICT warning about using $left without assigning it.
#3
Antialiasing is not always enabled (from php.net: This function is only available if PHP is compiled with the bundled version of the GD library.). It's typically not available on Ubuntu unless you compile PHP yourself, so I wrapped the call to
imageantialias($im, TRUE);with a check to make sure that the function is defined.Thank you!
#4
Automatically closed -- issue fixed for 2 weeks with no activity.