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 ****************************************************************************/
24 #include "lib/mylcd.h"
27 /* different graphics libraries */
31 #define CFORMAT &format_grey
36 /* this is the plugin entry point */
37 enum plugin_status
plugin_start(const void* parameter
)
39 size_t plugin_buf_len
;
40 unsigned char * plugin_buf
=
41 (unsigned char *)rb
->plugin_get_buffer(&plugin_buf_len
);
42 static char filename
[MAX_PATH
];
49 if(!parameter
) return PLUGIN_ERROR
;
51 rb
->strcpy(filename
, parameter
);
55 if (!grey_init(plugin_buf
, plugin_buf_len
, GREY_ON_COP
,
56 LCD_WIDTH
, LCD_HEIGHT
, &greysize
))
58 rb
->splash(HZ
, "grey buf error");
61 plugin_buf
+= greysize
;
62 plugin_buf_len
-= greysize
;
65 ret
= rb
->read_jpeg_file(filename
, &bm
, plugin_buf_len
,
66 FORMAT_NATIVE
|FORMAT_RESIZE
|FORMAT_KEEP_ASPECT
,
72 grey_ub_gray_bitmap((const unsigned char *)bm
.data
, (LCD_WIDTH
- bm
.width
) >> 1,
73 (LCD_HEIGHT
- bm
.height
) >> 1, bm
.width
, bm
.height
);
75 rb
->lcd_bitmap((const fb_data
*)bm
.data
, (LCD_WIDTH
- bm
.width
) >> 1,
76 (LCD_HEIGHT
- bm
.height
) >> 1, bm
.width
, bm
.height
);
79 while (rb
->get_action(CONTEXT_STD
,1) != ACTION_STD_OK
) rb
->yield();