1 /* Goom Project 2 * Copyright (C) <2003> iOS-Software 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 #ifndef GRAPHIC_H 20 #define GRAPHIC_H 21 22 typedef unsigned int Uint; 23 24 typedef struct 25 { 26 unsigned short r, v, b; 27 } 28 Color; 29 30 extern const Color BLACK; 31 extern const Color WHITE; 32 extern const Color RED; 33 extern const Color BLUE; 34 extern const Color GREEN; 35 extern const Color YELLOW; 36 extern const Color ORANGE; 37 extern const Color VIOLET; 38 39 40 #ifdef COLOR_BGRA 41 42 #define B_CHANNEL 0xFF000000 43 #define G_CHANNEL 0x00FF0000 44 #define R_CHANNEL 0x0000FF00 45 #define A_CHANNEL 0x000000FF 46 #define B_OFFSET 24 47 #define G_OFFSET 16 48 #define R_OFFSET 8 49 #define A_OFFSET 0 50 51 typedef union _PIXEL { 52 struct { 53 unsigned char b; 54 unsigned char g; 55 unsigned char r; 56 unsigned char a; 57 } channels; 58 unsigned int val; 59 unsigned char cop[4]; 60 } Pixel; 61 62 #else 63 64 #define A_CHANNEL 0xFF000000 65 #define R_CHANNEL 0x00FF0000 66 #define G_CHANNEL 0x0000FF00 67 #define B_CHANNEL 0x000000FF 68 #define A_OFFSET 24 69 #define R_OFFSET 16 70 #define G_OFFSET 8 71 #define B_OFFSET 0 72 73 typedef union _PIXEL { 74 struct { 75 unsigned char a; 76 unsigned char r; 77 unsigned char g; 78 unsigned char b; 79 } channels; 80 unsigned int val; 81 unsigned char cop[4]; 82 } Pixel; 83 84 #endif /* COLOR_BGRA */ 85 86 /* 87 inline void setPixelRGB (Pixel * buffer, Uint x, Uint y, Color c); 88 inline void getPixelRGB (Pixel * buffer, Uint x, Uint y, Color * c); 89 */ 90 91 92 #endif /* GRAPHIC_H */ 93