add python font install

This commit is contained in:
hnwangkg-ezio 2019-04-01 13:53:33 +08:00
commit e7128c1c22
60 changed files with 836 additions and 1032 deletions

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -72,6 +72,7 @@
sudo apt-get install python-pip sudo apt-get install python-pip
sudo pip install RPi.GPIO sudo pip install RPi.GPIO
sudo pip install spidev sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:

View file

@ -72,6 +72,7 @@
sudo apt-get install python-pip sudo apt-get install python-pip
sudo pip install RPi.GPIO sudo pip install RPi.GPIO
sudo pip install spidev sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -52,6 +53,7 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPFILEHEADER bmpFileHeader; //Define a bmp file header structure BMPFILEHEADER bmpFileHeader; //Define a bmp file header structure
BMPINFOHEADER bmpInfoHeader; //Define a bmp info header structure BMPINFOHEADER bmpInfoHeader; //Define a bmp info header structure
// Binary file open // Binary file open
if((fp = fopen(path, "rb")) == NULL) { if((fp = fopen(path, "rb")) == NULL) {
Debug("Cann't open the file!\n"); Debug("Cann't open the file!\n");
@ -65,8 +67,7 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
printf("pixel = %d * %d\r\n", bmpInfoHeader.biWidth, bmpInfoHeader.biHeight); printf("pixel = %d * %d\r\n", bmpInfoHeader.biWidth, bmpInfoHeader.biHeight);
UWORD Image_Width_Byte = (bmpInfoHeader.biWidth % 8 == 0)? (bmpInfoHeader.biWidth / 8): (bmpInfoHeader.biWidth / 8 + 1); UWORD Image_Width_Byte = (bmpInfoHeader.biWidth % 8 == 0)? (bmpInfoHeader.biWidth / 8): (bmpInfoHeader.biWidth / 8 + 1);
UWORD Bmp_Width_Byte = (Image_Width_Byte % 4 == 0) ? Image_Width_Byte: ((Image_Width_Byte / 4 + 1) * 4); UWORD Bmp_Width_Byte = (Image_Width_Byte % 4 == 0) ? Image_Width_Byte: ((Image_Width_Byte / 4 + 1) * 4);
UBYTE Image[Image_Width_Byte * bmpInfoHeader.biHeight]; UBYTE Image[Image_Width_Byte * bmpInfoHeader.biHeight];
memset(Image, 0xFF, Image_Width_Byte * bmpInfoHeader.biHeight); memset(Image, 0xFF, Image_Width_Byte * bmpInfoHeader.biHeight);
@ -82,8 +83,10 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
UWORD Bcolor, Wcolor; UWORD Bcolor, Wcolor;
UWORD bmprgbquadsize = pow(2, bmpInfoHeader.biBitCount);// 2^1 = 2 UWORD bmprgbquadsize = pow(2, bmpInfoHeader.biBitCount);// 2^1 = 2
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;
@ -105,6 +108,7 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
} }
if(x < Image_Width_Byte) { //bmp if(x < Image_Width_Byte) { //bmp
Image[x + (bmpInfoHeader.biHeight - y - 1) * Image_Width_Byte] = Rdata; Image[x + (bmpInfoHeader.biHeight - y - 1) * Image_Width_Byte] = Rdata;
// printf("rdata = %d\r\n", Rdata);
} }
} }
} }

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -52,6 +53,7 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPFILEHEADER bmpFileHeader; //Define a bmp file header structure BMPFILEHEADER bmpFileHeader; //Define a bmp file header structure
BMPINFOHEADER bmpInfoHeader; //Define a bmp info header structure BMPINFOHEADER bmpInfoHeader; //Define a bmp info header structure
// Binary file open // Binary file open
if((fp = fopen(path, "rb")) == NULL) { if((fp = fopen(path, "rb")) == NULL) {
Debug("Cann't open the file!\n"); Debug("Cann't open the file!\n");
@ -65,8 +67,7 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
printf("pixel = %d * %d\r\n", bmpInfoHeader.biWidth, bmpInfoHeader.biHeight); printf("pixel = %d * %d\r\n", bmpInfoHeader.biWidth, bmpInfoHeader.biHeight);
UWORD Image_Width_Byte = (bmpInfoHeader.biWidth % 8 == 0)? (bmpInfoHeader.biWidth / 8): (bmpInfoHeader.biWidth / 8 + 1); UWORD Image_Width_Byte = (bmpInfoHeader.biWidth % 8 == 0)? (bmpInfoHeader.biWidth / 8): (bmpInfoHeader.biWidth / 8 + 1);
UWORD Bmp_Width_Byte = (Image_Width_Byte % 4 == 0) ? Image_Width_Byte: ((Image_Width_Byte / 4 + 1) * 4); UWORD Bmp_Width_Byte = (Image_Width_Byte % 4 == 0) ? Image_Width_Byte: ((Image_Width_Byte / 4 + 1) * 4);
UBYTE Image[Image_Width_Byte * bmpInfoHeader.biHeight]; UBYTE Image[Image_Width_Byte * bmpInfoHeader.biHeight];
memset(Image, 0xFF, Image_Width_Byte * bmpInfoHeader.biHeight); memset(Image, 0xFF, Image_Width_Byte * bmpInfoHeader.biHeight);
@ -82,8 +83,10 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
UWORD Bcolor, Wcolor; UWORD Bcolor, Wcolor;
UWORD bmprgbquadsize = pow(2, bmpInfoHeader.biBitCount);// 2^1 = 2 UWORD bmprgbquadsize = pow(2, bmpInfoHeader.biBitCount);// 2^1 = 2
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;
@ -105,6 +108,7 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
} }
if(x < Image_Width_Byte) { //bmp if(x < Image_Width_Byte) { //bmp
Image[x + (bmpInfoHeader.biHeight - y - 1) * Image_Width_Byte] = Rdata; Image[x + (bmpInfoHeader.biHeight - y - 1) * Image_Width_Byte] = Rdata;
// printf("rdata = %d\r\n", Rdata);
} }
} }
} }

