summaryrefslogtreecommitdiff
path: root/apps/plugins/clock/clock_draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/clock/clock_draw.c')
-rw-r--r--apps/plugins/clock/clock_draw.c103
1 files changed, 103 insertions, 0 deletions
diff --git a/apps/plugins/clock/clock_draw.c b/apps/plugins/clock/clock_draw.c
new file mode 100644
index 0000000000..daf19f7363
--- /dev/null
+++ b/apps/plugins/clock/clock_draw.c
@@ -0,0 +1,103 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: jackpot.c 14034 2007-07-28 05:42:55Z kevin $
9 *
10 * Copyright (C) 2007 Copyright Kévin Ferrare
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "clock.h"
21#include "clock_draw.h"
22#include "clock_draw_digital.h"
23#include "clock_draw_analog.h"
24#include "clock_draw_binary.h"
25#include "clock_settings.h"
26
27void black_background(struct screen* display){
28#if (LCD_DEPTH > 1) || (defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH > 1))
29 if(display->depth>1){
30 display->set_background(LCD_BLACK);
31 display->clear_display();
32 }else
33#endif
34 {
35 display->clear_display();
36 display->fillrect(0,0,display->width,display->height);
37 }
38}
39
40void white_background(struct screen* display){
41#if (LCD_DEPTH > 1) || (defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH > 1))
42 if(display->depth>1){
43#if defined(HAVE_LCD_COLOR)
44 if(display->is_color)/* restore to the bitmap's background */
45 display->set_background(LCD_RGBPACK(180,200,230));
46 else
47#endif
48 display->set_background(LCD_WHITE);
49 }
50#endif
51 display->clear_display();
52}
53
54bool skin_require_black_background(int mode, int skin){
55 return((mode==BINARY && skin==2) || (mode==DIGITAL && skin==1 ));
56}
57
58void skin_set_background(struct screen* display, int mode, int skin){
59 if(skin_require_black_background(mode, skin) )
60 black_background(display);
61 else
62 white_background(display);
63}
64
65void skin_restore_background(struct screen* display, int mode, int skin){
66 if(skin_require_black_background(mode, skin) )
67 white_background(display);
68}
69
70void clock_draw_set_colors(void){
71 int i;
72 FOR_NB_SCREENS(i)
73 skin_set_background(rb->screens[i],
74 clock_settings.mode,
75 clock_settings.skin[clock_settings.mode]);
76}
77
78void clock_draw_restore_colors(void){
79 int i;
80 FOR_NB_SCREENS(i){
81 skin_restore_background(rb->screens[i],
82 clock_settings.mode,
83 clock_settings.skin[clock_settings.mode]);
84 rb->screens[i]->update();
85 }
86}
87
88void clock_draw(struct screen* display, struct time* time,
89 struct counter* counter){
90 if(!clock_settings.general.show_counter)
91 counter=0;
92 int skin=clock_settings.skin[clock_settings.mode];
93 skin_set_background(display, clock_settings.mode, skin);
94 if(clock_settings.mode == ANALOG)
95 analog_clock_draw(display, time, &clock_settings, counter, skin);
96
97 else if(clock_settings.mode == DIGITAL)
98 digital_clock_draw(display, time, &clock_settings, counter, skin);
99
100 else if(clock_settings.mode == BINARY)
101 binary_clock_draw(display, time, skin);
102 display->update();
103}