Programme de test pour lcd ITDB02
Fork of TFTLCD by
Revision 7:5c418fc1879f, committed 2012-12-04
- Comitter:
- ttodorov
- Date:
- Tue Dec 04 02:26:44 2012 +0000
- Parent:
- 6:059ca1648211
- Child:
- 8:7a4791dbb065
- Commit message:
- - fixed typification in bitmap drawing functions
Changed in this revision
lcd_base.cpp | Show annotated file Show diff for this revision Revisions of this file |
lcd_base.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/lcd_base.cpp Mon Dec 03 15:38:56 2012 +0000 +++ b/lcd_base.cpp Tue Dec 04 02:26:44 2012 +0000 @@ -346,7 +346,7 @@ RotateChar( *str++, x, y, i, fgColor, bgColor, deg ); } -void LCD::DrawBitmap( unsigned short x, unsigned short y, unsigned short sx, unsigned short sy, bitmap_t data, unsigned char scale ) +void LCD::DrawBitmap( unsigned short x, unsigned short y, unsigned short sx, unsigned short sy, const unsigned short* imgPixelData, unsigned char scale ) { int tx, ty, tc, tsx, tsy; @@ -357,7 +357,7 @@ { SetXY( x, y, x + sx - 1, y + sy - 1 ); for ( tc = 0; tc < ( sx * sy ); tc++ ) - WriteData( data[ tc ] ); + WriteData( imgPixelData[ tc ] ); } else { @@ -365,7 +365,7 @@ { SetXY( x, y + ty, x + sx - 1, y + ty ); for ( tx = sx; tx >= 0; tx-- ) - WriteData( data[ ( ty * sx ) + tx ] ); + WriteData( imgPixelData[ ( ty * sx ) + tx ] ); } } } @@ -379,7 +379,7 @@ for ( tsy = 0; tsy < scale; tsy++ ) for ( tx = 0; tx < sx; tx++ ) for ( tsx = 0; tsx < scale; tsx++ ) - WriteData( data[ ( ty * sx ) + tx ] ); + WriteData( imgPixelData[ ( ty * sx ) + tx ] ); } } else @@ -391,7 +391,7 @@ SetXY( x, y + ( ty * scale ) + tsy, x + ( ( sx * scale ) - 1 ), y + ( ty * scale ) + tsy ); for ( tx = sx; tx >= 0; tx-- ) for ( tsx = 0; tsx < scale; tsx++ ) - WriteData( data[ ( ty * sx ) + tx ] ); + WriteData( imgPixelData[ ( ty * sx ) + tx ] ); } } } @@ -399,14 +399,14 @@ Deactivate(); } -void LCD::DrawBitmap( unsigned short x, unsigned short y, unsigned short sx, unsigned short sy, bitmap_t data, unsigned short deg, unsigned short rox, unsigned short roy ) +void LCD::DrawBitmap( unsigned short x, unsigned short y, unsigned short sx, unsigned short sy, const unsigned short* imgPixelData, unsigned short deg, unsigned short rox, unsigned short roy ) { int tx, ty, newx, newy; double radian; radian = deg * 0.0175; if ( deg == 0 ) - DrawBitmap( x, y, sx, sy, data ); + DrawBitmap( x, y, sx, sy, imgPixelData ); else { Activate(); @@ -417,7 +417,7 @@ newy = y + roy + ( ( ( ty - roy ) * cos( radian ) ) + ( ( tx - rox ) * sin( radian ) ) ); SetXY( newx, newy, newx, newy ); - WriteData( data[ ( ty * sx ) + tx ] ); + WriteData( imgPixelData[ ( ty * sx ) + tx ] ); } Deactivate(); }
--- a/lcd_base.h Mon Dec 03 15:38:56 2012 +0000 +++ b/lcd_base.h Tue Dec 04 02:26:44 2012 +0000 @@ -100,11 +100,6 @@ unsigned char numchars; /**< Count of the available characters in the font. */ } font_metrics_t; -/** \typedef bitmap_t - * \brief Pointer to the start of a block of pixel data, describing a picture. - */ -typedef unsigned short* bitmap_t; - /** Base class for LCD implementations. * * All separate LCD controller implementations have to subclass this one. @@ -315,10 +310,10 @@ * \param y Vertical offset of the first pixel of the image * \param sx Width of the image. * \param sy Height of the image. - * \param data Image pixel array. + * \param imgPixelData Image pixel array. * \param scale A value of 1 will produce an image with its original size, while a different value will scale the image. */ - virtual void DrawBitmap( unsigned short x, unsigned short y, unsigned short sx, unsigned short sy, bitmap_t data, unsigned char scale = 1 ); + virtual void DrawBitmap( unsigned short x, unsigned short y, unsigned short sx, unsigned short sy, const unsigned short* imgPixelData, unsigned char scale = 1 ); /** Draw an image on the screen. * @@ -332,12 +327,12 @@ * \param y Vertical offset of the first pixel of the image * \param sx Width of the image. * \param sy Height of the image. - * \param data Image pixel array. + * \param imgPixelData Image pixel array. * \param deg Angle to rotate the image before painting on screen, in degrees. * \param rox * \param roy */ - virtual void DrawBitmap( unsigned short x, unsigned short y, unsigned short sx, unsigned short sy, bitmap_t data, unsigned short deg, unsigned short rox, unsigned short roy ); + virtual void DrawBitmap( unsigned short x, unsigned short y, unsigned short sx, unsigned short sy, const unsigned short* imgPixelData, unsigned short deg, unsigned short rox, unsigned short roy ); protected: /** Creates an instance of the class.