View file

@ -1,130 +0,0 @@
/*****************************************************************************
* | File : GUI_BMPfile.c
* | Author : Waveshare team
* | Function : Hardware underlying interface
* | Info :
* Used to shield the underlying layers of each master
* and enhance portability
*----------------
* | This version: V2.0
* | Date : 2018-11-12
* | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "GUI_BMPfile.h"
#include "GUI_Paint.h"
#include "Debug.h"
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <stdlib.h> //exit()
#include <string.h> //memset()
#include <math.h> //memset()
UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
{
FILE *fp; //Define a file pointer
BMPFILEHEADER bmpFileHeader; //Define a bmp file header structure
BMPINFOHEADER bmpInfoHeader; //Define a bmp info header structure
// Binary file open
if((fp = fopen(path, "rb")) == NULL) {
Debug("Cann't open the file!\n");
exit(0);
}
// Set the file pointer from the beginning
fseek(fp, 0, SEEK_SET);
fread(&bmpFileHeader, sizeof(BMPFILEHEADER), 1, fp); //sizeof(BMPFILEHEADER) must be 14
fread(&bmpInfoHeader, sizeof(BMPINFOHEADER), 1, fp); //sizeof(BMPFILEHEADER) must be 50
printf("pixel = %d * %d\r\n", bmpInfoHeader.biWidth, bmpInfoHeader.biHeight);
UWORD Image_Width_Byte = (bmpInfoHeader.biWidth % 8 == 0)? (bmpInfoHeader.biWidth / 8): (bmpInfoHeader.biWidth / 8 + 1);
UWORD Bmp_Width_Byte = (Image_Width_Byte % 4 == 0) ? Image_Width_Byte: ((Image_Width_Byte / 4 + 1) * 4);
UBYTE Image[Image_Width_Byte * bmpInfoHeader.biHeight];
memset(Image, 0xFF, Image_Width_Byte * bmpInfoHeader.biHeight);
// Determine if it is a monochrome bitmap
int readbyte = bmpInfoHeader.biBitCount;
if(readbyte != 1){
Debug("the bmp Image is not a monochrome bitmap!\n");
exit(0);
}
// Determine black and white based on the palette
UWORD i;
UWORD Bcolor, Wcolor;
UWORD bmprgbquadsize = pow(2, bmpInfoHeader.biBitCount);// 2^1 = 2
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
}
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK;
Wcolor = WHITE;
}else{
Bcolor = WHITE;
Wcolor = BLACK;
}
// Read image data into the cache
UWORD x, y;
UBYTE Rdata;
fseek(fp, bmpFileHeader.bOffset, SEEK_SET);
for(y = 0; y < bmpInfoHeader.biHeight; y++) {//Total display column
for(x = 0; x < Bmp_Width_Byte; x++) {//Show a line in the line
if(fread((char *)&Rdata, 1, readbyte, fp) != readbyte) {
perror("get bmpdata:\r\n");
break;
}
if(x < Image_Width_Byte) { //bmp
Image[x + (bmpInfoHeader.biHeight - y - 1) * Image_Width_Byte] = Rdata;
// printf("rdata = %d\r\n", Rdata);
}
}
}
fclose(fp);
// Refresh the image to the display buffer based on the displayed orientation
UBYTE color, temp;
for(y = 0; y < bmpInfoHeader.biHeight; y++){
for(x = 0; x < bmpInfoHeader.biWidth; x++){
if(x > Paint.Width || y > Paint.Height){
break;
}
temp = Image[(x / 8) + (y * Image_Width_Byte)];
color = (((temp << (x%8)) & 0x80) == 0x80) ?Bcolor:Wcolor;
Paint_SetPixel(Xstart + x, Ystart + y, color);
}
}
return 0;
}

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] =》 &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -1,130 +0,0 @@
/*****************************************************************************
* | File : GUI_BMPfile.c
* | Author : Waveshare team
* | Function : Hardware underlying interface
* | Info :
* Used to shield the underlying layers of each master
* and enhance portability
*----------------
* | This version: V2.0
* | Date : 2018-11-12
* | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "GUI_BMPfile.h"
#include "GUI_Paint.h"
#include "Debug.h"
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <stdlib.h> //exit()
#include <string.h> //memset()
#include <math.h> //memset()
UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
{
FILE *fp; //Define a file pointer
BMPFILEHEADER bmpFileHeader; //Define a bmp file header structure
BMPINFOHEADER bmpInfoHeader; //Define a bmp info header structure
// Binary file open
if((fp = fopen(path, "rb")) == NULL) {
Debug("Cann't open the file!\n");
exit(0);
}
// Set the file pointer from the beginning
fseek(fp, 0, SEEK_SET);
fread(&bmpFileHeader, sizeof(BMPFILEHEADER), 1, fp); //sizeof(BMPFILEHEADER) must be 14
fread(&bmpInfoHeader, sizeof(BMPINFOHEADER), 1, fp); //sizeof(BMPFILEHEADER) must be 50
printf("pixel = %d * %d\r\n", bmpInfoHeader.biWidth, bmpInfoHeader.biHeight);
UWORD Image_Width_Byte = (bmpInfoHeader.biWidth % 8 == 0)? (bmpInfoHeader.biWidth / 8): (bmpInfoHeader.biWidth / 8 + 1);
UWORD Bmp_Width_Byte = (Image_Width_Byte % 4 == 0) ? Image_Width_Byte: ((Image_Width_Byte / 4 + 1) * 4);
UBYTE Image[Image_Width_Byte * bmpInfoHeader.biHeight];
memset(Image, 0xFF, Image_Width_Byte * bmpInfoHeader.biHeight);
// Determine if it is a monochrome bitmap
int readbyte = bmpInfoHeader.biBitCount;
if(readbyte != 1){
Debug("the bmp Image is not a monochrome bitmap!\n");
exit(0);
}
// Determine black and white based on the palette
UWORD i;
UWORD Bcolor, Wcolor;
UWORD bmprgbquadsize = pow(2, bmpInfoHeader.biBitCount);// 2^1 = 2
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
}
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK;
Wcolor = WHITE;
}else{
Bcolor = WHITE;
Wcolor = BLACK;
}
// Read image data into the cache
UWORD x, y;
UBYTE Rdata;
fseek(fp, bmpFileHeader.bOffset, SEEK_SET);
for(y = 0; y < bmpInfoHeader.biHeight; y++) {//Total display column
for(x = 0; x < Bmp_Width_Byte; x++) {//Show a line in the line
if(fread((char *)&Rdata, 1, readbyte, fp) != readbyte) {
perror("get bmpdata:\r\n");
break;
}
if(x < Image_Width_Byte) { //bmp
Image[x + (bmpInfoHeader.biHeight - y - 1) * Image_Width_Byte] = Rdata;
// printf("rdata = %d\r\n", Rdata);
}
}
}
fclose(fp);
// Refresh the image to the display buffer based on the displayed orientation
UBYTE color, temp;
for(y = 0; y < bmpInfoHeader.biHeight; y++){
for(x = 0; x < bmpInfoHeader.biWidth; x++){
if(x > Paint.Width || y > Paint.Height){
break;
}
temp = Image[(x / 8) + (y * Image_Width_Byte)];
color = (((temp << (x%8)) & 0x80) == 0x80) ?Bcolor:Wcolor;
Paint_SetPixel(Xstart + x, Ystart + y, color);
}
}
return 0;
}

View file

@ -1,130 +0,0 @@
/*****************************************************************************
* | File : GUI_BMPfile.c
* | Author : Waveshare team
* | Function : Hardware underlying interface
* | Info :
* Used to shield the underlying layers of each master
* and enhance portability
*----------------
* | This version: V2.0
* | Date : 2018-11-12
* | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "GUI_BMPfile.h"
#include "GUI_Paint.h"
#include "Debug.h"
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <stdlib.h> //exit()
#include <string.h> //memset()
#include <math.h> //memset()
UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
{
FILE *fp; //Define a file pointer
BMPFILEHEADER bmpFileHeader; //Define a bmp file header structure
BMPINFOHEADER bmpInfoHeader; //Define a bmp info header structure
// Binary file open
if((fp = fopen(path, "rb")) == NULL) {
Debug("Cann't open the file!\n");
exit(0);
}
// Set the file pointer from the beginning
fseek(fp, 0, SEEK_SET);
fread(&bmpFileHeader, sizeof(BMPFILEHEADER), 1, fp); //sizeof(BMPFILEHEADER) must be 14
fread(&bmpInfoHeader, sizeof(BMPINFOHEADER), 1, fp); //sizeof(BMPFILEHEADER) must be 50
printf("pixel = %d * %d\r\n", bmpInfoHeader.biWidth, bmpInfoHeader.biHeight);
UWORD Image_Width_Byte = (bmpInfoHeader.biWidth % 8 == 0)? (bmpInfoHeader.biWidth / 8): (bmpInfoHeader.biWidth / 8 + 1);
UWORD Bmp_Width_Byte = (Image_Width_Byte % 4 == 0) ? Image_Width_Byte: ((Image_Width_Byte / 4 + 1) * 4);
UBYTE Image[Image_Width_Byte * bmpInfoHeader.biHeight];
memset(Image, 0xFF, Image_Width_Byte * bmpInfoHeader.biHeight);
// Determine if it is a monochrome bitmap
int readbyte = bmpInfoHeader.biBitCount;
if(readbyte != 1){
Debug("the bmp Image is not a monochrome bitmap!\n");
exit(0);
}
// Determine black and white based on the palette
UWORD i;
UWORD Bcolor, Wcolor;
UWORD bmprgbquadsize = pow(2, bmpInfoHeader.biBitCount);// 2^1 = 2
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
}
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK;
Wcolor = WHITE;
}else{
Bcolor = WHITE;
Wcolor = BLACK;
}
// Read image data into the cache
UWORD x, y;
UBYTE Rdata;
fseek(fp, bmpFileHeader.bOffset, SEEK_SET);
for(y = 0; y < bmpInfoHeader.biHeight; y++) {//Total display column
for(x = 0; x < Bmp_Width_Byte; x++) {//Show a line in the line
if(fread((char *)&Rdata, 1, readbyte, fp) != readbyte) {
perror("get bmpdata:\r\n");
break;
}
if(x < Image_Width_Byte) { //bmp
Image[x + (bmpInfoHeader.biHeight - y - 1) * Image_Width_Byte] = Rdata;
// printf("rdata = %d\r\n", Rdata);
}
}
}
fclose(fp);
// Refresh the image to the display buffer based on the displayed orientation
UBYTE color, temp;
for(y = 0; y < bmpInfoHeader.biHeight; y++){
for(x = 0; x < bmpInfoHeader.biWidth; x++){
if(x > Paint.Width || y > Paint.Height){
break;
}
temp = Image[(x / 8) + (y * Image_Width_Byte)];
color = (((temp << (x%8)) & 0x80) == 0x80) ?Bcolor:Wcolor;
Paint_SetPixel(Xstart + x, Ystart + y, color);
}
}
return 0;
}

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -69,6 +69,11 @@
== How to use == == How to use ==
1, install the Python libraries. 1, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
2, change the current directory to where the demo files located. 2, change the current directory to where the demo files located.
3, run the demo with: 3, run the demo with:
python main.py python main.py

View file

@ -6,33 +6,34 @@
* Used to shield the underlying layers of each master * Used to shield the underlying layers of each master
* and enhance portability * and enhance portability
*---------------- *----------------
* | This version: V2.0 * | This version: V2.1
* | Date : 2018-11-12 * | Date : 2019-03-29
* | Info : * | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c * 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp() * 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally, * Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than * and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed. * the actual display range, it will not be displayed.
# * 3.fix:line87 &bmprgbquad[i * 4] = &bmprgbquad[i]
# Permission is hereby granted, free of charge, to any person obtaining a copy *
# of this software and associated documnetation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
# in the Software without restriction, including without limitation the rights * of this software and associated documnetation files (the "Software"), to deal
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# furished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
# * furished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in *
# all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
*
******************************************************************************/ ******************************************************************************/
#include "GUI_BMPfile.h" #include "GUI_BMPfile.h"
@ -84,7 +85,8 @@ UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
for(i = 0; i < bmprgbquadsize; i++){ for(i = 0; i < bmprgbquadsize; i++){
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp); // fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
fread(&bmprgbquad[i], sizeof(BMPRGBQUAD), 1, fp);
} }
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){ if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff){
Bcolor = BLACK; Bcolor = BLACK;