| @@ 146-158 (lines=13) @@ | ||
| 143 | $binary = $img->bmpData; |
|
| 144 | ||
| 145 | for ($i = $img->height - 1; $i >= 0; --$i) { |
|
| 146 | for ($j = 0; $j < $img->width; ++$j) { |
|
| 147 | //we translate the BGRA to aRGB ourselves, which is twice as fast |
|
| 148 | //as calling imagecolorallocatealpha |
|
| 149 | $alpha7 = ((~ord($binary[$offset + 3])) & 0xff) >> 1; |
|
| 150 | if ($alpha7 < 127) { |
|
| 151 | $col = ($alpha7 << 24) | |
|
| 152 | (ord($binary[$offset + 2]) << 16) | |
|
| 153 | (ord($binary[$offset + 1]) << 8) | |
|
| 154 | (ord($binary[$offset])); |
|
| 155 | imagesetpixel($gd, $j, $i, $col); |
|
| 156 | } |
|
| 157 | $offset += 4; |
|
| 158 | } |
|
| 159 | } |
|
| 160 | } |
|
| 161 | ||
| @@ 371-383 (lines=13) @@ | ||
| 368 | $binary = $metadata['data']; |
|
| 369 | ||
| 370 | for ($i = $metadata['Height'] - 1; $i >= 0; --$i) { |
|
| 371 | for ($j = 0; $j < $metadata['Width']; ++$j) { |
|
| 372 | //we translate the BGRA to aRGB ourselves, which is twice as fast |
|
| 373 | //as calling imagecolorallocatealpha |
|
| 374 | $alpha7 = ((~ord($binary[$offset + 3])) & 0xff) >> 1; |
|
| 375 | if ($alpha7 < 127) { |
|
| 376 | $col = ($alpha7 << 24) | |
|
| 377 | (ord($binary[$offset + 2]) << 16) | |
|
| 378 | (ord($binary[$offset + 1]) << 8) | |
|
| 379 | (ord($binary[$offset])); |
|
| 380 | imagesetpixel($im, $j, $i, $col); |
|
| 381 | } |
|
| 382 | $offset += 4; |
|
| 383 | } |
|
| 384 | } |
|
| 385 | } |
|
| 386 | ||