This should fix FS#10917, and also fix channel swapping i introduced in r23784. Lets...
[kugel-rb.git] / apps / plugins / png / png.h
blob4699e24e708ae47b881aecb6602051297609a7f4
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$id $
10 * Copyright (C) 2009 by Christophe Gouiran <bechris13250 -at- gmail -dot- com>
12 * Based on lodepng, a lightweight png decoder/encoder
13 * (c) 2005-2008 Lode Vandevenne
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ****************************************************************************/
26 LodePNG version 20080927
28 Copyright (c) 2005-2008 Lode Vandevenne
30 This software is provided 'as-is', without any express or implied
31 warranty. In no event will the authors be held liable for any damages
32 arising from the use of this software.
34 Permission is granted to anyone to use this software for any purpose,
35 including commercial applications, and to alter it and redistribute it
36 freely, subject to the following restrictions:
38 1. The origin of this software must not be misrepresented; you must not
39 claim that you wrote the original software. If you use this software
40 in a product, an acknowledgment in the product documentation would be
41 appreciated but is not required.
43 2. Altered source versions must be plainly marked as such, and must not be
44 misrepresented as being the original software.
46 3. This notice may not be removed or altered from any source
47 distribution.
51 The manual and changelog can be found in the header file "lodepng.h"
52 You are free to name this file lodepng.cpp or lodepng.c depending on your usage.
55 /* variable button definitions */
56 #if CONFIG_KEYPAD == RECORDER_PAD
57 #define PNG_ZOOM_IN BUTTON_PLAY
58 #define PNG_ZOOM_OUT BUTTON_ON
59 #define PNG_UP BUTTON_UP
60 #define PNG_DOWN BUTTON_DOWN
61 #define PNG_LEFT BUTTON_LEFT
62 #define PNG_RIGHT BUTTON_RIGHT
63 #define PNG_NEXT BUTTON_F3
64 #define PNG_PREVIOUS BUTTON_F2
65 #define PNG_MENU BUTTON_OFF
67 #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
68 #define PNG_ZOOM_IN BUTTON_SELECT
69 #define PNG_ZOOM_OUT BUTTON_ON
70 #define PNG_UP BUTTON_UP
71 #define PNG_DOWN BUTTON_DOWN
72 #define PNG_LEFT BUTTON_LEFT
73 #define PNG_RIGHT BUTTON_RIGHT
74 #define PNG_NEXT BUTTON_F3
75 #define PNG_PREVIOUS BUTTON_F2
76 #define PNG_MENU BUTTON_OFF
78 #elif CONFIG_KEYPAD == ONDIO_PAD
79 #define PNG_ZOOM_PRE BUTTON_MENU
80 #define PNG_ZOOM_IN (BUTTON_MENU | BUTTON_REL)
81 #define PNG_ZOOM_OUT (BUTTON_MENU | BUTTON_DOWN)
82 #define PNG_UP BUTTON_UP
83 #define PNG_DOWN BUTTON_DOWN
84 #define PNG_LEFT BUTTON_LEFT
85 #define PNG_RIGHT BUTTON_RIGHT
86 #define PNG_NEXT (BUTTON_MENU | BUTTON_RIGHT)
87 #define PNG_PREVIOUS (BUTTON_MENU | BUTTON_LEFT)
88 #define PNG_MENU BUTTON_OFF
90 #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
91 (CONFIG_KEYPAD == IRIVER_H300_PAD)
92 #define PNG_ZOOM_IN BUTTON_SELECT
93 #define PNG_ZOOM_OUT BUTTON_MODE
94 #define PNG_UP BUTTON_UP
95 #define PNG_DOWN BUTTON_DOWN
96 #define PNG_LEFT BUTTON_LEFT
97 #define PNG_RIGHT BUTTON_RIGHT
98 #if (CONFIG_KEYPAD == IRIVER_H100_PAD)
99 #define PNG_NEXT BUTTON_ON
100 #define PNG_PREVIOUS BUTTON_REC
101 #else
102 #define PNG_NEXT BUTTON_REC
103 #define PNG_PREVIOUS BUTTON_ON
104 #endif
105 #define PNG_MENU BUTTON_OFF
106 #define PNG_RC_MENU BUTTON_RC_STOP
108 #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
109 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
110 #define PNG_ZOOM_IN BUTTON_SCROLL_FWD
111 #define PNG_ZOOM_OUT BUTTON_SCROLL_BACK
112 #define PNG_UP BUTTON_MENU
113 #define PNG_DOWN BUTTON_PLAY
114 #define PNG_LEFT BUTTON_LEFT
115 #define PNG_RIGHT BUTTON_RIGHT
116 #define PNG_MENU (BUTTON_SELECT | BUTTON_MENU)
117 #define PNG_NEXT (BUTTON_SELECT | BUTTON_RIGHT)
118 #define PNG_PREVIOUS (BUTTON_SELECT | BUTTON_LEFT)
120 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
121 #define PNG_ZOOM_PRE BUTTON_SELECT
122 #define PNG_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
123 #define PNG_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
124 #define PNG_UP BUTTON_UP
125 #define PNG_DOWN BUTTON_DOWN
126 #define PNG_LEFT BUTTON_LEFT
127 #define PNG_RIGHT BUTTON_RIGHT
128 #define PNG_MENU BUTTON_POWER
129 #define PNG_NEXT BUTTON_PLAY
130 #define PNG_PREVIOUS BUTTON_REC
132 #elif CONFIG_KEYPAD == GIGABEAT_PAD
133 #define PNG_ZOOM_IN BUTTON_VOL_UP
134 #define PNG_ZOOM_OUT BUTTON_VOL_DOWN
135 #define PNG_UP BUTTON_UP
136 #define PNG_DOWN BUTTON_DOWN
137 #define PNG_LEFT BUTTON_LEFT
138 #define PNG_RIGHT BUTTON_RIGHT
139 #define PNG_MENU BUTTON_MENU
140 #define PNG_NEXT (BUTTON_A | BUTTON_RIGHT)
141 #define PNG_PREVIOUS (BUTTON_A | BUTTON_LEFT)
143 #elif CONFIG_KEYPAD == SANSA_E200_PAD
144 #define PNG_ZOOM_PRE BUTTON_SELECT
145 #define PNG_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
146 #define PNG_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
147 #define PNG_UP BUTTON_UP
148 #define PNG_DOWN BUTTON_DOWN
149 #define PNG_LEFT BUTTON_LEFT
150 #define PNG_RIGHT BUTTON_RIGHT
151 #define PNG_MENU BUTTON_POWER
152 #define PNG_SLIDE_SHOW BUTTON_REC
153 #define PNG_NEXT BUTTON_SCROLL_FWD
154 #define PNG_NEXT_REPEAT (BUTTON_SCROLL_FWD|BUTTON_REPEAT)
155 #define PNG_PREVIOUS BUTTON_SCROLL_BACK
156 #define PNG_PREVIOUS_REPEAT (BUTTON_SCROLL_BACK|BUTTON_REPEAT)
158 #elif CONFIG_KEYPAD == SANSA_FUZE_PAD
159 #define PNG_ZOOM_PRE BUTTON_SELECT
160 #define PNG_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
161 #define PNG_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
162 #define PNG_UP BUTTON_UP
163 #define PNG_DOWN BUTTON_DOWN
164 #define PNG_LEFT BUTTON_LEFT
165 #define PNG_RIGHT BUTTON_RIGHT
166 #define PNG_MENU (BUTTON_HOME|BUTTON_REPEAT)
167 #define PNG_NEXT BUTTON_SCROLL_FWD
168 #define PNG_NEXT_REPEAT (BUTTON_SCROLL_FWD|BUTTON_REPEAT)
169 #define PNG_PREVIOUS BUTTON_SCROLL_BACK
170 #define PNG_PREVIOUS_REPEAT (BUTTON_SCROLL_BACK|BUTTON_REPEAT)
172 #elif CONFIG_KEYPAD == SANSA_C200_PAD
173 #define PNG_ZOOM_PRE BUTTON_SELECT
174 #define PNG_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
175 #define PNG_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
176 #define PNG_UP BUTTON_UP
177 #define PNG_DOWN BUTTON_DOWN
178 #define PNG_LEFT BUTTON_LEFT
179 #define PNG_RIGHT BUTTON_RIGHT
180 #define PNG_MENU BUTTON_POWER
181 #define PNG_SLIDE_SHOW BUTTON_REC
182 #define PNG_NEXT BUTTON_VOL_UP
183 #define PNG_NEXT_REPEAT (BUTTON_VOL_UP|BUTTON_REPEAT)
184 #define PNG_PREVIOUS BUTTON_VOL_DOWN
185 #define PNG_PREVIOUS_REPEAT (BUTTON_VOL_DOWN|BUTTON_REPEAT)
187 #elif CONFIG_KEYPAD == SANSA_CLIP_PAD
188 #define PNG_ZOOM_PRE BUTTON_SELECT
189 #define PNG_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
190 #define PNG_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
191 #define PNG_UP BUTTON_UP
192 #define PNG_DOWN BUTTON_DOWN
193 #define PNG_LEFT BUTTON_LEFT
194 #define PNG_RIGHT BUTTON_RIGHT
195 #define PNG_MENU BUTTON_POWER
196 #define PNG_SLIDE_SHOW BUTTON_HOME
197 #define PNG_NEXT BUTTON_VOL_UP
198 #define PNG_NEXT_REPEAT (BUTTON_VOL_UP|BUTTON_REPEAT)
199 #define PNG_PREVIOUS BUTTON_VOL_DOWN
200 #define PNG_PREVIOUS_REPEAT (BUTTON_VOL_DOWN|BUTTON_REPEAT)
202 #elif CONFIG_KEYPAD == SANSA_M200_PAD
203 #define PNG_ZOOM_PRE BUTTON_SELECT
204 #define PNG_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
205 #define PNG_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
206 #define PNG_UP BUTTON_UP
207 #define PNG_DOWN BUTTON_DOWN
208 #define PNG_LEFT BUTTON_LEFT
209 #define PNG_RIGHT BUTTON_RIGHT
210 #define PNG_MENU BUTTON_POWER
211 #define PNG_SLIDE_SHOW (BUTTON_SELECT | BUTTON_UP)
212 #define PNG_NEXT BUTTON_VOL_UP
213 #define PNG_NEXT_REPEAT (BUTTON_VOL_UP|BUTTON_REPEAT)
214 #define PNG_PREVIOUS BUTTON_VOL_DOWN
215 #define PNG_PREVIOUS_REPEAT (BUTTON_VOL_DOWN|BUTTON_REPEAT)
217 #elif CONFIG_KEYPAD == IRIVER_H10_PAD
218 #define PNG_ZOOM_PRE BUTTON_PLAY
219 #define PNG_ZOOM_IN (BUTTON_PLAY | BUTTON_REL)
220 #define PNG_ZOOM_OUT (BUTTON_PLAY | BUTTON_REPEAT)
221 #define PNG_UP BUTTON_SCROLL_UP
222 #define PNG_DOWN BUTTON_SCROLL_DOWN
223 #define PNG_LEFT BUTTON_LEFT
224 #define PNG_RIGHT BUTTON_RIGHT
225 #define PNG_MENU BUTTON_POWER
226 #define PNG_NEXT BUTTON_FF
227 #define PNG_PREVIOUS BUTTON_REW
229 #elif CONFIG_KEYPAD == MROBE500_PAD
231 #elif CONFIG_KEYPAD == GIGABEAT_S_PAD
232 #define PNG_ZOOM_IN BUTTON_VOL_UP
233 #define PNG_ZOOM_OUT BUTTON_VOL_DOWN
234 #define PNG_UP BUTTON_UP
235 #define PNG_DOWN BUTTON_DOWN
236 #define PNG_LEFT BUTTON_LEFT
237 #define PNG_RIGHT BUTTON_RIGHT
238 #define PNG_MENU BUTTON_MENU
239 #define PNG_NEXT BUTTON_NEXT
240 #define PNG_PREVIOUS BUTTON_PREV
242 #elif CONFIG_KEYPAD == MROBE100_PAD
243 #define PNG_ZOOM_IN BUTTON_SELECT
244 #define PNG_ZOOM_OUT BUTTON_PLAY
245 #define PNG_UP BUTTON_UP
246 #define PNG_DOWN BUTTON_DOWN
247 #define PNG_LEFT BUTTON_LEFT
248 #define PNG_RIGHT BUTTON_RIGHT
249 #define PNG_MENU BUTTON_MENU
250 #define PNG_NEXT (BUTTON_DISPLAY | BUTTON_RIGHT)
251 #define PNG_PREVIOUS (BUTTON_DISPLAY | BUTTON_LEFT)
253 #elif CONFIG_KEYPAD == IAUDIO_M3_PAD
254 #define PNG_ZOOM_PRE BUTTON_RC_PLAY
255 #define PNG_ZOOM_IN (BUTTON_RC_PLAY|BUTTON_REL)
256 #define PNG_ZOOM_OUT (BUTTON_RC_PLAY|BUTTON_REPEAT)
257 #define PNG_UP BUTTON_RC_VOL_UP
258 #define PNG_DOWN BUTTON_RC_VOL_DOWN
259 #define PNG_LEFT BUTTON_RC_REW
260 #define PNG_RIGHT BUTTON_RC_FF
261 #define PNG_MENU BUTTON_RC_REC
262 #define PNG_NEXT BUTTON_RC_MODE
263 #define PNG_PREVIOUS BUTTON_RC_MENU
265 #elif CONFIG_KEYPAD == COWON_D2_PAD
267 #elif CONFIG_KEYPAD == IAUDIO67_PAD
268 #define PNG_ZOOM_IN BUTTON_VOLUP
269 #define PNG_ZOOM_OUT BUTTON_VOLDOWN
270 #define PNG_UP BUTTON_STOP
271 #define PNG_DOWN BUTTON_PLAY
272 #define PNG_LEFT BUTTON_LEFT
273 #define PNG_RIGHT BUTTON_RIGHT
274 #define PNG_MENU BUTTON_MENU
275 #define PNG_NEXT (BUTTON_PLAY|BUTTON_VOLUP)
276 #define PNG_PREVIOUS (BUTTON_PLAY|BUTTON_VOLDOWN)
278 #elif CONFIG_KEYPAD == CREATIVEZVM_PAD
280 #define PNG_ZOOM_IN BUTTON_PLAY
281 #define PNG_ZOOM_OUT BUTTON_CUSTOM
282 #define PNG_UP BUTTON_UP
283 #define PNG_DOWN BUTTON_DOWN
284 #define PNG_LEFT BUTTON_LEFT
285 #define PNG_RIGHT BUTTON_RIGHT
286 #define PNG_MENU BUTTON_MENU
287 #define PNG_NEXT BUTTON_SELECT
288 #define PNG_PREVIOUS BUTTON_BACK
290 #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
291 #define PNG_ZOOM_IN BUTTON_VOL_UP
292 #define PNG_ZOOM_OUT BUTTON_VOL_DOWN
293 #define PNG_UP BUTTON_UP
294 #define PNG_DOWN BUTTON_DOWN
295 #define PNG_LEFT BUTTON_LEFT
296 #define PNG_RIGHT BUTTON_RIGHT
297 #define PNG_MENU BUTTON_MENU
298 #define PNG_NEXT BUTTON_VIEW
299 #define PNG_PREVIOUS BUTTON_PLAYLIST
301 #elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
302 #define PNG_ZOOM_IN BUTTON_VOL_UP
303 #define PNG_ZOOM_OUT BUTTON_VOL_DOWN
304 #define PNG_UP BUTTON_UP
305 #define PNG_DOWN BUTTON_DOWN
306 #define PNG_LEFT BUTTON_PREV
307 #define PNG_RIGHT BUTTON_NEXT
308 #define PNG_MENU BUTTON_MENU
309 #define PNG_NEXT BUTTON_RIGHT
310 #define PNG_PREVIOUS BUTTON_LEFT
312 #elif CONFIG_KEYPAD == ONDAVX747_PAD
313 #define PNG_MENU BUTTON_POWER
314 #elif CONFIG_KEYPAD == ONDAVX777_PAD
315 #define PNG_MENU BUTTON_POWER
317 #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
318 #define PNG_ZOOM_IN (BUTTON_PLAY|BUTTON_UP)
319 #define PNG_ZOOM_OUT (BUTTON_PLAY|BUTTON_DOWN)
320 #define PNG_UP BUTTON_UP
321 #define PNG_DOWN BUTTON_DOWN
322 #define PNG_LEFT BUTTON_LEFT
323 #define PNG_RIGHT BUTTON_RIGHT
324 #define PNG_MENU BUTTON_PLAY
325 #define PNG_NEXT BUTTON_FFWD
326 #define PNG_PREVIOUS BUTTON_REW
328 #else
329 #error No keymap defined!
330 #endif
332 #ifdef HAVE_TOUCHSCREEN
333 #ifndef PNG_UP
334 #define PNG_UP BUTTON_TOPMIDDLE
335 #endif
336 #ifndef PNG_DOWN
337 #define PNG_DOWN BUTTON_BOTTOMMIDDLE
338 #endif
339 #ifndef PNG_LEFT
340 #define PNG_LEFT BUTTON_MIDLEFT
341 #endif
342 #ifndef PNG_RIGHT
343 #define PNG_RIGHT BUTTON_MIDRIGHT
344 #endif
345 #ifndef PNG_ZOOM_IN
346 #define PNG_ZOOM_IN BUTTON_TOPRIGHT
347 #endif
348 #ifndef PNG_ZOOM_OUT
349 #define PNG_ZOOM_OUT BUTTON_TOPLEFT
350 #endif
351 #ifndef PNG_MENU
352 #define PNG_MENU (BUTTON_CENTER|BUTTON_REL)
353 #endif
354 #ifndef PNG_NEXT
355 #define PNG_NEXT BUTTON_BOTTOMRIGHT
356 #endif
357 #ifndef PNG_PREVIOUS
358 #define PNG_PREVIOUS BUTTON_BOTTOMLEFT
359 #endif
360 #endif
362 #define PLUGIN_OTHER 10 /* State code for output with return. */
363 #define PLUGIN_ABORT 11
364 #define PLUGIN_OUTOFMEM 12
365 #define OUT_OF_MEMORY 9900
366 #define FILE_TOO_LARGE 9910