Browse Source

use alpha in PNG export, since it is now required to get a correct PNG output image

tags/v0.99.beta17
Ben Wiley Sittler bsittler 16 years ago
parent
commit
839457cc5d
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      caca-php/examples/export.php

+ 3
- 1
caca-php/examples/export.php View File

@@ -26,6 +26,8 @@ define('WIDTH', 80);
define('HEIGHT', 32); define('HEIGHT', 32);


$pixels = imagecreatetruecolor(256, 256); $pixels = imagecreatetruecolor(256, 256);
imagealphablending($pixels, false);
imagesavealpha($pixels, true);


$exports = caca_get_export_list(); $exports = caca_get_export_list();


@@ -78,7 +80,7 @@ else
$r = $x; $r = $x;
$g = (255 - $y + $x) / 2; $g = (255 - $y + $x) / 2;
$b = $y * (255 - $x) / 256; $b = $y * (255 - $x) / 256;
imagesetpixel($pixels, $x, $y, imagecolorallocate($pixels, $r, $g, $b));
imagesetpixel($pixels, $x, $y, imagecolorallocatealpha($pixels, $r, $g, $b, 127));
} }
} }




Loading…
Cancel
Save