@@ 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 |
@@ 147-159 (lines=13) @@ | ||
144 | $binary = $img->bmpData; |
|
145 | ||
146 | for ($i = $img->height - 1; $i >= 0; --$i) { |
|
147 | for ($j = 0; $j < $img->width; ++$j) { |
|
148 | //we translate the BGRA to aRGB ourselves, which is twice as fast |
|
149 | //as calling imagecolorallocatealpha |
|
150 | $alpha7 = ((~ord($binary[$offset + 3])) & 0xff) >> 1; |
|
151 | if ($alpha7 < 127) { |
|
152 | $col = ($alpha7 << 24) | |
|
153 | (ord($binary[$offset + 2]) << 16) | |
|
154 | (ord($binary[$offset + 1]) << 8) | |
|
155 | (ord($binary[$offset])); |
|
156 | imagesetpixel($gd, $j, $i, $col); |
|
157 | } |
|
158 | $offset += 4; |
|
159 | } |
|
160 | } |
|
161 | } |
|
162 |