/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id: helloworld.c 12807 2007-03-16 21:56:08Z amiconn $ * * Copyright (C) 2002 Björn Stenberg * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/#include "plugin.h"/* welcome to the example rockbox plugin *//* This macros must always be included. Should be placed at the top by convention, although the actual position doesn't matter */PLUGIN_HEADER/* here is a global api struct pointer. while not strictly necessary, it's nice not to have to pass the api pointer in all function calls in the plugin */void lcd_fillrect_alpha(struct plugin_api* rb, short int x, short int y, short int width, short int height, int color, unsigned char alpha);void lcd_fillrect_alpha(struct plugin_api* rb, short int x, short int y, short int width, short int height, int color, unsigned char alpha){ short int r1, g1, b1, r2, g2, b2; short int i, j; r2 = (color >> 16) & 255; g2 = (color >> 8) & 255; b2 = (color ) & 255; unsigned tmp = rb->lcd_get_foreground(); for(i=x;i<x+width;++i) { for(j=y;j<y+height;++j) { r1 = RGB_UNPACK_RED (rb->lcd_framebuffer[j*LCD_WIDTH+i]); g1 = RGB_UNPACK_GREEN(rb->lcd_framebuffer[j*LCD_WIDTH+i]); b1 = RGB_UNPACK_BLUE (rb->lcd_framebuffer[j*LCD_WIDTH+i]); r1 = ((255-alpha)*r1 + alpha*r2) / 255; g1 = ((255-alpha)*g1 + alpha*g2) / 255; b1 = ((255-alpha)*b1 + alpha*b2) / 255; rb->lcd_set_foreground(LCD_RGBPACK(r1, g1, b1)); rb->lcd_drawpixel(i, j); } } rb->lcd_set_foreground(tmp); return;}static struct plugin_api* rb;/* this is the plugin entry point */enum plugin_status plugin_start(struct plugin_api* api, void* parameter){ /* if you don't use the parameter, you can do like this to avoid the compiler warning about it */ (void)parameter; /* if you are using a global api pointer, don't forget to copy it! otherwise you will get lovely "I04: IllInstr" errors... :-) */ rb = api; rb->lcd_set_background(LCD_RGBPACK( 0, 0, 0)); unsigned char i = 240, j; while(i--) { rb->lcd_set_foreground(LCD_RGBPACK(i, 255, i)); rb->lcd_hline(0,320,i); // if(i>50 && i<150) // { // rb->lcd_set_foreground(LCD_RGBPACK(127+i/2, 255, 127+i/2)); // rb->lcd_hline(51,150,i); // } } unsigned char alpha = 127; int color = 0xFF9999; lcd_fillrect_alpha(rb, 51, 51, 98, 98, color, alpha); rb->lcd_set_foreground(LCD_RGBPACK(0, 0, 0)); rb->lcd_drawrect(50, 50, 100, 100); rb->lcd_update(); rb->sleep(HZ*10); return PLUGIN_OK;}