LBR04PixelAlpha((pixel)); \
}
-
-#if MAGICKCORE_QUANTUM_DEPTH > 8
-/* LBR08: Replicate top 8 bits */
-
-#define LBR08PacketRed(pixelpacket) \
- { \
- unsigned char lbr_bits=ScaleQuantumToChar((pixelpacket).red); \
- (pixelpacket).red=ScaleCharToQuantum((lbr_bits)); \
- }
-#define LBR08PacketGreen(pixelpacket) \
- { \
- unsigned char lbr_bits=ScaleQuantumToChar((pixelpacket).green); \
- (pixelpacket).green=ScaleCharToQuantum((lbr_bits)); \
- }
-#define LBR08PacketBlue(pixelpacket) \
- { \
- unsigned char lbr_bits=ScaleQuantumToChar((pixelpacket).blue); \
- (pixelpacket).blue=ScaleCharToQuantum((lbr_bits)); \
- }
-#define LBR08PacketAlpha(pixelpacket) \
- { \
- unsigned char lbr_bits=ScaleQuantumToChar((pixelpacket).alpha); \
- (pixelpacket).alpha=ScaleCharToQuantum((lbr_bits)); \
- }
-
-#define LBR08PacketRGB(pixelpacket) \
- { \
- LBR08PacketRed((pixelpacket)); \
- LBR08PacketGreen((pixelpacket)); \
- LBR08PacketBlue((pixelpacket)); \
- }
-
-#define LBR08PacketRGBO(pixelpacket) \
- { \
- LBR08PacketRGB((pixelpacket)); \
- LBR08PacketAlpha((pixelpacket)); \
- }
-
-#define LBR08PixelRed(pixel) \
- { \
- unsigned char lbr_bits= \
- ScaleQuantumToChar(GetPixelRed(image,(pixel))); \
- SetPixelRed(image,\
- ScaleCharToQuantum((lbr_bits)), (pixel)); \
- }
-#define LBR08PixelGreen(pixel) \
- { \
- unsigned char lbr_bits= \
- ScaleQuantumToChar(GetPixelGreen(image,(pixel))); \
- SetPixelGreen(image,\
- ScaleCharToQuantum((lbr_bits)), (pixel)); \
- }
-#define LBR08PixelBlue(pixel) \
- { \
- unsigned char lbr_bits= \
- ScaleQuantumToChar(GetPixelBlue(image,(pixel))); \
- SetPixelBlue(image,\
- ScaleCharToQuantum((lbr_bits)), (pixel)); \
- }
-#define LBR08PixelAlpha(pixel) \
- { \
- unsigned char lbr_bits= \
- ScaleQuantumToChar(GetPixelAlpha(image,(pixel))); \
- SetPixelAlpha(image,\
- ScaleCharToQuantum((lbr_bits)), (pixel)); \
- }
-
-#define LBR08PixelRGB(pixel) \
- { \
- LBR08PixelRed((pixel)); \
- LBR08PixelGreen((pixel)); \
- LBR08PixelBlue((pixel)); \
- }
-
-#define LBR08PixelRGBA(pixel) \
- { \
- LBR08PixelRGB((pixel)); \
- LBR08PixelAlpha((pixel)); \
- }
-#endif /* MAGICKCORE_QUANTUM_DEPTH > 8 */
-
-
-#if MAGICKCORE_QUANTUM_DEPTH > 16
-/* LBR16: Replicate top 16 bits */
-
-#define LBR16PacketRed(pixelpacket) \
- { \
- unsigned short lbr_bits=ScaleQuantumToShort((pixelpacket).red); \
- (pixelpacket).red=ScaleShortToQuantum((lbr_bits)); \
- }
-#define LBR16PacketGreen(pixelpacket) \
- { \
- unsigned short lbr_bits=ScaleQuantumToShort((pixelpacket).green); \
- (pixelpacket).green=ScaleShortToQuantum((lbr_bits)); \
- }
-#define LBR16PacketBlue(pixelpacket) \
- { \
- unsigned short lbr_bits=ScaleQuantumToShort((pixelpacket).blue); \
- (pixelpacket).blue=ScaleShortToQuantum((lbr_bits)); \
- }
-#define LBR16PacketAlpha(pixelpacket) \
- { \
- unsigned short lbr_bits=ScaleQuantumToShort((pixelpacket).alpha); \
- (pixelpacket).alpha=ScaleShortToQuantum((lbr_bits)); \
- }
-
-#define LBR16PacketRGB(pixelpacket) \
- { \
- LBR16PacketRed((pixelpacket)); \
- LBR16PacketGreen((pixelpacket)); \
- LBR16PacketBlue((pixelpacket)); \
- }
-
-#define LBR16PacketRGBO(pixelpacket) \
- { \
- LBR16PacketRGB((pixelpacket)); \
- LBR16PacketAlpha((pixelpacket)); \
- }
-
-#define LBR16PixelRed(pixel) \
- { \
- unsigned short lbr_bits= \
- ScaleQuantumToShort(GetPixelRed(image,(pixel))); \
- SetPixelRed(image,\
- ScaleShortToQuantum((lbr_bits)),(pixel)); \
- }
-#define LBR16PixelGreen(pixel) \
- { \
- unsigned short lbr_bits= \
- ScaleQuantumToShort(GetPixelGreen(image,(pixel))); \
- SetPixelGreen(image,\
- ScaleShortToQuantum((lbr_bits)),(pixel)); \
- }
-#define LBR16PixelBlue(pixel) \
- { \
- unsigned short lbr_bits= \
- ScaleQuantumToShort(GetPixelBlue(image,(pixel))); \
- SetPixelBlue(image,\
- ScaleShortToQuantum((lbr_bits)),(pixel)); \
- }
-#define LBR16PixelAlpha(pixel) \
- { \
- unsigned short lbr_bits= \
- ScaleQuantumToShort(GetPixelAlpha(image,(pixel))); \
- SetPixelAlpha(image,\
- ScaleShortToQuantum((lbr_bits)),(pixel)); \
- }
-
-#define LBR16PixelRGB(pixel) \
- { \
- LBR16PixelRed((pixel)); \
- LBR16PixelGreen((pixel)); \
- LBR16PixelBlue((pixel)); \
- }
-
-#define LBR16PixelRGBA(pixel) \
- { \
- LBR16PixelRGB((pixel)); \
- LBR16PixelAlpha((pixel)); \
- }
-#endif /* MAGICKCORE_QUANTUM_DEPTH > 16 */
-
/*
Establish thread safety.
setjmp/longjmp is claimed to be safe on these platforms:
register Quantum
*r;
- if (image->depth > 8)
- {
-#if MAGICKCORE_QUANTUM_DEPTH > 16
- /* Scale to 16-bit */
- LBR16PacketRGBO(image->background_color);
-
- for (y=0; y < (ssize_t) image->rows; y++)
- {
- r=GetAuthenticPixels(image,0,y,image->columns,1,exception);
-
- if (r == (Quantum *) NULL)
- break;
-
- for (x=0; x < (ssize_t) image->columns; x++)
- {
- LBR16PixelRGBA(r);
- r+=GetPixelChannels(image);
- }
-
- if (SyncAuthenticPixels(image,exception) == MagickFalse)
- break;
- }
-
- if (image->storage_class == PseudoClass && image->colormap != NULL)
- {
- for (i=0; i < (ssize_t) image->colors; i++)
- {
- LBR16PacketRGBO(image->colormap[i]);
- }
- }
-#endif /* MAGICKCORE_QUANTUM_DEPTH > 16 */
- }
-
- else if (image->depth > 4)
- {
-#if MAGICKCORE_QUANTUM_DEPTH > 8
- /* Scale to 8-bit */
- LBR08PacketRGBO(image->background_color);
-
- for (y=0; y < (ssize_t) image->rows; y++)
- {
- r=GetAuthenticPixels(image,0,y,image->columns,1,exception);
-
- if (r == (Quantum *) NULL)
- break;
-
- for (x=0; x < (ssize_t) image->columns; x++)
- {
- LBR08PixelRGBA(r);
- r+=GetPixelChannels(image);
- }
-
- if (SyncAuthenticPixels(image,exception) == MagickFalse)
- break;
- }
-
- if (image->storage_class == PseudoClass && image->colormap != NULL)
- {
- for (i=0; i < (ssize_t) image->colors; i++)
- {
- LBR08PacketRGBO(image->colormap[i]);
- }
- }
-#endif /* MAGICKCORE_QUANTUM_DEPTH > 8 */
- }
- else
- if (image->depth > 2)
+ if (image->depth > 2)
{
/* Scale to 4-bit */
LBR04PacketRGBO(image->background_color);