Translated using Weblate.
[gammu.git] / include / gammu-bitmap.h
blob516f1ed0fb171ebe77a89666616b6c3cc855d13f
1 /**
2 * \file gammu-bitmap.h
3 * \author Michal Čihař
5 * Bitmap data and functions.
6 */
7 #ifndef __gammu_bitmap_h
8 #define __gammu_bitmap_h
10 /**
11 * \defgroup Bitmap Bitmap
12 * Bitmaps manipulations.
15 #include <gammu-limits.h>
16 #include <gammu-types.h>
17 #include <gammu-error.h>
18 #include <gammu-statemachine.h>
19 #include <stdio.h>
21 /**
22 * Binary picture types.
24 * \ingroup Bitmap
26 typedef enum {
27 PICTURE_BMP = 1,
28 PICTURE_GIF,
29 PICTURE_JPG,
30 PICTURE_ICN,
31 PICTURE_PNG
32 } GSM_BinaryPicture_Types;
34 /**
35 * Binary picture data.
37 * \ingroup Bitmap
39 typedef struct {
40 GSM_BinaryPicture_Types Type;
41 unsigned char *Buffer;
42 size_t Length;
43 } GSM_BinaryPicture;
45 /**
46 * Enum to handle all possible bitmaps, which are not saved in various filesystems.
48 * \ingroup Bitmap
50 typedef enum {
51 GSM_None = 1,
52 /**
53 * ID of static file in filesystem displayed during startup
55 GSM_ColourStartupLogo_ID,
56 /**
57 * Static mono bitmap/ID of animated mono bitmap displayed during startup
59 GSM_StartupLogo,
60 /**
61 * ID of static file in filesystem displayed instead of operator name
63 GSM_ColourOperatorLogo_ID,
64 /**
65 * Mono bitmap displayed instead of operator name
67 GSM_OperatorLogo,
68 /**
69 * ID of static file in filesystem displayed as wallpaper
71 GSM_ColourWallPaper_ID,
72 /**
73 * Mono bitmap assigned to caller group
75 GSM_CallerGroupLogo,
76 /**
77 * Text displayed during startup, which can't be removed from phone menu
79 GSM_DealerNote_Text,
80 /**
81 * Text displayed during startup
83 GSM_WelcomeNote_Text,
84 /**
85 * Image defined in Smart Messaging specification
87 GSM_PictureImage,
88 /**
89 * Binary picture (BMP, GIF, etc.)
91 GSM_PictureBinary
92 } GSM_Bitmap_Types;
94 /**
95 * Structure for all possible bitmaps, which are not saved in various filesystems
97 * \ingroup Bitmap
99 typedef struct {
101 * For all: bitmap type
103 GSM_Bitmap_Types Type;
105 * For caller group logos: number of group
106 * For startup logos: number of animated bitmap
108 unsigned char Location;
110 * For dealer/welcome note text: text
111 * For caller group logo: name of group
112 * For picture images: text assigned to it
114 unsigned char Text[2 * (GSM_BITMAP_TEXT_LENGTH + 1)];
116 * For caller group logo: TRUE, when logo is enabled in group
118 gboolean BitmapEnabled;
120 * For caller group logo: TRUE, when group has default name
122 gboolean DefaultName;
124 * For caller group logo: TRUE, when group has default bitmap
126 gboolean DefaultBitmap;
128 * For caller group logo: TRUE, when group has default ringtone
130 gboolean DefaultRingtone;
132 * For caller group logo: ringtone ID. Phone model specific
134 unsigned char RingtoneID;
135 gboolean FileSystemRingtone;
137 * For caller group logo: picture ID. Phone model specific
139 int PictureID;
140 gboolean FileSystemPicture;
142 * For mono bitmaps: body of bitmap
144 unsigned char BitmapPoints[GSM_BITMAP_SIZE];
146 * For mono bitmaps: height specified in pixels
148 size_t BitmapHeight;
150 * For mono bitmaps: width specified in pixels
152 size_t BitmapWidth;
154 * For operator logos: Network operator code
156 char NetworkCode[7];
158 * For picture images: number of sender
160 unsigned char Sender[2 * (GSM_MAX_NUMBER_LENGTH + 1)];
162 * For colour bitmaps: ID
164 unsigned char ID;
166 * For binary pictures (GIF, BMP, etc.): frame and length
168 GSM_BinaryPicture BinaryPic;
170 * Bitmap name
172 unsigned char Name[2 * (GSM_BITMAP_TEXT_LENGTH + 1)];
173 } GSM_Bitmap;
176 * Structure to handle more than one bitmap
178 * \ingroup Bitmap
180 typedef struct {
182 * Number of bitmaps
184 unsigned char Number;
186 * All bitmaps
188 GSM_Bitmap Bitmap[GSM_MAX_MULTI_BITMAP];
189 } GSM_MultiBitmap;
192 * Gets bitmap from phone.
194 * \ingroup Bitmap
196 GSM_Error GSM_GetBitmap(GSM_StateMachine * s, GSM_Bitmap * Bitmap);
199 * Sets bitmap in phone.
201 * \ingroup Bitmap
203 GSM_Error GSM_SetBitmap(GSM_StateMachine * s, GSM_Bitmap * Bitmap);
206 * Prints bitmap to file descriptor.
208 * \param file Where to print.
209 * \param bitmap Bitmap to print.
211 * \ingroup Bitmap
213 void GSM_PrintBitmap(FILE * file, GSM_Bitmap * bitmap);
216 * Saves bitmap to file.
218 * \param FileName Where to save.
219 * \param bitmap Bitmap to save.
221 * \return Error code
223 * \ingroup Bitmap
225 GSM_Error GSM_SaveBitmapFile(char *FileName, GSM_MultiBitmap * bitmap);
228 * Reads bitmap from file.
230 * \param FileName Where to load from.
231 * \param bitmap Pointer where to load bitmap.
233 * \return Error code
235 * \ingroup Bitmap
237 GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap * bitmap);
240 * Checks whether point is set in bitmap.
242 * \param bmp Bitmap
243 * \param x Horizontal coordinate.
244 * \param y Vertical coordinate.
245 * \return True if point is set.
247 * \ingroup Bitmap
249 gboolean GSM_IsPointBitmap(GSM_Bitmap * bmp, int x, int y);
252 * Sets point in bitmap.
254 * \param bmp Bitmap
255 * \param x Horizontal coordinate.
256 * \param y Vertical coordinate.
258 * \ingroup Bitmap
260 void GSM_SetPointBitmap(GSM_Bitmap * bmp, int x, int y);
263 * Clears point in bitmap.
265 * \param bmp Bitmap
266 * \param x Horizontal coordinate.
267 * \param y Vertical coordinate.
269 * \ingroup Bitmap
271 void GSM_ClearPointBitmap(GSM_Bitmap * bmp, int x, int y);
274 * Clears bitmap.
276 * \param bmp Bitmap
278 * \ingroup Bitmap
280 void GSM_ClearBitmap(GSM_Bitmap * bmp);
283 * Gets phone screenshot.
285 * \param s State machine pointer.
286 * \param picture Structure which will hold data.
288 * \ingroup Bitmap
290 GSM_Error GSM_GetScreenshot(GSM_StateMachine *s, GSM_BinaryPicture *picture);
292 #endif
294 /* Editor configuration
295 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: