@@ 428-443 (lines=16) @@ | ||
425 | ||
426 | case 0: // BI_RGB |
|
427 | switch ($thisfile_bmp_header_raw['bits_per_pixel']) { |
|
428 | case 1: |
|
429 | for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { |
|
430 | for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) { |
|
431 | $paletteindexbyte = ord($BMPpixelData{$pixeldataoffset++}); |
|
432 | for ($i = 7; $i >= 0; $i--) { |
|
433 | $paletteindex = ($paletteindexbyte & (0x01 << $i)) >> $i; |
|
434 | $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; |
|
435 | $col++; |
|
436 | } |
|
437 | } |
|
438 | while (($pixeldataoffset % 4) != 0) { |
|
439 | // lines are padded to nearest DWORD |
|
440 | $pixeldataoffset++; |
|
441 | } |
|
442 | } |
|
443 | break; |
|
444 | ||
445 | case 4: |
|
446 | for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { |
|
@@ 445-460 (lines=16) @@ | ||
442 | } |
|
443 | break; |
|
444 | ||
445 | case 4: |
|
446 | for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { |
|
447 | for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) { |
|
448 | $paletteindexbyte = ord($BMPpixelData{$pixeldataoffset++}); |
|
449 | for ($i = 1; $i >= 0; $i--) { |
|
450 | $paletteindex = ($paletteindexbyte & (0x0F << (4 * $i))) >> (4 * $i); |
|
451 | $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; |
|
452 | $col++; |
|
453 | } |
|
454 | } |
|
455 | while (($pixeldataoffset % 4) != 0) { |
|
456 | // lines are padded to nearest DWORD |
|
457 | $pixeldataoffset++; |
|
458 | } |
|
459 | } |
|
460 | break; |
|
461 | ||
462 | case 8: |
|
463 | for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { |