Base LCDPanel based, required for all LCDPanel drivers

Committer:
silviogissi
Date:
Fri Mar 09 00:55:25 2012 +0000
Revision:
0:3f345274c737
Child:
1:073d4f161f23

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
silviogissi 0:3f345274c737 1 /*
silviogissi 0:3f345274c737 2 Placeholder for Copyright notice, etc
silviogissi 0:3f345274c737 3
silviogissi 0:3f345274c737 4 Author: silviogissi
silviogissi 0:3f345274c737 5 */
silviogissi 0:3f345274c737 6 #include "LCDPanel.h"
silviogissi 0:3f345274c737 7
silviogissi 0:3f345274c737 8 LCDPanel::LCDPanel(unsigned int width, unsigned int height) : _ymax(height-1), _xmax(width-1)
silviogissi 0:3f345274c737 9 {
silviogissi 0:3f345274c737 10 }
silviogissi 0:3f345274c737 11
silviogissi 0:3f345274c737 12 // Default implementation, pixel by pixel
silviogissi 0:3f345274c737 13 void LCDPanel::fill(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned int color) {
silviogissi 0:3f345274c737 14 CsTransaction(*this);
silviogissi 0:3f345274c737 15 if (x1>x2) {unsigned int tmp=x1; x1=x2; x2=tmp;}
silviogissi 0:3f345274c737 16 if (y1>y2) {unsigned int tmp=y1; y1=y2; y2=tmp;}
silviogissi 0:3f345274c737 17 window(x1,y1,x2,y2);
silviogissi 0:3f345274c737 18 for(unsigned int i=0;i<(x2-x1)*(y2-y1);i++) { pixel(color); }
silviogissi 0:3f345274c737 19 }
silviogissi 0:3f345274c737 20
silviogissi 0:3f345274c737 21 // Default implementation, pixel by pixel
silviogissi 0:3f345274c737 22 void LCDPanel::fill(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, const unsigned int* color) {
silviogissi 0:3f345274c737 23 CsTransaction(*this);
silviogissi 0:3f345274c737 24 if (x1>x2) {unsigned int tmp=x1; x1=x2; x2=tmp;}
silviogissi 0:3f345274c737 25 if (y1>y2) {unsigned int tmp=y1; y1=y2; y2=tmp;}
silviogissi 0:3f345274c737 26 window(x1,y1,x2,y2);
silviogissi 0:3f345274c737 27 for(unsigned int i=0;i<(x2-x1)*(y2-y1);i++) { pixel(color[i]); }
silviogissi 0:3f345274c737 28 }
silviogissi 0:3f345274c737 29
silviogissi 0:3f345274c737 30 void LCDPanel::set_pixel(unsigned int x, unsigned int y, unsigned int color) {
silviogissi 0:3f345274c737 31 CsTransaction(*this);
silviogissi 0:3f345274c737 32 window(x,y,1,1);
silviogissi 0:3f345274c737 33 pixel(x,y,color);
silviogissi 0:3f345274c737 34 }