Demo for Embedded World 2015.

Dependencies:   DMBasicGUI DMSupport

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AppImageViewer.h Source File

AppImageViewer.h

00001 /*
00002  *  Copyright 2014 Embedded Artists AB
00003  *
00004  *  Licensed under the Apache License, Version 2.0 (the "License");
00005  *  you may not use this file except in compliance with the License.
00006  *  You may obtain a copy of the License at
00007  *
00008  *    http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  *  Unless required by applicable law or agreed to in writing, software
00011  *  distributed under the License is distributed on an "AS IS" BASIS,
00012  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *  See the License for the specific language governing permissions and
00014  *  limitations under the License.
00015  */
00016  
00017 #ifndef APP_IMAGEVIEWER_H
00018 #define APP_IMAGEVIEWER_H
00019 
00020 #include "App.h"
00021 #include "DMBoard.h"
00022 #include "lpc_swim.h"
00023 #include "ImageButton.h"
00024 #include "Image.h"
00025 
00026 /**
00027  * An App example. Searches for images on any connected media (USB Mass Storage, 
00028  * SD Card or QSPI File System) and presents the images one at a time, scaled to
00029  * fit the display.
00030  *
00031  * The purpose of this example is to show how to recursively search the file
00032  * systems and how to load images. The image scaling could be replaced with 
00033  * rotating, cropping or any other image operation. The two second delay between
00034  * images could be replaced with buttons or other touch events.
00035  */
00036 class AppImageViewer : public App {
00037 public:
00038 
00039     AppImageViewer();
00040     virtual ~AppImageViewer();
00041 
00042     virtual bool setup();
00043     virtual void runToCompletion();
00044     virtual bool teardown();
00045 
00046     void load(const char* file);
00047 
00048 private:
00049     Display* _disp;
00050     SWIM_WINDOW_T* _win;
00051     void* _fb1;
00052     void* _fb2;
00053     ImageButton* _btn;
00054     Mail<Image::ImageData_t, 2> _mailbox;
00055     int _active;
00056     int _next;
00057     Mutex _allowedToRender;
00058     Mutex _imageLoaded;
00059 
00060     void draw();
00061 };
00062 
00063 #endif
00064