| 1664 | /************************************************************************/ |
| 1665 | |
| 1666 | static int allocColorCube(mapObj *map, gdImagePtr img, int *panColorCube) |
| 1667 | |
| 1668 | { |
| 1669 | int r, g, b; |
| 1670 | int i = 0; |
| 1671 | int nGreyColors = 32; |
| 1672 | int nSpaceGreyColors = 8; |
| 1673 | int iColors = 0; |
| 1674 | int red, green, blue; |
| 1675 | |
| 1676 | for( r = 0; r < RED_LEVELS; r++ ) |
| 1677 | { |
| 1678 | for( g = 0; g < GREEN_LEVELS; g++ ) |
| 1679 | { |
| 1680 | for( b = 0; b < BLUE_LEVELS; b++ ) |
| 1681 | { |
| 1682 | red = MS_MIN(255,r * (255 / (RED_LEVELS-1))); |
| 1683 | green = MS_MIN(255,g * (255 / (GREEN_LEVELS-1))); |
| 1684 | blue = MS_MIN(255,b * (255 / (BLUE_LEVELS-1))); |
| 1685 | |
| 1686 | panColorCube[RGB_LEVEL_INDEX(r,g,b)] = |
| 1687 | msAddColorGD(map, img, 1, red, green, blue ); |
| 1688 | iColors++; |
| 1689 | } |
| 1690 | } |
| 1691 | } |
| 1692 | /* -------------------------------------------------------------------- */ |
| 1693 | /* Adding 32 grey colors */ |
| 1694 | /* -------------------------------------------------------------------- */ |
| 1695 | for (i=0; i<nGreyColors; i++) |
| 1696 | { |
| 1697 | red = i*nSpaceGreyColors; |
| 1698 | green = red; |
| 1699 | blue = red; |
| 1700 | if(iColors < 256) |
| 1701 | { |
| 1702 | panColorCube[iColors] = msAddColorGD(map,img,1,red,green,blue); |
| 1703 | iColors++; |
| 1704 | } |
| 1705 | } |
| 1706 | return MS_SUCCESS; |
| 1707 | } |
| 1708 | |
| 1709 | /************************************************************************/ |
| 1710 | /* Dither24to8() */ |
no test coverage detected