1 /* Hey EMACS -*- linux-c -*- */
2 /* $Id: skinops.h 2031 2006-03-25 14:47:33Z roms $ */
3 
4 /*  TiEmu - a TI emulator
5  *  Copyright (c) 2000-2001, Thomas Corvazier, Romain Lievin
6  *  Copyright (c) 2001-2003, Romain Lievin
7  *  Copyright (c) 2003, Julien Blache
8  *  Copyright (c) 2004, Romain Li�vin
9  *  Copyright (c) 2005, Romain Li�vin
10  *
11  *  This program is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 2 of the License, or
14  *  (at your option) any later version.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the Free Software
23  *  Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
24  */
25 
26 /*
27    Most of these definitions and code comes from the JB's SkinEdit
28    which is based on TiEmu skin code. TiEmu skin code is also based on
29    VTi's skin code.
30 */
31 
32 #ifndef __SKINLOADER_H__
33 #define __SKINLOADER_H__
34 
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>
37 #endif
38 
39 #include <stdint.h>
40 #include <gdk-pixbuf/gdk-pixbuf.h>
41 
42 
43 /***************/
44 /* Definitions */
45 /***************/
46 
47 #define LCD_COLORTYPE_LOW    0
48 #define LCD_COLORTYPE_HIGH   1
49 #define LCD_COLORTYPE_CUSTOM 2
50 
51 #define LCD_HI_WHITE 0xb0ccae
52 #define LCD_HI_BLACK 0x8a6f53
53 
54 #define LCD_LOW_WHITE 0xcfe0cc
55 #define LCD_LOW_BLACK 0x222e31
56 
57 #define MAX_COLORS (256 - 16)		// we need to keep 16 colors for grayscales
58 #define SKIN_KEYS  80
59 
60 #define SKIN_TI73   "TI-73"
61 #define SKIN_TI82   "TI-82"
62 #define SKIN_TI83   "TI-83"
63 #define SKIN_TI83P  "TI-83+"
64 #define SKIN_TI85   "TI-85"
65 #define SKIN_TI86   "TI-86"
66 #define SKIN_TI89   "TI-89"
67 #define SKIN_TI92   "TI-92"
68 #define SKIN_TI92P  "TI-92+"
69 #define SKIN_V200   "V200PLT"
70 #define SKIN_TI89T  "TI-89TM"
71 
72 #define SKIN_TYPE_TIEMU   10
73 #define SKIN_TYPE_VTI     2
74 #define SKIN_TYPE_OLD_VTI 1
75 #define SKIN_TYPE_NEW     0
76 
77 #define ENDIANNESS_FLAG 0xfeedbabe
78 #define TIEMU_SKIN_ID   "TiEmu v2.00"
79 
80 /*********/
81 /* Types */
82 /*********/
83 
84 #if !defined(__WIN32__)	// already defined by Windows
85 typedef struct
86 {
87   uint32_t left;
88   uint32_t top;
89   uint32_t right;
90   uint32_t bottom;
91 } RECT;
92 #elif defined(__MINGW32__)
93 #include <windef.h>
94 #endif
95 
96 typedef struct
97 {
98   int type;
99 
100   GdkPixbuf *image;
101 
102   unsigned int width;
103   unsigned int height;
104 
105   GdkPixbuf *raw;	// raw jpeg image
106   double	s;		// scaling factor
107 
108   unsigned char calc[9];
109   uint32_t colortype;
110 
111   uint32_t lcd_black;
112   uint32_t lcd_white;
113 
114   unsigned char *name;
115   unsigned char *author;
116 
117   RECT lcd_pos;
118   RECT keys_pos[SKIN_KEYS];
119 
120   long	jpeg_offset;
121 
122 } SKIN_INFOS;
123 
124 extern SKIN_INFOS skin_infos;
125 
126 /*************/
127 /* Functions */
128 /*************/
129 
130 int skin_load(SKIN_INFOS *infos, const char *filename);
131 int skin_unload(SKIN_INFOS *infos);
132 
133 int skin_read_header(SKIN_INFOS *infos, const char* filename);
134 int skin_read_image (SKIN_INFOS *infos, const char* filename);
135 
136 
137 #endif
138