1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 Copyright Kévin Ferrare
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 ****************************************************************************/
21 #include "clock_draw_binary.h"
22 #include "clock_bitmap_strings.h"
23 #include "clock_bitmaps.h"
24 #include "lib/picture.h"
26 const struct picture
* binary_skin
[]={binary
,digits
,segments
};
28 void print_binary(char* buffer
, int number
, int nb_bits
){
32 for(i
=0; i
<nb_bits
; i
++){
33 if((number
& mask
) !=0)
34 buffer
[nb_bits
-i
-1]='1';
36 buffer
[nb_bits
-i
-1]='0';
41 void binary_clock_draw(struct screen
* display
, struct time
* time
, int skin
){
43 time
->hour
,time
->minute
,time
->second
47 const struct picture
* binary_bitmaps
= &(binary_skin
[skin
][display
->screen_type
]);
48 int y_offset
=(display
->getheight()-(binary_bitmaps
->height
*3))/2;
49 int x_offset
=(display
->getwidth()-(binary_bitmaps
->width
*6))/2;
51 print_binary(buffer
, lines_values
[i
], 6);
52 draw_string(display
, binary_bitmaps
, buffer
, x_offset
,
53 binary_bitmaps
->height
*i
+y_offset
);