A basic graphics package for the LPC4088 Display Module.
Dependents: lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI lpc4088_displaymodule_fs_aid ... more
Fork of DMBasicGUI by
SlideShow/Renderer.h@5:f4de114c31c3, 2014-12-21 (annotated)
- Committer:
- embeddedartists
- Date:
- Sun Dec 21 13:53:07 2014 +0100
- Revision:
- 5:f4de114c31c3
- Child:
- 13:bff2288c2c61
- Added support for RAW images
- Added SlideShow + App for it
- Moved App-specific stuff out from the AppLauncher and into main
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 5:f4de114c31c3 | 1 | #ifndef RENDERER_H |
embeddedartists | 5:f4de114c31c3 | 2 | #define RENDERER_H |
embeddedartists | 5:f4de114c31c3 | 3 | |
embeddedartists | 5:f4de114c31c3 | 4 | #include "rtos.h" |
embeddedartists | 5:f4de114c31c3 | 5 | //#include "LcdController.h" |
embeddedartists | 5:f4de114c31c3 | 6 | //#include "EaLcdBoard.h" |
embeddedartists | 5:f4de114c31c3 | 7 | #include "Display.h" |
embeddedartists | 5:f4de114c31c3 | 8 | |
embeddedartists | 5:f4de114c31c3 | 9 | class Renderer { |
embeddedartists | 5:f4de114c31c3 | 10 | public: |
embeddedartists | 5:f4de114c31c3 | 11 | |
embeddedartists | 5:f4de114c31c3 | 12 | Renderer(/*LcdController::Config* screen, EaLcdBoard* lcdBoard*/); |
embeddedartists | 5:f4de114c31c3 | 13 | ~Renderer(); |
embeddedartists | 5:f4de114c31c3 | 14 | |
embeddedartists | 5:f4de114c31c3 | 15 | /** Specifies a part of a layer |
embeddedartists | 5:f4de114c31c3 | 16 | * |
embeddedartists | 5:f4de114c31c3 | 17 | * Returns a handle to pass when updating the framebuffer. |
embeddedartists | 5:f4de114c31c3 | 18 | * |
embeddedartists | 5:f4de114c31c3 | 19 | * @param layer 0 is the bottom of the stack, higher number is on top |
embeddedartists | 5:f4de114c31c3 | 20 | * @param xoff top left corner of the drawing rectangle |
embeddedartists | 5:f4de114c31c3 | 21 | * @param yoff top left corner of the drawing rectangle |
embeddedartists | 5:f4de114c31c3 | 22 | * @param width width of the drawing rectangle |
embeddedartists | 5:f4de114c31c3 | 23 | * @param height height of the drawing rectangle |
embeddedartists | 5:f4de114c31c3 | 24 | * |
embeddedartists | 5:f4de114c31c3 | 25 | * @returns |
embeddedartists | 5:f4de114c31c3 | 26 | * handle to pass to setFrameBuffer function |
embeddedartists | 5:f4de114c31c3 | 27 | * 0 on failure |
embeddedartists | 5:f4de114c31c3 | 28 | */ |
embeddedartists | 5:f4de114c31c3 | 29 | uint32_t registerUser(int layer, int xoff, int yoff, int width, int height); |
embeddedartists | 5:f4de114c31c3 | 30 | uint32_t registerFullscreenUser(int layer); |
embeddedartists | 5:f4de114c31c3 | 31 | |
embeddedartists | 5:f4de114c31c3 | 32 | /** Removes the item from the renderer |
embeddedartists | 5:f4de114c31c3 | 33 | * |
embeddedartists | 5:f4de114c31c3 | 34 | * @param handle the handle returned in the registerUser() call |
embeddedartists | 5:f4de114c31c3 | 35 | */ |
embeddedartists | 5:f4de114c31c3 | 36 | void unregisterUser(uint32_t handle); |
embeddedartists | 5:f4de114c31c3 | 37 | |
embeddedartists | 5:f4de114c31c3 | 38 | /** Informs the renderer that there is new data to use |
embeddedartists | 5:f4de114c31c3 | 39 | * |
embeddedartists | 5:f4de114c31c3 | 40 | * Blocks until the data has been register. After that point the |
embeddedartists | 5:f4de114c31c3 | 41 | * data must not be modified until another call to setFramebuffer. |
embeddedartists | 5:f4de114c31c3 | 42 | * |
embeddedartists | 5:f4de114c31c3 | 43 | * @param handle the handle returned in the registerUser() call |
embeddedartists | 5:f4de114c31c3 | 44 | * @param data the image data |
embeddedartists | 5:f4de114c31c3 | 45 | */ |
embeddedartists | 5:f4de114c31c3 | 46 | void setFramebuffer(uint32_t handle, const uint16_t* data); |
embeddedartists | 5:f4de114c31c3 | 47 | |
embeddedartists | 5:f4de114c31c3 | 48 | void setRenderThread(Thread* renderThread) { t = renderThread; } |
embeddedartists | 5:f4de114c31c3 | 49 | |
embeddedartists | 5:f4de114c31c3 | 50 | /** Run the renderer |
embeddedartists | 5:f4de114c31c3 | 51 | * |
embeddedartists | 5:f4de114c31c3 | 52 | * Should be called from a high priority thread. |
embeddedartists | 5:f4de114c31c3 | 53 | */ |
embeddedartists | 5:f4de114c31c3 | 54 | void render(); |
embeddedartists | 5:f4de114c31c3 | 55 | |
embeddedartists | 5:f4de114c31c3 | 56 | private: |
embeddedartists | 5:f4de114c31c3 | 57 | |
embeddedartists | 5:f4de114c31c3 | 58 | enum Constants { |
embeddedartists | 5:f4de114c31c3 | 59 | MaxNumLayers = 10, |
embeddedartists | 5:f4de114c31c3 | 60 | }; |
embeddedartists | 5:f4de114c31c3 | 61 | |
embeddedartists | 5:f4de114c31c3 | 62 | typedef uint16_t* image_t; |
embeddedartists | 5:f4de114c31c3 | 63 | |
embeddedartists | 5:f4de114c31c3 | 64 | typedef struct { |
embeddedartists | 5:f4de114c31c3 | 65 | bool used; |
embeddedartists | 5:f4de114c31c3 | 66 | int x0; |
embeddedartists | 5:f4de114c31c3 | 67 | int y0; |
embeddedartists | 5:f4de114c31c3 | 68 | int x1; |
embeddedartists | 5:f4de114c31c3 | 69 | int y1; |
embeddedartists | 5:f4de114c31c3 | 70 | int width; |
embeddedartists | 5:f4de114c31c3 | 71 | int clippedHeight; |
embeddedartists | 5:f4de114c31c3 | 72 | int zorder; |
embeddedartists | 5:f4de114c31c3 | 73 | int signalId; |
embeddedartists | 5:f4de114c31c3 | 74 | bool fullscreen; |
embeddedartists | 5:f4de114c31c3 | 75 | const uint16_t* newData; |
embeddedartists | 5:f4de114c31c3 | 76 | const uint16_t* activeData; |
embeddedartists | 5:f4de114c31c3 | 77 | uint16_t* tmp; |
embeddedartists | 5:f4de114c31c3 | 78 | Mutex* lock; |
embeddedartists | 5:f4de114c31c3 | 79 | } layerinfo_t; |
embeddedartists | 5:f4de114c31c3 | 80 | |
embeddedartists | 5:f4de114c31c3 | 81 | layerinfo_t layers[MaxNumLayers]; |
embeddedartists | 5:f4de114c31c3 | 82 | layerinfo_t* order[MaxNumLayers]; |
embeddedartists | 5:f4de114c31c3 | 83 | |
embeddedartists | 5:f4de114c31c3 | 84 | int numRegisteredLayers; |
embeddedartists | 5:f4de114c31c3 | 85 | |
embeddedartists | 5:f4de114c31c3 | 86 | Thread* t; |
embeddedartists | 5:f4de114c31c3 | 87 | Mutex setupMutex; |
embeddedartists | 5:f4de114c31c3 | 88 | |
embeddedartists | 5:f4de114c31c3 | 89 | int screenWidth; |
embeddedartists | 5:f4de114c31c3 | 90 | int screenHeight; |
embeddedartists | 5:f4de114c31c3 | 91 | int screenPixels; |
embeddedartists | 5:f4de114c31c3 | 92 | int screenBytes; |
embeddedartists | 5:f4de114c31c3 | 93 | int activeBackBuffer; |
embeddedartists | 5:f4de114c31c3 | 94 | |
embeddedartists | 5:f4de114c31c3 | 95 | image_t ImageBackBuffer[2]; |
embeddedartists | 5:f4de114c31c3 | 96 | |
embeddedartists | 5:f4de114c31c3 | 97 | //EaLcdBoard* board; |
embeddedartists | 5:f4de114c31c3 | 98 | Display* display; |
embeddedartists | 5:f4de114c31c3 | 99 | }; |
embeddedartists | 5:f4de114c31c3 | 100 | |
embeddedartists | 5:f4de114c31c3 | 101 | #endif |
embeddedartists | 5:f4de114c31c3 | 102 | |
embeddedartists | 5:f4de114c31c3 | 103 | |
embeddedartists | 5:f4de114c31c3 | 104 |