mirror of
https://github.com/vdm-io/tcpdf.git
synced 2024-11-25 13:57:33 +00:00
5.9.163 (2012-06-05)
- Method getGDgamma() was changed. - Rendering performances of PNG images with alpha channel were improved.
This commit is contained in:
parent
dc7dfc0ed9
commit
5bfef5c8cf
@ -1,3 +1,7 @@
|
||||
5.9.163 (2012-06-05)
|
||||
- Method getGDgamma() was changed.
|
||||
- Rendering performances of PNG images with alpha channel were improved.
|
||||
|
||||
5.9.162 (2012-05-11)
|
||||
- A bug related to long text on TD cells was fixed.
|
||||
|
||||
|
@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
|
||||
------------------------------------------------------------
|
||||
|
||||
Name: TCPDF
|
||||
Version: 5.9.162
|
||||
Release date: 2012-05-11
|
||||
Version: 5.9.163
|
||||
Release date: 2012-06-05
|
||||
Author: Nicola Asuni
|
||||
|
||||
Copyright (c) 2002-2012:
|
||||
|
43
tcpdf.php
43
tcpdf.php
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf.php
|
||||
// Version : 5.9.162
|
||||
// Version : 5.9.163
|
||||
// Begin : 2002-08-03
|
||||
// Last Update : 2012-05-11
|
||||
// Last Update : 2012-06-05
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com
|
||||
// License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3
|
||||
// -------------------------------------------------------------------
|
||||
@ -137,7 +137,7 @@
|
||||
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
|
||||
* @package com.tecnick.tcpdf
|
||||
* @author Nicola Asuni
|
||||
* @version 5.9.162
|
||||
* @version 5.9.163
|
||||
*/
|
||||
|
||||
// Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file.
|
||||
@ -149,7 +149,7 @@ require_once(dirname(__FILE__).'/config/tcpdf_config.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 5.9.162
|
||||
* @version 5.9.163
|
||||
* @author Nicola Asuni - info@tecnick.com
|
||||
*/
|
||||
class TCPDF {
|
||||
@ -160,7 +160,7 @@ class TCPDF {
|
||||
* Current TCPDF version.
|
||||
* @private
|
||||
*/
|
||||
private $tcpdf_version = '5.9.162';
|
||||
private $tcpdf_version = '5.9.163';
|
||||
|
||||
// Protected properties
|
||||
|
||||
@ -1879,6 +1879,13 @@ class TCPDF {
|
||||
*/
|
||||
protected $tcpdflink = true;
|
||||
|
||||
/**
|
||||
* Cache array for computed GD gamma values.
|
||||
* @protected
|
||||
* @since 5.9.1632 (2012-06-05)
|
||||
*/
|
||||
protected $gdgammacache = array();
|
||||
|
||||
//------------------------------------------------------------
|
||||
// METHODS
|
||||
//------------------------------------------------------------
|
||||
@ -8435,9 +8442,7 @@ class TCPDF {
|
||||
for ($xpx = 0; $xpx < $wpx; ++$xpx) {
|
||||
for ($ypx = 0; $ypx < $hpx; ++$ypx) {
|
||||
$color = imagecolorat($img, $xpx, $ypx);
|
||||
$alpha = ($color >> 24); // 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 = (((127 - $alpha) / 127) * 255); // GD alpha is only 7 bit (0 -> 127)
|
||||
$alpha = $this->getGDgamma($alpha); // correct gamma
|
||||
$alpha = $this->getGDgamma($color); // correct gamma
|
||||
imagesetpixel($imgalpha, $xpx, $ypx, $alpha);
|
||||
}
|
||||
}
|
||||
@ -8461,13 +8466,27 @@ class TCPDF {
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the gamma value to be used with GD library
|
||||
* @param $v (float) the gamma value to be corrected
|
||||
* Get the GD-corrected PNG gamma value from alpha color
|
||||
* @param $c (int) alpha color
|
||||
* @protected
|
||||
* @since 4.3.007 (2008-12-04)
|
||||
*/
|
||||
protected function getGDgamma($v) {
|
||||
return (pow(($v / 255), 2.2) * 255);
|
||||
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);
|
||||
// GD alpha is only 7 bit (0 -> 127)
|
||||
$alpha = (((127 - $alpha) / 127) * 255);
|
||||
// correct gamma
|
||||
$this->gdgammacache[$c] = (pow(($alpha / 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];
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user