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
Diff: SlideShow/Renderer.h
- Revision:
- 5:f4de114c31c3
- Child:
- 13:bff2288c2c61
diff -r a73760d09423 -r f4de114c31c3 SlideShow/Renderer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SlideShow/Renderer.h Sun Dec 21 13:53:07 2014 +0100 @@ -0,0 +1,104 @@ +#ifndef RENDERER_H +#define RENDERER_H + +#include "rtos.h" +//#include "LcdController.h" +//#include "EaLcdBoard.h" +#include "Display.h" + +class Renderer { +public: + + Renderer(/*LcdController::Config* screen, EaLcdBoard* lcdBoard*/); + ~Renderer(); + + /** Specifies a part of a layer + * + * Returns a handle to pass when updating the framebuffer. + * + * @param layer 0 is the bottom of the stack, higher number is on top + * @param xoff top left corner of the drawing rectangle + * @param yoff top left corner of the drawing rectangle + * @param width width of the drawing rectangle + * @param height height of the drawing rectangle + * + * @returns + * handle to pass to setFrameBuffer function + * 0 on failure + */ + uint32_t registerUser(int layer, int xoff, int yoff, int width, int height); + uint32_t registerFullscreenUser(int layer); + + /** Removes the item from the renderer + * + * @param handle the handle returned in the registerUser() call + */ + void unregisterUser(uint32_t handle); + + /** Informs the renderer that there is new data to use + * + * Blocks until the data has been register. After that point the + * data must not be modified until another call to setFramebuffer. + * + * @param handle the handle returned in the registerUser() call + * @param data the image data + */ + void setFramebuffer(uint32_t handle, const uint16_t* data); + + void setRenderThread(Thread* renderThread) { t = renderThread; } + + /** Run the renderer + * + * Should be called from a high priority thread. + */ + void render(); + +private: + + enum Constants { + MaxNumLayers = 10, + }; + + typedef uint16_t* image_t; + + typedef struct { + bool used; + int x0; + int y0; + int x1; + int y1; + int width; + int clippedHeight; + int zorder; + int signalId; + bool fullscreen; + const uint16_t* newData; + const uint16_t* activeData; + uint16_t* tmp; + Mutex* lock; + } layerinfo_t; + + layerinfo_t layers[MaxNumLayers]; + layerinfo_t* order[MaxNumLayers]; + + int numRegisteredLayers; + + Thread* t; + Mutex setupMutex; + + int screenWidth; + int screenHeight; + int screenPixels; + int screenBytes; + int activeBackBuffer; + + image_t ImageBackBuffer[2]; + + //EaLcdBoard* board; + Display* display; +}; + +#endif + + +