From 16be6567b6dcd66dabf8b1e7f3a84ac358589c16 Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Mon, 10 Dec 2007 21:07:06 +0000 Subject: PictureFlow improvements by Jonas Hurrelmann: * Scrolling and fading album titles * Better support for small displays git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15908 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/bitmaps/native/SOURCES | 12 ++++- .../native/pictureflow_emptyslide.100x100x16.bmp | Bin 0 -> 30054 bytes .../native/pictureflow_emptyslide.50x50x16.bmp | Bin 0 -> 7654 bytes .../bitmaps/native/pictureflow_emptyslide.bmp | Bin 30054 -> 0 bytes .../bitmaps/native/pictureflow_logo.100x18x16.bmp | Bin 0 -> 5454 bytes .../bitmaps/native/pictureflow_logo.193x34x16.bmp | Bin 0 -> 19776 bytes apps/plugins/bitmaps/native/pictureflow_logo.bmp | Bin 19776 -> 0 bytes apps/plugins/pictureflow.c | 50 ++++++++++++++++----- 8 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 apps/plugins/bitmaps/native/pictureflow_emptyslide.100x100x16.bmp create mode 100644 apps/plugins/bitmaps/native/pictureflow_emptyslide.50x50x16.bmp delete mode 100644 apps/plugins/bitmaps/native/pictureflow_emptyslide.bmp create mode 100644 apps/plugins/bitmaps/native/pictureflow_logo.100x18x16.bmp create mode 100644 apps/plugins/bitmaps/native/pictureflow_logo.193x34x16.bmp delete mode 100644 apps/plugins/bitmaps/native/pictureflow_logo.bmp diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES index 5a36ec04a0..1acc903387 100644 --- a/apps/plugins/bitmaps/native/SOURCES +++ b/apps/plugins/bitmaps/native/SOURCES @@ -512,8 +512,16 @@ matrix_normal.bmp /* pictureflow */ #if defined(HAVE_LCD_COLOR) && defined(HAVE_ALBUMART) && defined(HAVE_TAGCACHE) -pictureflow_logo.bmp -pictureflow_emptyslide.bmp +#if (LCD_WIDTH < 200) + pictureflow_logo.100x18x16.bmp +#else + pictureflow_logo.193x34x16.bmp +#endif +#if (LCD_HEIGHT < 200 ) + pictureflow_emptyslide.50x50x16.bmp +#else + pictureflow_emptyslide.100x100x16.bmp +#endif #endif #endif /* HAVE_LCD_BITMAP */ diff --git a/apps/plugins/bitmaps/native/pictureflow_emptyslide.100x100x16.bmp b/apps/plugins/bitmaps/native/pictureflow_emptyslide.100x100x16.bmp new file mode 100644 index 0000000000..ff59a4f601 Binary files /dev/null and b/apps/plugins/bitmaps/native/pictureflow_emptyslide.100x100x16.bmp differ diff --git a/apps/plugins/bitmaps/native/pictureflow_emptyslide.50x50x16.bmp b/apps/plugins/bitmaps/native/pictureflow_emptyslide.50x50x16.bmp new file mode 100644 index 0000000000..dc7cd55c7b Binary files /dev/null and b/apps/plugins/bitmaps/native/pictureflow_emptyslide.50x50x16.bmp differ diff --git a/apps/plugins/bitmaps/native/pictureflow_emptyslide.bmp b/apps/plugins/bitmaps/native/pictureflow_emptyslide.bmp deleted file mode 100644 index ff59a4f601..0000000000 Binary files a/apps/plugins/bitmaps/native/pictureflow_emptyslide.bmp and /dev/null differ diff --git a/apps/plugins/bitmaps/native/pictureflow_logo.100x18x16.bmp b/apps/plugins/bitmaps/native/pictureflow_logo.100x18x16.bmp new file mode 100644 index 0000000000..815c5d68ca Binary files /dev/null and b/apps/plugins/bitmaps/native/pictureflow_logo.100x18x16.bmp differ diff --git a/apps/plugins/bitmaps/native/pictureflow_logo.193x34x16.bmp b/apps/plugins/bitmaps/native/pictureflow_logo.193x34x16.bmp new file mode 100644 index 0000000000..174c5f1d13 Binary files /dev/null and b/apps/plugins/bitmaps/native/pictureflow_logo.193x34x16.bmp differ diff --git a/apps/plugins/bitmaps/native/pictureflow_logo.bmp b/apps/plugins/bitmaps/native/pictureflow_logo.bmp deleted file mode 100644 index 174c5f1d13..0000000000 Binary files a/apps/plugins/bitmaps/native/pictureflow_logo.bmp and /dev/null differ diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index 9d4294ead1..49c56925ca 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c @@ -77,8 +77,13 @@ const struct button_mapping *plugin_contexts[] #define MAX_IMG_WIDTH LCD_WIDTH #define MAX_IMG_HEIGHT LCD_HEIGHT +#if (LCD_WIDTH < 200) +#define PREFERRED_IMG_WIDTH 50 +#define PREFERRED_IMG_HEIGHT 50 +#else #define PREFERRED_IMG_WIDTH 100 #define PREFERRED_IMG_HEIGHT 100 +#endif #define BUFFER_WIDTH LCD_WIDTH #define BUFFER_HEIGHT LCD_HEIGHT @@ -477,7 +482,6 @@ bool get_albumart_for_index_from_db(int slide_index, char *buf, int buflen) */ void draw_splashscreen(void) { - int txt_w, txt_h; struct screen* display = rb->screens[0]; rb->lcd_set_background(LCD_RGBPACK(0,0,0)); @@ -485,10 +489,7 @@ void draw_splashscreen(void) rb->lcd_clear_display(); const struct picture* logo = &(logos[display->screen_type]); - picture_draw(display, logo, (LCD_WIDTH - logo->width) / 2, 20); - - rb->lcd_getstringsize("Preparing album artwork", &txt_w, &txt_h); - rb->lcd_putsxy((LCD_WIDTH - txt_w)/2, 100, "Preparing album artwork"); + picture_draw(display, logo, (LCD_WIDTH - logo->width) / 2, 10); rb->lcd_update(); } @@ -499,11 +500,18 @@ void draw_splashscreen(void) */ void draw_progressbar(int step) { + int txt_w, txt_h; const int bar_height = 22; const int w = LCD_WIDTH - 20; - const int y = 130; const int x = 10; + rb->lcd_getstringsize("Preparing album artwork", &txt_w, &txt_h); + + int y = (LCD_HEIGHT - txt_h)/2; + + rb->lcd_putsxy((LCD_WIDTH - txt_w)/2, y, "Preparing album artwork"); + y += (txt_h + 5); + rb->lcd_set_foreground(LCD_RGBPACK(100,100,100)); rb->lcd_drawrect(x, y, w+2, bar_height); rb->lcd_set_foreground(LCD_RGBPACK(165, 231, 82)); @@ -1576,7 +1584,10 @@ int main(void) long update_interval = 100; int fps = 0; int albumtxt_w, albumtxt_h; - int ret; + int albumtxt_x = 0, albumtxt_y = 0; + int albumtxt_dir = -1; + int ret, c; + int prev_center_index = -1; while (true) { current_update = *rb->current_tick; @@ -1597,14 +1608,33 @@ int main(void) } albumtxt = get_album_name(center_index); - rb->lcd_set_foreground(LCD_RGBPACK(255, 255, 255)); + if ( animation_is_active ) { + c = ((slide_frame & 0xffff )/ 256); + if (step > 0) c = 255-c; + } + else c= 255; + rb->lcd_set_foreground(LCD_RGBPACK(c,c,c)); rb->lcd_getstringsize(albumtxt, &albumtxt_w, &albumtxt_h); - rb->lcd_putsxy((LCD_WIDTH - albumtxt_w) /2, LCD_HEIGHT-albumtxt_h-10, albumtxt); + if (center_index != prev_center_index) { + albumtxt_x = 0; + albumtxt_dir = -1; + albumtxt_y = LCD_HEIGHT-albumtxt_h-10; + prev_center_index = center_index; + } + if (albumtxt_w > LCD_WIDTH && ! animation_is_active ) { + rb->lcd_putsxy(albumtxt_x, albumtxt_y , albumtxt); + if ( albumtxt_w + albumtxt_x <= LCD_WIDTH ) albumtxt_dir = 1; + else if ( albumtxt_x >= 0 ) albumtxt_dir = -1; + albumtxt_x += albumtxt_dir; + } + else { + rb->lcd_putsxy((LCD_WIDTH - albumtxt_w) /2, albumtxt_y , albumtxt); + } rb->lcd_update(); rb->yield(); - button = pluginlib_getaction(rb, animation_is_active ? 0 : HZ/10, + button = pluginlib_getaction(rb, animation_is_active ? 0 : HZ/16, plugin_contexts, NB_ACTION_CONTEXTS); switch (button) { -- cgit v1.2.3