| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
#ifndef GRAPHICS_H |
| 16 |
#define GRAPHICS_H |
| 17 |
|
| 18 |
#include <sys/types.h> |
| 19 |
#include "../include/os.h" |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
#ifndef BYTES_PER_PIXEL8 |
| 26 |
# define BYTES_PER_PIXEL8 1 |
| 27 |
#endif |
| 28 |
|
| 29 |
#ifndef BYTES_PER_PIXEL15 |
| 30 |
# define BYTES_PER_PIXEL15 2 |
| 31 |
#endif |
| 32 |
|
| 33 |
#ifndef BYTES_PER_PIXEL16 |
| 34 |
# define BYTES_PER_PIXEL16 2 |
| 35 |
#endif |
| 36 |
|
| 37 |
#ifndef BYTES_PER_PIXEL24 |
| 38 |
# define BYTES_PER_PIXEL24 4 |
| 39 |
#endif |
| 40 |
|
| 41 |
#ifndef BYTES_PER_PIXEL32 |
| 42 |
# define BYTES_PER_PIXEL32 4 |
| 43 |
#endif |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
extern u_int16_t gRLookup[256]; |
| 50 |
extern u_int16_t gGLookup[256]; |
| 51 |
extern u_int16_t gBLookup[256]; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
#ifndef PACK8TO8 |
| 59 |
|
| 60 |
# define PACK8TO8(r,g,b) (u_int8_t)(((r)&0xE0)+(((g)&0xE0)>>3)+((b)>>6)) |
| 61 |
#endif |
| 62 |
|
| 63 |
#ifndef PACK8TO15 |
| 64 |
|
| 65 |
# define PACK8TO15(r,g,b) (u_int16_t)(gRLookup[(r)]+gGLookup[(g)]+gBLookup[(b)]) |
| 66 |
#endif |
| 67 |
|
| 68 |
#ifndef PACK8TO16 |
| 69 |
|
| 70 |
# define PACK8TO16(r,g,b) (u_int16_t)(gRLookup[(r)]+gGLookup[(g)]+gBLookup[(b)]) |
| 71 |
#endif |
| 72 |
|
| 73 |
#ifndef PACK8TO32 |
| 74 |
|
| 75 |
# define PACK8TO32(a,r,g,b) (u_int32_t)(((a)<<24)|((r)<<16)|((g)<<8)|(b)) |
| 76 |
#endif |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
#endif |