From 04daef17a1d180c68888c29d11a1b9087e9ace32 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 24 Jun 2005 22:33:21 +0000 Subject: First part of graphics api rework. Special functions, parameter handling, pixel functions, lines and filled primitives done for black & white core, main display. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6856 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/keyboard.c | 6 +++++- apps/recorder/peakmeter.c | 19 ++++++++++++++----- apps/recorder/widgets.c | 24 +++++++++++++++--------- 3 files changed, 34 insertions(+), 15 deletions(-) (limited to 'apps/recorder') diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index d974752b84..cfaf03c94a 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c @@ -195,8 +195,12 @@ int kbd_input(char* text, int buflen) #ifdef KBD_MODES if (!line_edit) #endif + { /* highlight the key that has focus */ - lcd_invertrect(font_w * x, 8 + font_h * y, font_w, font_h); + lcd_set_drawmode(DRMODE_COMPLEMENT); + lcd_fillrect(font_w * x, 8 + font_h * y, font_w, font_h); + lcd_set_drawmode(DRMODE_SOLID); + } status_draw(true); diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index 9baa9fdb35..8fffc9500d 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c @@ -835,7 +835,8 @@ unsigned short peak_meter_scale_value(unsigned short val, int meterwidth){ * width > 3 * @param int height - The height of the peak meter. height > 3 */ -void peak_meter_draw(int x, int y, int width, int height) { +void peak_meter_draw(int x, int y, int width, int height) +{ int left = 0, right = 0; static int last_left = 0, last_right = 0; int meterwidth = width - 3; @@ -930,7 +931,9 @@ void peak_meter_draw(int x, int y, int width, int height) { } /* draw the peak meter */ - lcd_clearrect(x, y, width, height); + lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); + lcd_fillrect(x, y, width, height); + lcd_set_drawmode(DRMODE_SOLID); /* draw left */ lcd_fillrect (x, y, left, height / 2 - 2 ); @@ -956,17 +959,20 @@ void peak_meter_draw(int x, int y, int width, int height) { lcd_drawline(x + meterwidth, y, x + meterwidth, y + height - 2); + lcd_set_drawmode(DRMODE_COMPLEMENT); /* draw dots for scale marks */ for (i = 0; i < db_scale_count; i++) { /* The x-coordinates of interesting scale mark points have been calculated before */ - lcd_invertpixel(db_scale_lcd_coord[i], y + height / 2 - 1); + lcd_drawpixel(db_scale_lcd_coord[i], y + height / 2 - 1); } + #ifdef HAVE_RECORDING if (trig_status != TRIG_OFF) { int start_trigx, stop_trigx, ycenter; + lcd_set_drawmode(DRMODE_SOLID); ycenter = y + height / 2; /* display threshold value */ start_trigx = x+peak_meter_scale_value(trig_strt_threshold,meterwidth); @@ -983,7 +989,8 @@ void peak_meter_draw(int x, int y, int width, int height) { #ifdef PM_DEBUG /* display a bar to show how many calls to peak_meter_peek have ocurred since the last display */ - lcd_invertrect(x, y, tmp, 3); + lcd_set_drawmode(DRMODE_COMPLEMENT); + lcd_fillrect(x, y, tmp, 3); if (tmp < PEEKS_PER_DRAW_SIZE) { peeks_per_redraw[tmp]++; @@ -996,12 +1003,14 @@ void peak_meter_draw(int x, int y, int width, int height) { /* display a bar to show how many ticks have passed since the last redraw */ - lcd_invertrect(x, y + height / 2, current_tick - pm_tick, 2); + lcd_fillrect(x, y + height / 2, current_tick - pm_tick, 2); pm_tick = current_tick; #endif last_left = left; last_right = right; + + lcd_set_drawmode(DRMODE_SOLID); } #ifdef HAVE_RECORDING diff --git a/apps/recorder/widgets.c b/apps/recorder/widgets.c index 5c608bcb6b..09daf87fd3 100644 --- a/apps/recorder/widgets.c +++ b/apps/recorder/widgets.c @@ -54,14 +54,16 @@ void scrollbar(int x, int y, int width, int height, int items, int min_shown, /* draw box */ lcd_drawrect(x, y, width, height); + lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); + /* clear edge pixels */ - lcd_clearpixel(x, y); - lcd_clearpixel((x + width - 1), y); - lcd_clearpixel(x, (y + height - 1)); - lcd_clearpixel((x + width - 1), (y + height - 1)); + lcd_drawpixel(x, y); + lcd_drawpixel((x + width - 1), y); + lcd_drawpixel(x, (y + height - 1)); + lcd_drawpixel((x + width - 1), (y + height - 1)); /* clear pixels in progress bar */ - lcd_clearrect(x + 1, y + 1, width - 2, height - 2); + lcd_fillrect(x + 1, y + 1, width - 2, height - 2); /* min should be min */ if(min_shown < max_shown) { @@ -111,6 +113,8 @@ void scrollbar(int x, int y, int width, int height, int items, int min_shown, size = 1; } + lcd_set_drawmode(DRMODE_SOLID); + if(orientation == VERTICAL) lcd_fillrect(x + 1, y + start + 1, width - 2, size); else @@ -133,11 +137,13 @@ void checkbox(int x, int y, int width, int height, bool checked) lcd_drawrect(x, y, width, height); if (checked){ - lcd_drawline(x + 2, y + 2, x + width - 2 - 1 , y + height - 2 - 1); - lcd_drawline(x + 2, y + height - 2 - 1, x + width - 2 - 1, y + 2); + lcd_drawline(x + 2, y + 2, x + width - 2 - 1 , y + height - 2 - 1); + lcd_drawline(x + 2, y + height - 2 - 1, x + width - 2 - 1, y + 2); } else { - /* be sure to clear box */ - lcd_clearrect(x + 1, y + 1, width - 2, height - 2); + /* be sure to clear box */ + lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); + lcd_fillrect(x + 1, y + 1, width - 2, height - 2); + lcd_set_drawmode(DRMODE_SOLID); } } -- cgit v1.2.3