1 /*****************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// __ \_/ ___\| |/ /| __ \ / __ \ \/ /
5 * Jukebox | | ( (__) ) \___| ( | \_\ ( (__) ) (
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2008 Andrew Mahone
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
26 /* different graphics libraries */
30 #define MYLCD(fn) grey_ub_ ## fn
31 #define MYLCD_UPDATE()
32 #define MYXLCD(fn) grey_ub_ ## fn
33 #define CFORMAT &format_grey
35 #define MYLCD(fn) rb->lcd_ ## fn
36 #define MYLCD_UPDATE() rb->lcd_update();
37 #define MYXLCD(fn) xlcd_ ## fn
41 /* this is the plugin entry point */
42 enum plugin_status
plugin_start(const void* parameter
)
44 size_t plugin_buf_len
;
45 unsigned char * plugin_buf
=
46 (unsigned char *)rb
->plugin_get_buffer(&plugin_buf_len
);
47 static char filename
[MAX_PATH
];
54 if(!parameter
) return PLUGIN_ERROR
;
56 rb
->strcpy(filename
, parameter
);
60 if (!grey_init(plugin_buf
, plugin_buf_len
, GREY_ON_COP
,
61 LCD_WIDTH
, LCD_HEIGHT
, &greysize
))
63 rb
->splash(HZ
, "grey buf error");
66 plugin_buf
+= greysize
;
67 plugin_buf_len
-= greysize
;
70 ret
= rb
->read_jpeg_file(filename
, &bm
, plugin_buf_len
,
71 FORMAT_NATIVE
|FORMAT_RESIZE
|FORMAT_KEEP_ASPECT
,
77 grey_ub_gray_bitmap((fb_data
*)bm
.data
, (LCD_WIDTH
- bm
.width
) >> 1,
78 (LCD_HEIGHT
- bm
.height
) >> 1, bm
.width
, bm
.height
);
80 rb
->lcd_bitmap((fb_data
*)bm
.data
, (LCD_WIDTH
- bm
.width
) >> 1,
81 (LCD_HEIGHT
- bm
.height
) >> 1, bm
.width
, bm
.height
);
84 while (rb
->get_action(CONTEXT_STD
,1) != ACTION_STD_OK
) rb
->yield();