1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
/*
Archtecture Graphics Size Definations
Used by osw-x.h and widget.h (and others) for low-level
graphics blitting.
*/
#ifndef GRAPHICS_H
#define GRAPHICS_H
#include <sys/types.h>
#include "../include/os.h"
/*
* Bytes per pixel sizes:
*/
#ifndef BYTES_PER_PIXEL8
# define BYTES_PER_PIXEL8 1
#endif
#ifndef BYTES_PER_PIXEL15
# define BYTES_PER_PIXEL15 2
#endif
#ifndef BYTES_PER_PIXEL16
# define BYTES_PER_PIXEL16 2
#endif
#ifndef BYTES_PER_PIXEL24
# define BYTES_PER_PIXEL24 4 /* Same as BYTES_PER_PIXEL32 */
#endif
#ifndef BYTES_PER_PIXEL32
# define BYTES_PER_PIXEL32 4
#endif
/*
* Lookup table system.
*/
extern u_int16_t gRLookup[256];
extern u_int16_t gGLookup[256];
extern u_int16_t gBLookup[256];
/*
* Bit packing macros:
*/
#ifndef PACK8TO8
//-KB-// #define PACK8TO8(r,g,b) (u_int8_t)((r>>5)<<5)+((g>>5)<<2)+(b>>6)
# define PACK8TO8(r,g,b) (u_int8_t)(((r)&0xE0)+(((g)&0xE0)>>3)+((b)>>6))
#endif
#ifndef PACK8TO15
//-KB-// #define PACK8TO15(r,g,b) (u_int16_t)((r>>3)<<10)+((g>>3)<<5)+(b>>3)
# define PACK8TO15(r,g,b) (u_int16_t)(gRLookup[(r)]+gGLookup[(g)]+gBLookup[(b)])
#endif
#ifndef PACK8TO16
//-KB-// #define PACK8TO16(r,g,b) (u_int16_t)((r>>3)<<11)+((g>>2)<<5)+(b>>3)
# define PACK8TO16(r,g,b) (u_int16_t)(gRLookup[(r)]+gGLookup[(g)]+gBLookup[(b)])
#endif
#ifndef PACK8TO32
//-KB-// #define PACK8TO32(a,r,g,b) (u_int32_t)((a<<24)|(r<<16)|(g<<8)|(b))
# define PACK8TO32(a,r,g,b) (u_int32_t)(((a)<<24)|((r)<<16)|((g)<<8)|(b))
#endif
#endif /* GRAPHICS_H */
|