Basic swim GUI for LPC4088

Fork of DMBasicGUI by Embedded Artists

Committer:
embeddedartists
Date:
Mon Mar 09 10:40:55 2015 +0100
Revision:
13:bff2288c2c61
Parent:
5:f4de114c31c3
Child:
14:647b1896ed84
Added documentation of the SlideShow related classes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 13:bff2288c2c61 1 /*
embeddedartists 13:bff2288c2c61 2 * Copyright 2014 Embedded Artists AB
embeddedartists 13:bff2288c2c61 3 *
embeddedartists 13:bff2288c2c61 4 * Licensed under the Apache License, Version 2.0 (the "License");
embeddedartists 13:bff2288c2c61 5 * you may not use this file except in compliance with the License.
embeddedartists 13:bff2288c2c61 6 * You may obtain a copy of the License at
embeddedartists 13:bff2288c2c61 7 *
embeddedartists 13:bff2288c2c61 8 * http://www.apache.org/licenses/LICENSE-2.0
embeddedartists 13:bff2288c2c61 9 *
embeddedartists 13:bff2288c2c61 10 * Unless required by applicable law or agreed to in writing, software
embeddedartists 13:bff2288c2c61 11 * distributed under the License is distributed on an "AS IS" BASIS,
embeddedartists 13:bff2288c2c61 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
embeddedartists 13:bff2288c2c61 13 * See the License for the specific language governing permissions and
embeddedartists 13:bff2288c2c61 14 * limitations under the License.
embeddedartists 13:bff2288c2c61 15 */
embeddedartists 13:bff2288c2c61 16
embeddedartists 5:f4de114c31c3 17 #ifndef RENDERER_H
embeddedartists 5:f4de114c31c3 18 #define RENDERER_H
embeddedartists 5:f4de114c31c3 19
embeddedartists 5:f4de114c31c3 20 #include "rtos.h"
embeddedartists 5:f4de114c31c3 21 #include "Display.h"
embeddedartists 5:f4de114c31c3 22
embeddedartists 5:f4de114c31c3 23 class Renderer {
embeddedartists 5:f4de114c31c3 24 public:
embeddedartists 5:f4de114c31c3 25
embeddedartists 13:bff2288c2c61 26 Renderer();
embeddedartists 5:f4de114c31c3 27 ~Renderer();
embeddedartists 5:f4de114c31c3 28
embeddedartists 5:f4de114c31c3 29 /** Specifies a part of a layer
embeddedartists 5:f4de114c31c3 30 *
embeddedartists 5:f4de114c31c3 31 * Returns a handle to pass when updating the framebuffer.
embeddedartists 5:f4de114c31c3 32 *
embeddedartists 5:f4de114c31c3 33 * @param layer 0 is the bottom of the stack, higher number is on top
embeddedartists 5:f4de114c31c3 34 * @param xoff top left corner of the drawing rectangle
embeddedartists 5:f4de114c31c3 35 * @param yoff top left corner of the drawing rectangle
embeddedartists 5:f4de114c31c3 36 * @param width width of the drawing rectangle
embeddedartists 5:f4de114c31c3 37 * @param height height of the drawing rectangle
embeddedartists 5:f4de114c31c3 38 *
embeddedartists 5:f4de114c31c3 39 * @returns
embeddedartists 5:f4de114c31c3 40 * handle to pass to setFrameBuffer function
embeddedartists 5:f4de114c31c3 41 * 0 on failure
embeddedartists 5:f4de114c31c3 42 */
embeddedartists 5:f4de114c31c3 43 uint32_t registerUser(int layer, int xoff, int yoff, int width, int height);
embeddedartists 5:f4de114c31c3 44 uint32_t registerFullscreenUser(int layer);
embeddedartists 5:f4de114c31c3 45
embeddedartists 5:f4de114c31c3 46 /** Removes the item from the renderer
embeddedartists 5:f4de114c31c3 47 *
embeddedartists 5:f4de114c31c3 48 * @param handle the handle returned in the registerUser() call
embeddedartists 5:f4de114c31c3 49 */
embeddedartists 5:f4de114c31c3 50 void unregisterUser(uint32_t handle);
embeddedartists 5:f4de114c31c3 51
embeddedartists 5:f4de114c31c3 52 /** Informs the renderer that there is new data to use
embeddedartists 5:f4de114c31c3 53 *
embeddedartists 5:f4de114c31c3 54 * Blocks until the data has been register. After that point the
embeddedartists 5:f4de114c31c3 55 * data must not be modified until another call to setFramebuffer.
embeddedartists 5:f4de114c31c3 56 *
embeddedartists 5:f4de114c31c3 57 * @param handle the handle returned in the registerUser() call
embeddedartists 5:f4de114c31c3 58 * @param data the image data
embeddedartists 5:f4de114c31c3 59 */
embeddedartists 5:f4de114c31c3 60 void setFramebuffer(uint32_t handle, const uint16_t* data);
embeddedartists 5:f4de114c31c3 61
embeddedartists 5:f4de114c31c3 62 void setRenderThread(Thread* renderThread) { t = renderThread; }
embeddedartists 5:f4de114c31c3 63
embeddedartists 5:f4de114c31c3 64 /** Run the renderer
embeddedartists 5:f4de114c31c3 65 *
embeddedartists 5:f4de114c31c3 66 * Should be called from a high priority thread.
embeddedartists 5:f4de114c31c3 67 */
embeddedartists 5:f4de114c31c3 68 void render();
embeddedartists 5:f4de114c31c3 69
embeddedartists 5:f4de114c31c3 70 private:
embeddedartists 5:f4de114c31c3 71
embeddedartists 5:f4de114c31c3 72 enum Constants {
embeddedartists 5:f4de114c31c3 73 MaxNumLayers = 10,
embeddedartists 5:f4de114c31c3 74 };
embeddedartists 5:f4de114c31c3 75
embeddedartists 5:f4de114c31c3 76 typedef uint16_t* image_t;
embeddedartists 5:f4de114c31c3 77
embeddedartists 5:f4de114c31c3 78 typedef struct {
embeddedartists 5:f4de114c31c3 79 bool used;
embeddedartists 5:f4de114c31c3 80 int x0;
embeddedartists 5:f4de114c31c3 81 int y0;
embeddedartists 5:f4de114c31c3 82 int x1;
embeddedartists 5:f4de114c31c3 83 int y1;
embeddedartists 5:f4de114c31c3 84 int width;
embeddedartists 5:f4de114c31c3 85 int clippedHeight;
embeddedartists 5:f4de114c31c3 86 int zorder;
embeddedartists 5:f4de114c31c3 87 int signalId;
embeddedartists 5:f4de114c31c3 88 bool fullscreen;
embeddedartists 5:f4de114c31c3 89 const uint16_t* newData;
embeddedartists 5:f4de114c31c3 90 const uint16_t* activeData;
embeddedartists 5:f4de114c31c3 91 uint16_t* tmp;
embeddedartists 5:f4de114c31c3 92 Mutex* lock;
embeddedartists 5:f4de114c31c3 93 } layerinfo_t;
embeddedartists 5:f4de114c31c3 94
embeddedartists 5:f4de114c31c3 95 layerinfo_t layers[MaxNumLayers];
embeddedartists 5:f4de114c31c3 96 layerinfo_t* order[MaxNumLayers];
embeddedartists 5:f4de114c31c3 97
embeddedartists 5:f4de114c31c3 98 int numRegisteredLayers;
embeddedartists 5:f4de114c31c3 99
embeddedartists 5:f4de114c31c3 100 Thread* t;
embeddedartists 5:f4de114c31c3 101 Mutex setupMutex;
embeddedartists 5:f4de114c31c3 102
embeddedartists 5:f4de114c31c3 103 int screenWidth;
embeddedartists 5:f4de114c31c3 104 int screenHeight;
embeddedartists 5:f4de114c31c3 105 int screenPixels;
embeddedartists 5:f4de114c31c3 106 int screenBytes;
embeddedartists 5:f4de114c31c3 107 int activeBackBuffer;
embeddedartists 5:f4de114c31c3 108
embeddedartists 5:f4de114c31c3 109 image_t ImageBackBuffer[2];
embeddedartists 5:f4de114c31c3 110
embeddedartists 5:f4de114c31c3 111 Display* display;
embeddedartists 5:f4de114c31c3 112 };
embeddedartists 5:f4de114c31c3 113
embeddedartists 5:f4de114c31c3 114 #endif
embeddedartists 5:f4de114c31c3 115
embeddedartists 5:f4de114c31c3 116
embeddedartists 5:f4de114c31c3 117