forked from Miroirs/x49gp
(WIP) cairo'fied annunciators
This commit is contained in:
parent
6148325b13
commit
0d884c930e
3 changed files with 237 additions and 301 deletions
|
@ -292,46 +292,41 @@ void x49gp_draw_rectangle( GdkPixmap* target, int x, int y, int w, int h, GdkCol
|
||||||
cairo_destroy( cr );
|
cairo_destroy( cr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void x49gp_draw_surface( GdkPixmap* target, cairo_surface_t* surface, int x, int y, int w, int h, GdkColor* color )
|
||||||
|
{
|
||||||
|
cairo_t* cr = gdk_cairo_create( target );
|
||||||
|
|
||||||
|
cairo_set_source_rgb( cr, color->red / 65535.0, color->green / 65535.0, color->blue / 65535.0 );
|
||||||
|
cairo_mask_surface( cr, surface, x, y );
|
||||||
|
|
||||||
|
cairo_destroy( cr );
|
||||||
|
}
|
||||||
|
|
||||||
void x49gp_lcd_update( x49gp_t* x49gp )
|
void x49gp_lcd_update( x49gp_t* x49gp )
|
||||||
{
|
{
|
||||||
x49gp_ui_t* ui = x49gp->ui;
|
x49gp_ui_t* ui = x49gp->ui;
|
||||||
s3c2410_lcd_t* lcd = x49gp->s3c2410_lcd;
|
s3c2410_lcd_t* lcd = x49gp->s3c2410_lcd;
|
||||||
// cairo_t* cr;
|
|
||||||
|
|
||||||
gdk_draw_drawable( ui->lcd_pixmap, gtk_widget_get_style( ui->window )->bg_gc[ 0 ], ui->bg_pixmap, ui->lcd_x_offset, ui->lcd_y_offset, 0,
|
|
||||||
0, ui->lcd_width, ui->lcd_height );
|
|
||||||
|
|
||||||
if ( lcd->lcdcon1 & 1 ) {
|
if ( lcd->lcdcon1 & 1 ) {
|
||||||
int color;
|
GdkColor color;
|
||||||
|
|
||||||
color = x49gp_get_pixel_color( lcd, 131, 1 );
|
color = ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, 131, 1 ) ];
|
||||||
gdk_gc_set_rgb_fg_color( ui->ann_left_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
x49gp_draw_surface( ui->lcd_pixmap, ui->ann_left_surface, 11, 0, 15, 12, &color );
|
||||||
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_left_gc, true, 11, 0, 15, 12 );
|
|
||||||
|
|
||||||
/* cr = gdk_cairo_create( ui->ann_left ); */
|
color = ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, 131, 2 ) ];
|
||||||
/* gdk_cairo_set_source_pixbuf( cr, ui->lcd_pixmap, 11, 0 ); */
|
x49gp_draw_surface( ui->lcd_pixmap, ui->ann_right_surface, 56, 0, 15, 12, &color );
|
||||||
/* cairo_paint( cr ); */
|
|
||||||
/* cairo_destroy( cr ); */
|
|
||||||
|
|
||||||
color = x49gp_get_pixel_color( lcd, 131, 2 );
|
color = ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, 131, 3 ) ];
|
||||||
gdk_gc_set_rgb_fg_color( ui->ann_right_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
x49gp_draw_surface( ui->lcd_pixmap, ui->ann_alpha_surface, 101, 0, 15, 12, &color );
|
||||||
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_right_gc, true, 56, 0, 15, 12 );
|
|
||||||
|
|
||||||
color = x49gp_get_pixel_color( lcd, 131, 3 );
|
color = ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, 131, 4 ) ];
|
||||||
gdk_gc_set_rgb_fg_color( ui->ann_alpha_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
x49gp_draw_surface( ui->lcd_pixmap, ui->ann_battery_surface, 146, 0, 15, 12, &color );
|
||||||
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_alpha_gc, true, 101, 0, 15, 12 );
|
|
||||||
|
|
||||||
color = x49gp_get_pixel_color( lcd, 131, 4 );
|
color = ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, 131, 5 ) ];
|
||||||
gdk_gc_set_rgb_fg_color( ui->ann_battery_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
x49gp_draw_surface( ui->lcd_pixmap, ui->ann_busy_surface, 191, 0, 15, 12, &color );
|
||||||
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_battery_gc, true, 146, 0, 15, 12 );
|
|
||||||
|
|
||||||
color = x49gp_get_pixel_color( lcd, 131, 5 );
|
color = ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, 131, 0 ) ];
|
||||||
gdk_gc_set_rgb_fg_color( ui->ann_busy_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
x49gp_draw_surface( ui->lcd_pixmap, ui->ann_io_surface, 236, 0, 15, 12, &color );
|
||||||
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_busy_gc, true, 191, 0, 15, 12 );
|
|
||||||
|
|
||||||
color = x49gp_get_pixel_color( lcd, 131, 0 );
|
|
||||||
gdk_gc_set_rgb_fg_color( ui->ann_io_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
|
||||||
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_io_gc, true, 236, 0, 15, 12 );
|
|
||||||
|
|
||||||
for ( int y = 0; y < ( ( ui->lcd_height - ui->lcd_annunciators_height ) / LCD_PIXEL_SCALE ); y++ )
|
for ( int y = 0; y < ( ( ui->lcd_height - ui->lcd_annunciators_height ) / LCD_PIXEL_SCALE ); y++ )
|
||||||
for ( int x = 0; x < ( ui->lcd_width / LCD_PIXEL_SCALE ); x++ )
|
for ( int x = 0; x < ( ui->lcd_width / LCD_PIXEL_SCALE ); x++ )
|
||||||
|
|
468
src/x49gpng/ui.c
468
src/x49gpng/ui.c
File diff suppressed because it is too large
Load diff
|
@ -118,19 +118,12 @@ struct __x49gp_ui_s__ {
|
||||||
GtkWidget* lcd_canvas;
|
GtkWidget* lcd_canvas;
|
||||||
GdkPixmap* lcd_pixmap;
|
GdkPixmap* lcd_pixmap;
|
||||||
|
|
||||||
GdkGC* ann_left_gc;
|
cairo_surface_t* ann_left_surface;
|
||||||
GdkGC* ann_right_gc;
|
cairo_surface_t* ann_right_surface;
|
||||||
GdkGC* ann_alpha_gc;
|
cairo_surface_t* ann_alpha_surface;
|
||||||
GdkGC* ann_battery_gc;
|
cairo_surface_t* ann_battery_surface;
|
||||||
GdkGC* ann_busy_gc;
|
cairo_surface_t* ann_busy_surface;
|
||||||
GdkGC* ann_io_gc;
|
cairo_surface_t* ann_io_surface;
|
||||||
|
|
||||||
GdkBitmap* ann_left;
|
|
||||||
GdkBitmap* ann_right;
|
|
||||||
GdkBitmap* ann_alpha;
|
|
||||||
GdkBitmap* ann_battery;
|
|
||||||
GdkBitmap* ann_busy;
|
|
||||||
GdkBitmap* ann_io;
|
|
||||||
|
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
|
|
Loading…
Reference in a new issue