32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-22 12:55:10 +00:00

6.0.033 (2013-09-23)

- Bug fix related to PNG image transparency using GD library.
This commit is contained in:
nicolaasuni 2013-09-23 16:26:07 +01:00
parent 940dc4b24a
commit 10c933f3b8
5 changed files with 18 additions and 15 deletions

View File

@ -1,3 +1,6 @@
6.0.033 (2013-09-23)
- Bug fix related to PNG image transparency using GD library.
6.0.032 (2013-09-23)
- Bug #838 "Fatal error when imagick cannot handle the image, even though GD is available and can" was fixed.

View File

@ -8,7 +8,7 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 6.0.032
Version: 6.0.033
Release date: 2013-09-23
Author: Nicola Asuni

View File

@ -1,6 +1,6 @@
{
"name": "tecnick.com/tcpdf",
"version": "6.0.032",
"version": "6.0.033",
"homepage": "http://www.tcpdf.org/",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents.",

View File

@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version.
* @private static
*/
private static $tcpdf_version = '6.0.032';
private static $tcpdf_version = '6.0.033';
/**
* String alias for total number of pages.

View File

@ -1,7 +1,7 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 6.0.032
// Version : 6.0.033
// Begin : 2002-08-03
// Last Update : 2013-09-23
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
@ -104,7 +104,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 6.0.032
* @version 6.0.033
*/
// TCPDF configuration
@ -128,7 +128,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php');
* TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br>
* @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions.
* @version 6.0.032
* @version 6.0.033
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF {
@ -7216,7 +7216,8 @@ class TCPDF {
for ($xpx = 0; $xpx < $wpx; ++$xpx) {
for ($ypx = 0; $ypx < $hpx; ++$ypx) {
$color = imagecolorat($img, $xpx, $ypx);
$alpha = $this->getGDgamma($color); // correct gamma
// get and correct gamma color
$alpha = $this->getGDgamma($img, $color);
imagesetpixel($imgalpha, $xpx, $ypx, $alpha);
}
}
@ -7251,26 +7252,25 @@ class TCPDF {
/**
* Get the GD-corrected PNG gamma value from alpha color
* @param $img (int) GD image Resource ID.
* @param $c (int) alpha color
* @protected
* @since 4.3.007 (2008-12-04)
*/
protected function getGDgamma($c) {
if (!isset($this->gdgammacache["'".$c."'"])) {
// shifts off the first 24 bits (where 8x3 are used for each color),
// and returns the remaining 7 allocated bits (commonly used for alpha)
$alpha = ($c >> 24);
protected function getGDgamma($img, $c) {
if (!isset($this->gdgammacache['#'.$c])) {
$colors = imagecolorsforindex($img, $c);
// GD alpha is only 7 bit (0 -> 127)
$alpha = (((127 - $alpha) / 127) * 255);
$this->gdgammacache['#'.$c] = (((127 - $colors['alpha']) / 127) * 255);
// correct gamma
$this->gdgammacache["'".$c."'"] = (pow(($alpha / 255), 2.2) * 255);
$this->gdgammacache['#'.$c] = (pow(($this->gdgammacache['#'.$c] / 255), 2.2) * 255);
// store the latest values on cache to improve performances
if (count($this->gdgammacache) > 8) {
// remove one element from the cache array
array_shift($this->gdgammacache);
}
}
return $this->gdgammacache["'".$c."'"];
return $this->gdgammacache['#'.$c];
}
/**