include/SDL_pixels.h
changeset 6683 b1124b32b07d
parent 6138 4c64952a58fb
child 6885 700f1b25f77f
equal deleted inserted replaced
6682:a0cbe4e5a07a 6683:b1124b32b07d
   112 };
   112 };
   113 
   113 
   114 #define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
   114 #define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
   115 
   115 
   116 #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
   116 #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
   117     ((1 << 31) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
   117     ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
   118      ((bits) << 8) | ((bytes) << 0))
   118      ((bits) << 8) | ((bytes) << 0))
   119 
   119 
       
   120 #define SDL_PIXELFLAG(X)	(((X) >> 28) & 0x0F)
   120 #define SDL_PIXELTYPE(X)	(((X) >> 24) & 0x0F)
   121 #define SDL_PIXELTYPE(X)	(((X) >> 24) & 0x0F)
   121 #define SDL_PIXELORDER(X)	(((X) >> 20) & 0x0F)
   122 #define SDL_PIXELORDER(X)	(((X) >> 20) & 0x0F)
   122 #define SDL_PIXELLAYOUT(X)	(((X) >> 16) & 0x0F)
   123 #define SDL_PIXELLAYOUT(X)	(((X) >> 16) & 0x0F)
   123 #define SDL_BITSPERPIXEL(X)	(((X) >> 8) & 0xFF)
   124 #define SDL_BITSPERPIXEL(X)	(((X) >> 8) & 0xFF)
   124 #define SDL_BYTESPERPIXEL(X) \
   125 #define SDL_BYTESPERPIXEL(X) \
   138      ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
   139      ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
   139       (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
   140       (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
   140       (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
   141       (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
   141       (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))
   142       (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))
   142 
   143 
       
   144 /* The flag is set to 1 because 0x1? is not in the printable ASCII range */
   143 #define SDL_ISPIXELFORMAT_FOURCC(format)    \
   145 #define SDL_ISPIXELFORMAT_FOURCC(format)    \
   144     ((format) && !((format) & 0x80000000))
   146     ((format) && (SDL_PIXELFLAG(format) != 1))
   145 
   147 
   146 /* Note: If you modify this list, update SDL_GetPixelFormatName() */
   148 /* Note: If you modify this list, update SDL_GetPixelFormatName() */
   147 enum
   149 enum
   148 {
   150 {
   149     SDL_PIXELFORMAT_UNKNOWN,
   151     SDL_PIXELFORMAT_UNKNOWN,