Demo of low res colour vga video for stm32f3 discovery board
Dependencies: STM32F3-Discovery-minimal
Fork of Space_Invaders_Demo by
gdi.h@17:833f1b69e11d, 2019-04-03 (annotated)
- Committer:
- MartinJohnson
- Date:
- Wed Apr 03 22:05:56 2019 +0000
- Revision:
- 17:833f1b69e11d
- Parent:
- 14:3035b3271395
update library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MartinJohnson | 0:404dae88af71 | 1 | /*************************************************************************** |
MartinJohnson | 0:404dae88af71 | 2 | * STM32 VGA demo |
MartinJohnson | 0:404dae88af71 | 3 | * Copyright (C) 2012 Artekit Italy |
MartinJohnson | 0:404dae88af71 | 4 | * http://www.artekit.eu |
MartinJohnson | 0:404dae88af71 | 5 | * Written by Ruben H. Meleca |
MartinJohnson | 0:404dae88af71 | 6 | |
MartinJohnson | 0:404dae88af71 | 7 | ### gdi.h |
MartinJohnson | 0:404dae88af71 | 8 | |
MartinJohnson | 0:404dae88af71 | 9 | # This program is free software; you can redistribute it and/or modify |
MartinJohnson | 0:404dae88af71 | 10 | # it under the terms of the GNU General Public License as published by |
MartinJohnson | 0:404dae88af71 | 11 | # the Free Software Foundation; either version 2 of the License, or |
MartinJohnson | 0:404dae88af71 | 12 | # (at your option) any later version. |
MartinJohnson | 0:404dae88af71 | 13 | # |
MartinJohnson | 0:404dae88af71 | 14 | # This program is distributed in the hope that it will be useful, |
MartinJohnson | 0:404dae88af71 | 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
MartinJohnson | 0:404dae88af71 | 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MartinJohnson | 0:404dae88af71 | 17 | # GNU General Public License for more details. |
MartinJohnson | 0:404dae88af71 | 18 | # |
MartinJohnson | 0:404dae88af71 | 19 | # You should have received a copy of the GNU General Public License |
MartinJohnson | 0:404dae88af71 | 20 | # along with this program; if not, write to the Free Software |
MartinJohnson | 0:404dae88af71 | 21 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
MartinJohnson | 0:404dae88af71 | 22 | |
MartinJohnson | 0:404dae88af71 | 23 | ***************************************************************************/ |
MartinJohnson | 0:404dae88af71 | 24 | |
MartinJohnson | 0:404dae88af71 | 25 | #ifndef __GDI_H |
MartinJohnson | 0:404dae88af71 | 26 | #define __GDI_H |
MartinJohnson | 0:404dae88af71 | 27 | |
MartinJohnson | 0:404dae88af71 | 28 | #include "gdptypes.h" |
MartinJohnson | 0:404dae88af71 | 29 | |
MartinJohnson | 0:404dae88af71 | 30 | // System font |
MartinJohnson | 0:404dae88af71 | 31 | |
MartinJohnson | 0:404dae88af71 | 32 | #define GDI_SYSFONT_WIDTH 6 // Width in pixels |
MartinJohnson | 14:3035b3271395 | 33 | #define GDI_SYSFONT_HEIGHT 8 // Height in pixels |
MartinJohnson | 0:404dae88af71 | 34 | #define GDI_SYSFONT_BYTEWIDTH 1 // Width in bytes |
MartinJohnson | 14:3035b3271395 | 35 | #define GDI_SYSFONT_OFFSET 0x1f |
MartinJohnson | 0:404dae88af71 | 36 | |
MartinJohnson | 0:404dae88af71 | 37 | // RASTER OPERATION |
MartinJohnson | 0:404dae88af71 | 38 | |
MartinJohnson | 0:404dae88af71 | 39 | #define GDI_ROP_COPY 0 |
MartinJohnson | 0:404dae88af71 | 40 | #define GDI_ROP_XOR 1 |
MartinJohnson | 0:404dae88af71 | 41 | #define GDI_ROP_AND 2 |
MartinJohnson | 0:404dae88af71 | 42 | #define GDI_ROP_OR 3 |
MartinJohnson | 0:404dae88af71 | 43 | |
MartinJohnson | 0:404dae88af71 | 44 | typedef struct |
MartinJohnson | 0:404dae88af71 | 45 | { |
MartinJohnson | 0:404dae88af71 | 46 | i16 x; // X position |
MartinJohnson | 0:404dae88af71 | 47 | i16 y; // Y position |
MartinJohnson | 0:404dae88af71 | 48 | i16 w; // Width |
MartinJohnson | 0:404dae88af71 | 49 | i16 h; // Height |
MartinJohnson | 0:404dae88af71 | 50 | |
MartinJohnson | 0:404dae88af71 | 51 | } GDI_RECT, *PGDI_RECT; |
MartinJohnson | 0:404dae88af71 | 52 | |
MartinJohnson | 0:404dae88af71 | 53 | #define GDI_WINCAPTION 0x0001 |
MartinJohnson | 0:404dae88af71 | 54 | #define GDI_WINBORDER 0x0002 |
MartinJohnson | 0:404dae88af71 | 55 | #define GDI_WINCLOSEICON 0x0003 |
MartinJohnson | 0:404dae88af71 | 56 | |
MartinJohnson | 0:404dae88af71 | 57 | // Text align mode |
MartinJohnson | 0:404dae88af71 | 58 | |
MartinJohnson | 0:404dae88af71 | 59 | #define GDI_WINCAPTION_LEFT 0x0000 |
MartinJohnson | 0:404dae88af71 | 60 | #define GDI_WINCAPTION_CENTER 0x0010 |
MartinJohnson | 0:404dae88af71 | 61 | #define GDI_WINCAPTION_RIGHT 0x0020 |
MartinJohnson | 0:404dae88af71 | 62 | #define GDI_WINCAPTION_MASK 0x0030 |
MartinJohnson | 0:404dae88af71 | 63 | |
MartinJohnson | 0:404dae88af71 | 64 | typedef struct |
MartinJohnson | 0:404dae88af71 | 65 | { |
MartinJohnson | 0:404dae88af71 | 66 | u16 style; // Mode, see GDI_WINxxx defines |
MartinJohnson | 0:404dae88af71 | 67 | GDI_RECT rc; // Absolute rectangle |
MartinJohnson | 0:404dae88af71 | 68 | pu8 caption; // Caption text |
MartinJohnson | 0:404dae88af71 | 69 | |
MartinJohnson | 0:404dae88af71 | 70 | } GDI_WINDOW, *PGDI_WINDOW; |
MartinJohnson | 0:404dae88af71 | 71 | |
MartinJohnson | 0:404dae88af71 | 72 | typedef struct |
MartinJohnson | 0:404dae88af71 | 73 | { |
MartinJohnson | 0:404dae88af71 | 74 | i16 w; // Width in bits |
MartinJohnson | 0:404dae88af71 | 75 | i16 h; // Height in bits |
MartinJohnson | 0:404dae88af71 | 76 | i16 wb; // width in bytes |
MartinJohnson | 0:404dae88af71 | 77 | i16 wh; // Height in bytes |
MartinJohnson | 0:404dae88af71 | 78 | pu8 *bm; // Pointer to bitmap bits |
MartinJohnson | 0:404dae88af71 | 79 | |
MartinJohnson | 0:404dae88af71 | 80 | } GDI_BITMAP, PGDI_BITMAP; |
MartinJohnson | 0:404dae88af71 | 81 | |
MartinJohnson | 0:404dae88af71 | 82 | // Function definitions |
MartinJohnson | 0:404dae88af71 | 83 | |
MartinJohnson | 0:404dae88af71 | 84 | void gdiGetClientRect(PGDI_WINDOW, PGDI_RECT); |
MartinJohnson | 0:404dae88af71 | 85 | void gdiCopyRect(PGDI_RECT rc1, PGDI_RECT rc2); |
MartinJohnson | 0:404dae88af71 | 86 | void gdiBitBlt(PGDI_RECT prc, i16 x, i16 y, i16 w, i16 h, pu8 bm, u16 rop); |
MartinJohnson | 0:404dae88af71 | 87 | void gdiPoint(PGDI_RECT rc, u16 x, u16 y, u16 rop); |
MartinJohnson | 0:404dae88af71 | 88 | void gdiLine(PGDI_RECT prc, i16 x0, i16 y0, i16 x1, i16 y1, u16 rop); |
MartinJohnson | 0:404dae88af71 | 89 | void gdiRectangle(i16 x0, i16 y0, i16 x1, i16 y1, u16 rop); |
MartinJohnson | 0:404dae88af71 | 90 | void gdiRectangleEx(PGDI_RECT rc, u16 rop); |
MartinJohnson | 0:404dae88af71 | 91 | void gdiCircle(u16 x, u16 y, u16 r, u16 rop); |
MartinJohnson | 0:404dae88af71 | 92 | void gdiDrawWindow(PGDI_WINDOW pwin); |
MartinJohnson | 0:404dae88af71 | 93 | void gdiDrawTextEx(i16 x, i16 y, pu8 ptext, u16 rop); |
MartinJohnson | 3:93e488fbb8a2 | 94 | void gdiSetColour(int c); |
MartinJohnson | 14:3035b3271395 | 95 | void gdiFilledCircle(u16 x, u16 y, u16 r, u16 rop); |
MartinJohnson | 14:3035b3271395 | 96 | void gdiHLine(u16 x, u16 y, u16 x1, u16 rop); |
MartinJohnson | 14:3035b3271395 | 97 | void gdiVLine(u16 x, u16 y, u16 y1, u16 rop); |
MartinJohnson | 0:404dae88af71 | 98 | |
MartinJohnson | 0:404dae88af71 | 99 | #endif // __GDI_H |
MartinJohnson | 0:404dae88af71 | 100 | |
MartinJohnson | 14:3035b3271395 | 101 | int buttonPress(void); |