Making our interface more generic by taking a 32bits color value.
1.1 --- a/Display.h Sat Sep 06 18:39:49 2014 +0200
1.2 +++ b/Display.h Sun Sep 21 19:10:08 2014 +0200
1.3 @@ -75,7 +75,7 @@
1.4 public:
1.5 virtual int WidthInPixels() const=0;
1.6 virtual int HeightInPixels() const=0;
1.7 - virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn)=0;
1.8 + virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel)=0;
1.9 virtual void SetAllPixels(unsigned char aOn)=0;
1.10 virtual int FrameBufferSizeInBytes() const=0;
1.11 //virtual int BitBlit(unsigned char* aSrc, unsigned char aSrcWidth, unsigned char aSrcHeight, unsigned char aTargetX, unsigned char aTargetY) const=0;
2.1 --- a/FutabaGP1212A01.cpp Sat Sep 06 18:39:49 2014 +0200
2.2 +++ b/FutabaGP1212A01.cpp Sun Sep 21 19:10:08 2014 +0200
2.3 @@ -84,16 +84,19 @@
2.4
2.5 /**
2.6 */
2.7 -void GP1212A01A::SetPixel(unsigned char aX, unsigned char aY, bool aOn)
2.8 +void GP1212A01A::SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel)
2.9 {
2.10 //
2.11 //int byteOffset=(aX*HeightInPixels()+aY)/8;
2.12 //int bitOffset=(aX*HeightInPixels()+aY)%8;
2.13 //iNextFrame[byteOffset] |= ( (aOn?0x01:0x00) << bitOffset );
2.14
2.15 + //Pixel is on if any of the non-alpha component is not null
2.16 + bool on = (aPixel&0x00FFFFFF)!=0x00000000;
2.17 +
2.18 if (iOffScreenMode)
2.19 {
2.20 - if (aOn)
2.21 + if (on)
2.22 {
2.23 iFrameNext->SetBit(aX*HeightInPixels()+aY);
2.24 }
2.25 @@ -105,7 +108,7 @@
2.26 else
2.27 {
2.28 //Just specify a one pixel block
2.29 - SetPixelBlock(aX,aY,0x00,0x01,aOn);
2.30 + SetPixelBlock(aX,aY,0x00,0x01,on);
2.31 }
2.32 }
2.33
3.1 --- a/FutabaGP1212A01.h Sat Sep 06 18:39:49 2014 +0200
3.2 +++ b/FutabaGP1212A01.h Sun Sep 21 19:10:08 2014 +0200
3.3 @@ -25,7 +25,7 @@
3.4 //From DisplayBase
3.5 int Open();
3.6 //From FutabaGraphicVfd
3.7 - virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn);
3.8 + virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel);
3.9 virtual void SetAllPixels(unsigned char aPattern);
3.10 virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;}
3.11 //virtual void BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const;
4.1 --- a/FutabaGP1212A02.cpp Sat Sep 06 18:39:49 2014 +0200
4.2 +++ b/FutabaGP1212A02.cpp Sun Sep 21 19:10:08 2014 +0200
4.3 @@ -221,16 +221,19 @@
4.4
4.5 /**
4.6 */
4.7 -void GP1212A02A::SetPixel(unsigned char aX, unsigned char aY, bool aOn)
4.8 +void GP1212A02A::SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel)
4.9 {
4.10 //
4.11 //int byteOffset=(aX*HeightInPixels()+aY)/8;
4.12 //int bitOffset=(aX*HeightInPixels()+aY)%8;
4.13 //iNextFrame[byteOffset] |= ( (aOn?0x01:0x00) << bitOffset );
4.14
4.15 + //Pixel is on if any of the non-alpha component is not null
4.16 + bool on = (aPixel&0x00FFFFFF)!=0x00000000;
4.17 +
4.18 if (iOffScreenMode)
4.19 {
4.20 - if (aOn)
4.21 + if (on)
4.22 {
4.23 iFrameNext->SetBit(aX*HeightInPixels()+aY);
4.24 }
5.1 --- a/FutabaGP1212A02.h Sat Sep 06 18:39:49 2014 +0200
5.2 +++ b/FutabaGP1212A02.h Sun Sep 21 19:10:08 2014 +0200
5.3 @@ -35,7 +35,7 @@
5.4
5.5
5.6 //From GraphicDisplay
5.7 - virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn);
5.8 + virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel);
5.9 virtual void SetAllPixels(unsigned char aPattern);
5.10 virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;}
5.11 virtual void SetBrightness(int aBrightness);
6.1 --- a/MiniDisplay.cpp Sat Sep 06 18:39:49 2014 +0200
6.2 +++ b/MiniDisplay.cpp Sun Sep 21 19:10:08 2014 +0200
6.3 @@ -152,10 +152,10 @@
6.4 }
6.5
6.6 //-------------------------------------------------------------
6.7 -void MiniDisplaySetPixel(MiniDisplayDevice aDevice, int aX, int aY, int aValue)
6.8 +void MiniDisplaySetPixel(MiniDisplayDevice aDevice, int aX, int aY, unsigned int aPixel)
6.9 {
6.10 //aValue&=0x00FFFFFF; //Filter out alpha component
6.11 - return ((GraphicDisplay*)aDevice)->SetPixel(aX,aY,aValue);
6.12 + return ((GraphicDisplay*)aDevice)->SetPixel(aX,aY,aPixel);
6.13 }
6.14
6.15 //-------------------------------------------------------------
7.1 --- a/MiniDisplay.h Sat Sep 06 18:39:49 2014 +0200
7.2 +++ b/MiniDisplay.h Sun Sep 21 19:10:08 2014 +0200
7.3 @@ -107,7 +107,7 @@
7.4 @param [IN] Pixel Y coordinate.
7.5 @param [IN] Pixel value.
7.6 */
7.7 -extern "C" MDAPI void MiniDisplaySetPixel(MiniDisplayDevice aDevice, int aX, int aY, int aValue);
7.8 +extern "C" MDAPI void MiniDisplaySetPixel(MiniDisplayDevice aDevice, int aX, int aY, unsigned int aPixel);
7.9
7.10 //TODO: Have an API to specify pixel depth
7.11