diff options
author | Andrew Hannam <andrewh@inmarket.com.au> | 2013-04-03 13:51:43 +1000 |
---|---|---|
committer | Andrew Hannam <andrewh@inmarket.com.au> | 2013-04-03 13:51:43 +1000 |
commit | 64971549fd63d131f136a16913deaec3bdbcf2f3 (patch) | |
tree | cfd2698ff4ce1f207ba8f776d1c8fff73718c71f /demos/modules/gdisp | |
parent | b5dceeead44b0b825ee2ef7d2d7943bec8200e30 (diff) | |
download | uGFX-64971549fd63d131f136a16913deaec3bdbcf2f3.tar.gz uGFX-64971549fd63d131f136a16913deaec3bdbcf2f3.tar.bz2 uGFX-64971549fd63d131f136a16913deaec3bdbcf2f3.zip |
New GDISP image handling with demo
Images currently support Native and BMP (except RLE4,8 and 16 bit - due
to bugs)
Supports reading from Memory, BaseFileStream or real files (only on the
Win32 simulator).
Move gdisp_pictures demo to better refect its purpose.
Bug fixes for BMP RLE4,8 & 16 bit to come very soon
GIF support very soon.
Diffstat (limited to 'demos/modules/gdisp')
-rw-r--r-- | demos/modules/gdisp/gdisp_compiled_pictures/fruits1.h (renamed from demos/modules/gdisp/gdisp_pictures/fruits1.h) | 0 | ||||
-rw-r--r-- | demos/modules/gdisp/gdisp_compiled_pictures/fruits1.jpg (renamed from demos/modules/gdisp/gdisp_pictures/fruits1.jpg) | bin | 32727 -> 32727 bytes | |||
-rw-r--r-- | demos/modules/gdisp/gdisp_compiled_pictures/gfxconf.h (renamed from demos/modules/gdisp/gdisp_pictures/gfxconf.h) | 86 | ||||
-rw-r--r-- | demos/modules/gdisp/gdisp_compiled_pictures/main.c (renamed from demos/modules/gdisp/gdisp_pictures/main.c) | 52 | ||||
-rw-r--r-- | demos/modules/gdisp/gdisp_compiled_pictures/matterhorn.jpg (renamed from demos/modules/gdisp/gdisp_pictures/matterhorn.jpg) | bin | 25311 -> 25311 bytes | |||
-rw-r--r-- | demos/modules/gdisp/gdisp_compiled_pictures/matterhorn1.h (renamed from demos/modules/gdisp/gdisp_pictures/matterhorn1.h) | 0 | ||||
-rw-r--r-- | demos/modules/gdisp/gdisp_compiled_pictures/matterhorn2.h (renamed from demos/modules/gdisp/gdisp_pictures/matterhorn2.h) | 0 | ||||
-rw-r--r-- | demos/modules/gdisp/gdisp_compiled_pictures/matterhorn2.jpg (renamed from demos/modules/gdisp/gdisp_pictures/matterhorn2.jpg) | bin | 36151 -> 36151 bytes | |||
-rw-r--r-- | demos/modules/gdisp/gdisp_images/gfxconf.h | 56 | ||||
-rw-r--r-- | demos/modules/gdisp/gdisp_images/main.c | 52 | ||||
-rw-r--r-- | demos/modules/gdisp/gdisp_images/results_650x493.png | bin | 0 -> 32345 bytes | |||
-rw-r--r-- | demos/modules/gdisp/gdisp_images/test-pal8.bmp | bin | 0 -> 9254 bytes |
12 files changed, 177 insertions, 69 deletions
diff --git a/demos/modules/gdisp/gdisp_pictures/fruits1.h b/demos/modules/gdisp/gdisp_compiled_pictures/fruits1.h index c69ae17c..c69ae17c 100644 --- a/demos/modules/gdisp/gdisp_pictures/fruits1.h +++ b/demos/modules/gdisp/gdisp_compiled_pictures/fruits1.h diff --git a/demos/modules/gdisp/gdisp_pictures/fruits1.jpg b/demos/modules/gdisp/gdisp_compiled_pictures/fruits1.jpg Binary files differindex 06889647..06889647 100644 --- a/demos/modules/gdisp/gdisp_pictures/fruits1.jpg +++ b/demos/modules/gdisp/gdisp_compiled_pictures/fruits1.jpg diff --git a/demos/modules/gdisp/gdisp_pictures/gfxconf.h b/demos/modules/gdisp/gdisp_compiled_pictures/gfxconf.h index b60fd1cb..464c2675 100644 --- a/demos/modules/gdisp/gdisp_pictures/gfxconf.h +++ b/demos/modules/gdisp/gdisp_compiled_pictures/gfxconf.h @@ -1,43 +1,43 @@ -/**
- * This file has a different license to the rest of the GFX system.
- * You can copy, modify and distribute this file as you see fit.
- * You do not need to publish your source modifications to this file.
- * The only thing you are not permitted to do is to relicense it
- * under a different license.
- */
-
-#ifndef _GFXCONF_H
-#define _GFXCONF_H
-
-/* GFX sub-systems to turn on */
-#define GFX_USE_GDISP TRUE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
-
-/* Features for the GDISP sub-system. */
-#define GDISP_NEED_VALIDATION TRUE
-#define GDISP_NEED_CLIP TRUE
-#define GDISP_NEED_TEXT TRUE
-#define GDISP_NEED_CIRCLE TRUE
-#define GDISP_NEED_ELLIPSE FALSE
-#define GDISP_NEED_ARC FALSE
-#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD FALSE
-#define GDISP_NEED_CONTROL TRUE
-#define GDISP_NEED_MULTITHREAD TRUE
-#define GDISP_NEED_ASYNC FALSE
-#define GDISP_NEED_MSGAPI FALSE
-
-/* Builtin Fonts */
-#define GDISP_INCLUDE_FONT_SMALL FALSE
-#define GDISP_INCLUDE_FONT_LARGER FALSE
-#define GDISP_INCLUDE_FONT_UI1 FALSE
-#define GDISP_INCLUDE_FONT_UI2 TRUE
-#define GDISP_INCLUDE_FONT_LARGENUMBERS TRUE
-
-/* Features for the GINPUT sub-system. */
-#define GINPUT_NEED_MOUSE FALSE
-
-#endif /* _GFXCONF_H */
+/** + * This file has a different license to the rest of the GFX system. + * You can copy, modify and distribute this file as you see fit. + * You do not need to publish your source modifications to this file. + * The only thing you are not permitted to do is to relicense it + * under a different license. + */ + +#ifndef _GFXCONF_H +#define _GFXCONF_H + +/* GFX sub-systems to turn on */ +#define GFX_USE_GDISP TRUE +#define GFX_USE_GWIN FALSE +#define GFX_USE_GEVENT FALSE +#define GFX_USE_GTIMER FALSE +#define GFX_USE_GINPUT FALSE + +/* Features for the GDISP sub-system. */ +#define GDISP_NEED_VALIDATION TRUE +#define GDISP_NEED_CLIP TRUE +#define GDISP_NEED_TEXT TRUE +#define GDISP_NEED_CIRCLE TRUE +#define GDISP_NEED_ELLIPSE FALSE +#define GDISP_NEED_ARC FALSE +#define GDISP_NEED_SCROLL FALSE +#define GDISP_NEED_PIXELREAD FALSE +#define GDISP_NEED_CONTROL TRUE +#define GDISP_NEED_MULTITHREAD TRUE +#define GDISP_NEED_ASYNC FALSE +#define GDISP_NEED_MSGAPI FALSE + +/* Builtin Fonts */ +#define GDISP_INCLUDE_FONT_SMALL FALSE +#define GDISP_INCLUDE_FONT_LARGER FALSE +#define GDISP_INCLUDE_FONT_UI1 FALSE +#define GDISP_INCLUDE_FONT_UI2 TRUE +#define GDISP_INCLUDE_FONT_LARGENUMBERS TRUE + +/* Features for the GINPUT sub-system. */ +#define GINPUT_NEED_MOUSE FALSE + +#endif /* _GFXCONF_H */ diff --git a/demos/modules/gdisp/gdisp_pictures/main.c b/demos/modules/gdisp/gdisp_compiled_pictures/main.c index 9eae3319..b437619e 100644 --- a/demos/modules/gdisp/gdisp_pictures/main.c +++ b/demos/modules/gdisp/gdisp_compiled_pictures/main.c @@ -1,26 +1,26 @@ -#include "ch.h"
-#include "hal.h"
-#include "gfx.h"
-#include "matterhorn1.h"
-#include "matterhorn2.h"
-#include "fruits1.h"
-
-int main(void) {
- halInit();
- chSysInit();
-
- gdispInit();
- gdispSetOrientation(GDISP_ROTATE_90);
-
- while(1) {
- gdispBlitArea(0, 0, fruits1.width, fruits1.height, (const pixel_t*)fruits1.pixel_data);
- chThdSleepMilliseconds(3000);
-
- gdispBlitArea(0, 0, matterhorn1.width, matterhorn1.height, (const pixel_t*)matterhorn1.pixel_data);
- chThdSleepMilliseconds(3000);
-
- gdispBlitArea(0, 0, matterhorn2.width, matterhorn2.height, (const pixel_t*)matterhorn2.pixel_data);
- chThdSleepMilliseconds(3000);
- }
-}
-
+#include "ch.h" +#include "hal.h" +#include "gfx.h" +#include "matterhorn1.h" +#include "matterhorn2.h" +#include "fruits1.h" + +int main(void) { + halInit(); + chSysInit(); + + gdispInit(); + gdispSetOrientation(GDISP_ROTATE_90); + + while(1) { + gdispBlitArea(0, 0, fruits1.width, fruits1.height, (const pixel_t*)fruits1.pixel_data); + chThdSleepMilliseconds(3000); + + gdispBlitArea(0, 0, matterhorn1.width, matterhorn1.height, (const pixel_t*)matterhorn1.pixel_data); + chThdSleepMilliseconds(3000); + + gdispBlitArea(0, 0, matterhorn2.width, matterhorn2.height, (const pixel_t*)matterhorn2.pixel_data); + chThdSleepMilliseconds(3000); + } +} + diff --git a/demos/modules/gdisp/gdisp_pictures/matterhorn.jpg b/demos/modules/gdisp/gdisp_compiled_pictures/matterhorn.jpg Binary files differindex 4b303c3b..4b303c3b 100644 --- a/demos/modules/gdisp/gdisp_pictures/matterhorn.jpg +++ b/demos/modules/gdisp/gdisp_compiled_pictures/matterhorn.jpg diff --git a/demos/modules/gdisp/gdisp_pictures/matterhorn1.h b/demos/modules/gdisp/gdisp_compiled_pictures/matterhorn1.h index 4adc06e4..4adc06e4 100644 --- a/demos/modules/gdisp/gdisp_pictures/matterhorn1.h +++ b/demos/modules/gdisp/gdisp_compiled_pictures/matterhorn1.h diff --git a/demos/modules/gdisp/gdisp_pictures/matterhorn2.h b/demos/modules/gdisp/gdisp_compiled_pictures/matterhorn2.h index 25a5d9fa..25a5d9fa 100644 --- a/demos/modules/gdisp/gdisp_pictures/matterhorn2.h +++ b/demos/modules/gdisp/gdisp_compiled_pictures/matterhorn2.h diff --git a/demos/modules/gdisp/gdisp_pictures/matterhorn2.jpg b/demos/modules/gdisp/gdisp_compiled_pictures/matterhorn2.jpg Binary files differindex 4ea2bdac..4ea2bdac 100644 --- a/demos/modules/gdisp/gdisp_pictures/matterhorn2.jpg +++ b/demos/modules/gdisp/gdisp_compiled_pictures/matterhorn2.jpg diff --git a/demos/modules/gdisp/gdisp_images/gfxconf.h b/demos/modules/gdisp/gdisp_images/gfxconf.h new file mode 100644 index 00000000..77e70f36 --- /dev/null +++ b/demos/modules/gdisp/gdisp_images/gfxconf.h @@ -0,0 +1,56 @@ +/** + * This file has a different license to the rest of the GFX system. + * You can copy, modify and distribute this file as you see fit. + * You do not need to publish your source modifications to this file. + * The only thing you are not permitted to do is to relicense it + * under a different license. + */ + +#ifndef _GFXCONF_H +#define _GFXCONF_H + +/* GFX sub-systems to turn on */ +#define GFX_USE_GDISP TRUE +#define GFX_USE_GWIN FALSE +#define GFX_USE_GEVENT FALSE +#define GFX_USE_GTIMER FALSE +#define GFX_USE_GINPUT FALSE + +/* Features for the GDISP sub-system. */ +#define GDISP_NEED_VALIDATION TRUE +#define GDISP_NEED_CLIP TRUE +#define GDISP_NEED_TEXT FALSE +#define GDISP_NEED_CIRCLE FALSE +#define GDISP_NEED_ELLIPSE FALSE +#define GDISP_NEED_ARC FALSE +#define GDISP_NEED_CONVEX_POLYGON FALSE +#define GDISP_NEED_SCROLL FALSE +#define GDISP_NEED_PIXELREAD FALSE +#define GDISP_NEED_CONTROL FALSE +#define GDISP_NEED_IMAGE TRUE +#define GDISP_NEED_MULTITHREAD FALSE +#define GDISP_NEED_ASYNC FALSE +#define GDISP_NEED_MSGAPI FALSE + +/* Builtin Fonts */ +#define GDISP_INCLUDE_FONT_SMALL FALSE +#define GDISP_INCLUDE_FONT_LARGER FALSE +#define GDISP_INCLUDE_FONT_UI1 FALSE +#define GDISP_INCLUDE_FONT_UI2 FALSE +#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE + +/* GDISP image decoders */ +#define GDISP_NEED_IMAGE_NATIVE FALSE +#define GDISP_NEED_IMAGE_GIF FALSE +#define GDISP_NEED_IMAGE_BMP TRUE +#define GDISP_NEED_IMAGE_JPG FALSE +#define GDISP_NEED_IMAGE_PNG FALSE + +/* Features for the GWIN sub-system. */ +#define GWIN_NEED_BUTTON FALSE +#define GWIN_NEED_CONSOLE FALSE + +/* Features for the GINPUT sub-system. */ +#define GINPUT_NEED_MOUSE FALSE + +#endif /* _GFXCONF_H */ diff --git a/demos/modules/gdisp/gdisp_images/main.c b/demos/modules/gdisp/gdisp_images/main.c new file mode 100644 index 00000000..6ca5f640 --- /dev/null +++ b/demos/modules/gdisp/gdisp_images/main.c @@ -0,0 +1,52 @@ +/* + ChibiOS/GFX - Copyright (C) 2012, 2013 + Joel Bodenmann aka Tectu <joel@unormal.org> + + This file is part of ChibiOS/GFX. + + ChibiOS/GFX is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/GFX is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "ch.h" +#include "hal.h" +#include "gfx.h" + +static gdispImage myImage; + +int main(void) { + coord_t swidth, sheight; + + halInit(); // Initialise the Hardware + chSysInit(); // Initialize the OS + gdispInit(); // Initialize the display + + gdispClear(Black); + + // Get the display dimensions + swidth = gdispGetWidth(); + sheight = gdispGetHeight(); + + // Set up IO for our image + gdispImageSetSimulFileReader(&myImage, "test-pal8.bmp"); + + gdispImageOpen(&myImage); + gdispImageDraw(&myImage, 0, 0, swidth, sheight, 0, 0); + gdispImageClose(&myImage); + + while(1) { + chThdSleepMilliseconds(1000); + } + + return 0; +} diff --git a/demos/modules/gdisp/gdisp_images/results_650x493.png b/demos/modules/gdisp/gdisp_images/results_650x493.png Binary files differnew file mode 100644 index 00000000..66dcd6e3 --- /dev/null +++ b/demos/modules/gdisp/gdisp_images/results_650x493.png diff --git a/demos/modules/gdisp/gdisp_images/test-pal8.bmp b/demos/modules/gdisp/gdisp_images/test-pal8.bmp Binary files differnew file mode 100644 index 00000000..96b2f866 --- /dev/null +++ b/demos/modules/gdisp/gdisp_images/test-pal8.bmp |