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