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
Revision 17:6e2abf107800, committed 2015-03-20
- Comitter:
- embeddedartists
- Date:
- Fri Mar 20 14:25:46 2015 +0100
- Parent:
- 16:feb669462368
- Child:
- 18:d41537a70189
- Child:
- 19:f3d0189401e4
- Commit message:
- - Added a Resource concept to allow runtime selection of image source. The
resource can be loaded from an array in flash or from a file on any of the
available file systems. Using a resource makes it possible to have different
resources depending on display resolution
- Removed the basic_image data files
- Added support for the 5" display (800x480 resolution)
- Added possibility to change the default font in SWIM
Changed in this revision
--- a/Application/AppColorPicker.cpp Mon Mar 09 14:24:54 2015 +0000 +++ b/Application/AppColorPicker.cpp Fri Mar 20 14:25:46 2015 +0100 @@ -19,16 +19,14 @@ #include "EthernetInterface.h" #include "AppColorPicker.h" #include "lpc_swim_font.h" -#include "basic_image_data.h" + /****************************************************************************** * Defines and typedefs *****************************************************************************/ -#define BOX_SIDE 192 //256 +#define BOX_SIDE 192 -#define BTN_WIDTH 65 -#define BTN_HEIGHT 40 #define BTN_OFF 20 /****************************************************************************** @@ -66,11 +64,8 @@ uint16_t r, g, b; uint16_t rx = BOX_SIDE/32; - //uint16_t gx = BOX_SIDE/64; uint16_t bx = BOX_SIDE/32; - //uint16_t ry = BOX_SIDE/32; uint16_t gy = BOX_SIDE/64; - //uint16_t by = BOX_SIDE/32; uint16_t color; for (int x = 0; x < BOX_SIDE; x++) { r = (x/rx); @@ -83,8 +78,8 @@ } } - _btn = new ImageButton(_win->fb, _win->xpmax - BTN_OFF - BTN_WIDTH, _win->ypmax - BTN_OFF - BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT); - _btn->loadImages(img_ok, img_size_ok); + _btn = new ImageButton(_win->fb, _win->xpmax - BTN_OFF - _resOk->width(), _win->ypmax - BTN_OFF - _resOk->height(), _resOk->width(), _resOk->height()); + _btn->loadImages(_resOk); _btn->draw(); // Copy everything onto the back buffer @@ -96,8 +91,19 @@ *****************************************************************************/ AppColorPicker::AppColorPicker() : _disp(NULL), _win(NULL), _colorwin(NULL), - _fb(NULL), _fb2(NULL), _btn(NULL) + _fb(NULL), _fb2(NULL), _btn(NULL), _resOk(NULL) { + if (DMBoard::instance().display()->width() == 480) { + _resultX = 350; + _resultY = 70; + _resultW = 80; + _resultH = 80; + } else { + _resultW = 80*2; + _resultH = 80*2; + _resultX = 350; + _resultY = (DMBoard::instance().display()->height() - (_resultH + 50))/2; + } } AppColorPicker::~AppColorPicker() @@ -143,9 +149,9 @@ COLOR_T c = ((x/(BOX_SIDE/32))<<11) | ((y/(BOX_SIDE/64))<<5) | ((0x1f-(x/(BOX_SIDE/32)))<<0); if (c != lastColor) { swim_set_fill_color(_win, c); - swim_put_box(_win, 350, 70, 430, 150); + swim_put_box(_win, _resultX, _resultY, _resultX+_resultW, _resultY+_resultH); sprintf(buf, "0x%04x ", c); - swim_put_text_xy(_win, buf, 350, 160); + swim_put_text_xy(_win, buf, _resultX, _resultY+_resultH+10); // Swap what is shown and what is drawn on if (showingFB2) { @@ -197,4 +203,7 @@ return true; } - +void AppColorPicker::addResource(Resources id, Resource* res) +{ + _resOk = res; +}
--- a/Application/AppColorPicker.h Mon Mar 09 14:24:54 2015 +0000 +++ b/Application/AppColorPicker.h Fri Mar 20 14:25:46 2015 +0100 @@ -21,6 +21,7 @@ #include "DMBoard.h" #include "lpc_swim.h" #include "ImageButton.h" +#include "Resource.h" /** * An App example letting the user pick a color from a colored area. @@ -40,6 +41,21 @@ virtual void runToCompletion(); virtual bool teardown(); + enum Resources { + Resource_Ok_button, + }; + + /** Specifies the resource to use + * + * Adds a resource for a specific id. This allows the + * user program to select e.g. which image to use and + * if it should be loaded from a file or an array. + * + * @param id the identifier + * @param res the resource + */ + void addResource(Resources id, Resource* res); + private: Display* _disp; SWIM_WINDOW_T* _win; @@ -47,6 +63,11 @@ COLOR_T* _fb; COLOR_T* _fb2; ImageButton* _btn; + Resource* _resOk; + int _resultX; + int _resultY; + int _resultW; + int _resultH; void draw(); };
--- a/Application/AppTouchCalibration.cpp Mon Mar 09 14:24:54 2015 +0000 +++ b/Application/AppTouchCalibration.cpp Fri Mar 20 14:25:46 2015 +0100 @@ -23,8 +23,6 @@ * Defines and typedefs *****************************************************************************/ -#define BTN_WIDTH 65 -#define BTN_HEIGHT 40 #define BTN_OFF 20 /****************************************************************************** @@ -64,7 +62,8 @@ showStatus("Press the crosshairs in each of the corners"); // Create (but don't show) the button - _btn = new Button("Done", _win->fb, _win->xpmax - BTN_OFF - BTN_WIDTH, _win->ypmax - BTN_OFF - BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT); + _btn = new ImageButton(_win->fb, _win->xpmax - BTN_OFF - _resOk->width(), _win->ypmax - BTN_OFF - _resOk->height(), _resOk->width(), _resOk->height()); + _btn->loadImages(_resOk); } void AppTouchCalibration::drawMarker(uint16_t x, uint16_t y, bool erase) @@ -140,7 +139,8 @@ * Public functions *****************************************************************************/ -AppTouchCalibration::AppTouchCalibration() : _disp(NULL), _touch(NULL), _win(NULL), _fb(NULL), _btn(NULL) +AppTouchCalibration::AppTouchCalibration() : _disp(NULL), _touch(NULL), + _win(NULL), _fb(NULL), _btn(NULL), _resOk(NULL) { } @@ -228,3 +228,8 @@ } return true; } + +void AppTouchCalibration::addResource(Resources id, Resource* res) +{ + _resOk = res; +}
--- a/Application/AppTouchCalibration.h Mon Mar 09 14:24:54 2015 +0000 +++ b/Application/AppTouchCalibration.h Fri Mar 20 14:25:46 2015 +0100 @@ -20,7 +20,8 @@ #include "App.h" #include "DMBoard.h" #include "lpc_swim.h" -#include "Button.h" +#include "ImageButton.h" +#include "Resource.h" /** * An App example guiding the user through the steps needed to (re)calibrate the @@ -41,13 +42,29 @@ virtual void runToCompletion(); virtual bool teardown(); + enum Resources { + Resource_Ok_button, + }; + + /** Specifies the resource to use + * + * Adds a resource for a specific id. This allows the + * user program to select e.g. which image to use and + * if it should be loaded from a file or an array. + * + * @param id the identifier + * @param res the resource + */ + void addResource(Resources id, Resource* res); + private: Display* _disp; TouchPanel* _touch; SWIM_WINDOW_T* _win; SWIM_WINDOW_T* _msg; void* _fb; - Button* _btn; + ImageButton* _btn; + Resource* _resOk; void draw(); void drawMarker(uint16_t x, uint16_t y, bool erase);
--- a/Application/Image.cpp Mon Mar 09 14:24:54 2015 +0000 +++ b/Application/Image.cpp Fri Mar 20 14:25:46 2015 +0100 @@ -16,6 +16,7 @@ #include "mbed.h" #include "Image.h" +#include "Resource.h" #include "bmp.h" #include "lodepng.h" @@ -228,6 +229,30 @@ return result; } +int Image::decode(Resource* res, Resolution resolution, ImageData_t* pDataOut, Mutex* pLock) +{ + int result = 0; + if (res == NULL) { + result = 1; + } else { + // Load the image only if it is not already cached + if (res->_img.pixels == NULL) { + if (res->_isFile) { + result = decode(res->_filename, resolution, &res->_img, pLock); + } else { + result = decode(res->_data, res->_dataSize, resolution, &res->_img); + } + } + if ((result == 0) && (res->_img.pixels != NULL)) { + // Copy the cached copy to the user's data, but skip the pointerToFree + // as that would break the cache + memcpy(pDataOut, &res->_img, sizeof(ImageData_t)); + pDataOut->pointerToFree = NULL; + } + } + return result; +} + Image::Type Image::imageType(const unsigned char* pDataIn, unsigned int sizeIn) { if (sizeIn > 4)
--- a/Application/Image.h Mon Mar 09 14:24:54 2015 +0000 +++ b/Application/Image.h Fri Mar 20 14:25:46 2015 +0100 @@ -20,6 +20,8 @@ #include "mbed.h" #include "rtos.h" +class Resource; + /** * Image example * @@ -107,7 +109,26 @@ * 1 on failure */ static int decode(const char* filename, Resolution res, ImageData_t* pDataOut, Mutex* pLock=NULL); - + + /** Decodes the specified image resource + * + * Note that if this function returns a zero, indicating success, + * the pixels member of the pDataOut structure must be + * deallocated using free() when no longer needed. + * + * The decoded image is cached in the Resource to prevent decoding + * the same resource over and over. + * + * @param res the resource to decode + * @param resolution the format of the display + * @param pDataOut the decoded image (only valid if 0 is returned) + * + * @returns + * 0 on success + * 1 on failure + */ + static int decode(Resource* res, Resolution resolution, ImageData_t* pDataOut, Mutex* pLock=NULL); + private: /** No instance needed
--- a/Application/ImageButton.cpp Mon Mar 09 14:24:54 2015 +0000 +++ b/Application/ImageButton.cpp Fri Mar 20 14:25:46 2015 +0100 @@ -105,6 +105,30 @@ return true; } +bool ImageButton::loadImages(Resource* resImgUp, Resource* resImgDown) +{ + if (_imgUp.pointerToFree != NULL) { + free(_imgUp.pointerToFree); + _imgUp.pointerToFree = NULL; + } + if (_imgDown.pointerToFree != NULL) { + free(_imgDown.pointerToFree); + _imgDown.pointerToFree = NULL; + } + if (Image::decode(resImgUp, Image::RES_16BIT, &_imgUp) != 0) { + DMBoard::instance().logger()->printf("Failed to load \"up\" image\n"); + return false; + } + if (resImgDown != NULL) { + if (Image::decode(resImgDown, Image::RES_16BIT, &_imgDown) == 0) { + DMBoard::instance().logger()->printf("Failed to load \"down\" image\n"); + return false; + } + } + return true; +} + + void ImageButton::setTransparency(COLOR_T tColor) { _transparent = true;
--- a/Application/ImageButton.h Mon Mar 09 14:24:54 2015 +0000 +++ b/Application/ImageButton.h Fri Mar 20 14:25:46 2015 +0100 @@ -19,6 +19,7 @@ #include "Clickable.h" #include "Image.h" +#include "Resource.h" /** * The ImageButton is used in the same way as the Button so see it for an example @@ -56,8 +57,10 @@ /** Loads the mandatory "normal" state image and the optional "pressed" state image * - * @param imgUp the image for the normal state - * @param imgDown the image for the pressed state (or NULL to use the same) + * @param imgUp the image for the normal state + * @param imgUpSize the size of the imgUp data + * @param imgDown the image for the pressed state (or NULL to use the same) + * @param imgUpSize the size of the imgDown data * * @returns * true on success @@ -66,6 +69,17 @@ bool loadImages(const unsigned char* imgUp, unsigned int imgUpSize, const unsigned char* imgDown = 0, unsigned int imgDownSize = 0); + /** Loads the mandatory "normal" state image and the optional "pressed" state image + * + * @param resImgUp the resource for the normal state image + * @param resImgDown the resource for the pressed state image (or NULL to use the same) + * + * @returns + * true on success + * false on failure + */ + bool loadImages(Resource* resImgUp, Resource* resImgDown = 0); + /** Specifys a color that will be considered transparent (i.e. will not be drawn) * @param tColor the transparent color */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Application/Resource.cpp Fri Mar 20 14:25:46 2015 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright 2014 Embedded Artists AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mbed.h" +#include "Resource.h" + +Resource::Resource(const char* filename, int width, int height) : + _width(width), _height(height), _isFile(true), _data(NULL), _dataSize(0) +{ + _filename = (char*)malloc(strlen(filename)+1); + if (_filename != NULL) { + strcpy(_filename, filename); + } + memset(&_img, 0, sizeof(Image::ImageData_t)); +} + +Resource::Resource(const unsigned char* data, const unsigned int dataSize, int width, int height) : + _width(width), _height(height), _isFile(false), _filename(NULL), _data(data), _dataSize(dataSize) +{ + memset(&_img, 0, sizeof(Image::ImageData_t)); +} + +Resource::~Resource() +{ + if (_filename != NULL) { + free(_filename); + _filename = NULL; + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Application/Resource.h Fri Mar 20 14:25:46 2015 +0100 @@ -0,0 +1,126 @@ +/* + * Copyright 2014 Embedded Artists AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef RESOURCE_H +#define RESOURCE_H + +#include "mbed.h" +#include "Image.h" + +/** + * A resource container to pass around instead of using hardcoded data. + * + * Having a Resource class makes it possible to hide the source from the + * user so that e.g. AppColorPicker doesn't need to know if the OK button + * is loaded from an array or from a file system. The AppColorPicker only + * need the resource. The Image class takes care of the loading. + * + * @code + * #include "mbed.h" + * #include "Resource.h" + * #include "Image.h" + * + * const unsigned char ok_image1[] = { 137,80,78,71, ... }; + * int ok_image1_sz = sizeof(ok_image1); + * + * int main(void) { + * // initialize the display + * ... + * + * // create the resources + * Resource resOk(ok_image1, ok_image1_sz, 40, 40); + * Resource resCancel("/qspi/cancel.png", 40, 40); + * + * // add resource to application + * AppNetwork app ...; + * app.setResource(AppNetwork::Resource_Ok_Button, &resOk); + * app.setResource(AppNetwork::Resource_Cancel_Button, &resCancel); + * + * // run application + * app.setup(); + * app.runToCompletion(); + * + * ... + * } + * @endcode + */ +class Resource { +public: + + /** Create a new file resource. + * + * The width and height are only guidelines and are often not used. + * The purpose is to allow e.g. the AppColorPicker to know the size + * of the image before it is loaded from the file system. It can also + * be used as a guide by the AppLauncher. + * + * @param filename the resource location + * @param width the width of the image + * @param height the height of the image + */ + Resource(const char* filename, int width, int height); + + /** Create a new resource from a data array. + * + * The width and height are only guidelines and are often not used. + * The purpose is to allow e.g. the AppColorPicker to know the size + * of the image before it is loaded from the file system. It can also + * be used as a guide by the AppLauncher. + * + * @param data the resource + * @param dataSize number of bytes in data + * @param width the width of the image + * @param height the height of the image + */ + Resource(const unsigned char* data, const unsigned int dataSize, int width, int height); + ~Resource(); + + /** Returns the width of the resource. + * + * The width and height are only guidelines and are often not used. + * The purpose is to allow e.g. the AppColorPicker to know the size + * of the image before it is loaded from the file system. It can also + * be used as a guide by the AppLauncher. + * + * @return the width + */ + int width() { return _width; } + + /** Returns the height of the resource. + * + * The width and height are only guidelines and are often not used. + * The purpose is to allow e.g. the AppColorPicker to know the size + * of the image before it is loaded from the file system. It can also + * be used as a guide by the AppLauncher. + * + * @return the height + */ + int height() { return _height; } + +private: + friend class Image; + + int _width; + int _height; + bool _isFile; + char* _filename; + const unsigned char* _data; + unsigned int _dataSize; + + Image::ImageData_t _img; +}; + +#endif
--- a/Application/basic_image_data.c Mon Mar 09 14:24:54 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -#include "dm_board_config.h" - -#if defined(DM_BOARD_USE_BUILTIN_IMAGES) - -const unsigned char img_ok[] = { - 0x89,0x50,0x4E,0x47,0x0D,0x0A,0x1A,0x0A,0x00,0x00,0x00,0x0D,0x49,0x48,0x44,0x52, - 0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x28,0x08,0x02,0x00,0x00,0x00,0x03,0x9C,0x2F, - 0x3A,0x00,0x00,0x00,0x01,0x73,0x52,0x47,0x42,0x00,0xAE,0xCE,0x1C,0xE9,0x00,0x00, - 0x00,0x04,0x67,0x41,0x4D,0x41,0x00,0x00,0xB1,0x8F,0x0B,0xFC,0x61,0x05,0x00,0x00, - 0x00,0x09,0x70,0x48,0x59,0x73,0x00,0x00,0x0E,0xC3,0x00,0x00,0x0E,0xC3,0x01,0xC7, - 0x6F,0xA8,0x64,0x00,0x00,0x01,0xE1,0x49,0x44,0x41,0x54,0x58,0x47,0xED,0x92,0xCB, - 0x4A,0xC3,0x40,0x14,0x86,0xFB,0x42,0x0A,0xDD,0xB8,0x10,0xDC,0xB9,0xF2,0x11,0xDC, - 0x0A,0x22,0x22,0xDD,0x74,0xE1,0x42,0x70,0x2B,0x0A,0xDE,0x10,0x41,0xD1,0x55,0x51, - 0x4A,0x57,0x56,0x11,0x45,0xBC,0x80,0xE0,0x05,0x15,0x04,0x41,0x45,0xD1,0x85,0xE0, - 0x23,0x68,0x9A,0x26,0x93,0xA6,0x06,0x73,0xE6,0x27,0x9E,0xCC,0x24,0xAD,0x49,0x83, - 0x0B,0x7F,0xBE,0x45,0x66,0xE6,0x9F,0xF3,0xC1,0x90,0x5C,0xEE,0x24,0xDF,0x12,0xC7, - 0xA1,0x9D,0x84,0xF0,0x75,0x66,0xF0,0x75,0x66,0xE0,0xAB,0xD7,0x18,0xCE,0x00,0xE8, - 0xFE,0xC5,0x9D,0x06,0xBA,0x44,0xE2,0x7E,0xA3,0xD0,0x67,0x8C,0xF4,0x18,0x43,0x6C, - 0x3F,0x02,0xE8,0x12,0x89,0x07,0xCC,0x22,0xDB,0x89,0x05,0xBA,0x4E,0x3D,0xF5,0xA8, - 0x31,0x33,0x6D,0x96,0x72,0x1F,0xDD,0x6C,0x1F,0xBA,0xF4,0xC5,0x67,0xE2,0xAE,0x29, - 0xB3,0x58,0xAF,0xE4,0x8C,0xAE,0xE0,0x29,0x74,0x69,0x8A,0xAF,0x9C,0x07,0x12,0x7E, - 0xC7,0x76,0x05,0x2B,0x78,0x40,0x97,0x9A,0x98,0x6C,0x32,0x4F,0xCE,0x1B,0x2B,0xF8, - 0x40,0x97,0x82,0x78,0xDD,0xDE,0x21,0x9B,0xCC,0xAA,0x55,0x65,0x1D,0x00,0x5D,0x52, - 0x71,0x49,0xEC,0x93,0x4D,0x86,0x15,0x18,0xD0,0x25,0x15,0x93,0x4D,0x86,0x9D,0x86, - 0x81,0x2E,0x46,0xBC,0x20,0x2A,0x6C,0x27,0x08,0xD9,0x64,0xA6,0xAC,0x12,0x2B,0x84, - 0x81,0x4E,0x2B,0x2E,0x5A,0x4B,0x9F,0x6E,0xCD,0x9F,0x78,0xD9,0xB8,0x67,0xA7,0x1E, - 0x77,0x8D,0x57,0xFF,0xD4,0x4F,0xCD,0x35,0x59,0x41,0x09,0x74,0x6A,0xF1,0xA6,0x38, - 0xA0,0x79,0x32,0xA2,0xE9,0x04,0x0B,0x1E,0x74,0x20,0x33,0x6D,0x6D,0xB0,0x82,0x12, - 0xE8,0x14,0xE2,0x35,0x7B,0x9B,0x86,0xB1,0xB8,0xCD,0x31,0x6B,0xCE,0xEF,0x1C,0x3B, - 0x37,0xB4,0x29,0x83,0xEB,0xD1,0x40,0xA7,0x10,0x0B,0xD7,0xA1,0x61,0xAA,0x14,0xBE, - 0xDD,0x2E,0xAD,0x28,0x2F,0x8D,0x77,0x5C,0x8F,0x06,0x3A,0xF5,0x53,0xD3,0x3C,0x4D, - 0x66,0xED,0x32,0x7D,0xC9,0x1C,0x8A,0xEB,0xE0,0xF5,0x08,0xA0,0xD3,0xFE,0x5C,0xBB, - 0xE2,0x9C,0xA6,0xB6,0x90,0x2D,0x71,0xCA,0xAE,0xEB,0x80,0x4E,0x2B,0xF6,0xA1,0xC1, - 0x71,0xA9,0xA6,0x2E,0xF6,0xB8,0x75,0x9E,0x69,0xBC,0x3E,0x7B,0xE2,0x82,0xDD,0xD2, - 0x01,0x5D,0xBC,0xD8,0x87,0x0C,0x9A,0x1C,0x89,0x1B,0xD6,0xD7,0x01,0x5D,0xAB,0x62, - 0x0F,0x92,0xA8,0x92,0xE6,0xCF,0xA5,0x84,0x3C,0xA1,0x54,0xAC,0x23,0xD6,0xD4,0x01, - 0x5D,0x7B,0xE2,0xC1,0xDA,0x24,0xA9,0x7E,0x66,0xC2,0x5C,0x61,0x4D,0x1D,0xD0,0xB5, - 0x27,0xF6,0xB8,0x16,0x8F,0x64,0x0B,0x84,0x75,0x22,0x80,0xAE,0x6D,0xB1,0x07,0xD9, - 0x64,0xC6,0xCD,0x65,0x56,0x88,0x00,0xBA,0x44,0xE2,0xF9,0x7A,0x99,0x1D,0xC5,0x02, - 0xDD,0x6F,0xC4,0x49,0x80,0xEE,0x5F,0xDC,0x69,0xA0,0xFB,0x03,0xE2,0xAC,0xE1,0xEB, - 0xCC,0xE0,0xEB,0x6C,0x38,0xC9,0x7F,0x01,0x57,0x74,0xDC,0x0C,0x35,0x64,0x6D,0xA8, - 0x00,0x00,0x00,0x00,0x49,0x45,0x4E,0x44,0xAE,0x42,0x60,0x82 -}; -const unsigned int img_size_ok = sizeof(img_ok); - -const unsigned char img_cancel[] = { - 0x89,0x50,0x4E,0x47,0x0D,0x0A,0x1A,0x0A,0x00,0x00,0x00,0x0D,0x49,0x48,0x44,0x52, - 0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x28,0x08,0x02,0x00,0x00,0x00,0x03,0x9C,0x2F, - 0x3A,0x00,0x00,0x00,0x01,0x73,0x52,0x47,0x42,0x00,0xAE,0xCE,0x1C,0xE9,0x00,0x00, - 0x00,0x04,0x67,0x41,0x4D,0x41,0x00,0x00,0xB1,0x8F,0x0B,0xFC,0x61,0x05,0x00,0x00, - 0x00,0x09,0x70,0x48,0x59,0x73,0x00,0x00,0x0E,0xC3,0x00,0x00,0x0E,0xC3,0x01,0xC7, - 0x6F,0xA8,0x64,0x00,0x00,0x01,0xF8,0x49,0x44,0x41,0x54,0x58,0x47,0xED,0xD8,0x3D, - 0x6B,0xC2,0x50,0x18,0x05,0x60,0x13,0x13,0x93,0x76,0xF5,0x1F,0x74,0x11,0x1C,0x74, - 0x73,0x2D,0x1D,0xBA,0xB6,0x85,0xB6,0x8A,0x51,0x04,0x1D,0x1C,0x85,0x0E,0x5D,0x0A, - 0x45,0xEC,0x60,0x71,0x72,0x2F,0xD4,0xA1,0x9B,0x58,0x8A,0xBA,0x76,0x72,0xED,0x26, - 0xFE,0x8B,0x2E,0x05,0x11,0x12,0x3F,0xE2,0xED,0x6D,0x72,0xD2,0x26,0x7E,0xE5,0x0A, - 0x36,0x52,0xEA,0x33,0xE8,0x79,0x83,0x78,0xC2,0x8D,0x31,0x51,0xAE,0xE5,0xDB,0x0E, - 0x1E,0xCF,0x9E,0xDB,0x5A,0xF1,0xCF,0x52,0x1F,0x9F,0x9E,0x22,0xFD,0xA6,0xD7,0x16, - 0x0A,0xFF,0xDF,0x52,0xEF,0x8A,0x3D,0xF3,0x47,0x8A,0xC5,0x48,0x04,0x69,0x11,0xE1, - 0xF2,0xD2,0x7F,0x72,0x82,0xC1,0x0D,0x6B,0xB1,0xA4,0x28,0x72,0xBD,0x2E,0xDC,0xDD, - 0x49,0x37,0x37,0xD8,0x64,0x23,0x5E,0x5D,0xED,0x35,0x9B,0x62,0x2A,0x15,0xC8,0xE5, - 0xB0,0xC9,0x0D,0x53,0xB1,0x5C,0xA9,0xF0,0xF1,0x38,0x27,0x49,0x34,0xF3,0xB1,0x58, - 0x20,0x9D,0x36,0xB7,0x9B,0x68,0xA5,0x70,0x78,0x68,0x66,0x32,0x18,0x98,0xC1,0x95, - 0x7B,0xB1,0x9C,0x4A,0x71,0xA1,0x10,0x06,0x83,0xFF,0xE2,0x42,0x38,0x38,0xA0,0x81, - 0x1F,0x8D,0xE4,0x97,0x17,0x73,0xA3,0x49,0x73,0xEE,0xD3,0x0A,0xEE,0xC5,0x64,0x38, - 0x44,0xB2,0x11,0xEE,0xEF,0xBF,0x1E,0xAF,0xAF,0x39,0xFE,0xE7,0x1D,0xC6,0xED,0x36, - 0x12,0x03,0xF7,0xE2,0xE1,0xF3,0x33,0xE9,0x76,0x31,0x58,0xE8,0xB2,0xCB,0x8F,0x8F, - 0xFE,0xA3,0x23,0xCC,0xC6,0xFE,0x4D,0x6A,0x35,0x0C,0x0C,0x98,0x8E,0xB1,0x56,0x2C, - 0x92,0xF7,0x77,0x0C,0x16,0x2E,0x18,0x44,0x32,0x68,0x89,0x04,0x12,0x1B,0xA6,0x62, - 0x4A,0xCB,0xE7,0xC9,0xC7,0x07,0x86,0x39,0x7A,0xA7,0x83,0xC4,0x8C,0xB5,0x98,0xD2, - 0xB2,0x59,0xD2,0xEF,0x63,0x70,0x1A,0x55,0xAB,0x48,0xCC,0xD6,0x28,0xA6,0xB4,0x4C, - 0x06,0xC9,0x49,0x88,0xC7,0x91,0x98,0xAD,0x2A,0xE6,0x44,0x11,0xC9,0x66,0x7C,0x7B, - 0x8B,0x64,0x23,0x2A,0x0A,0x21,0x04,0x03,0x9B,0x55,0xC5,0xF4,0x83,0x6A,0x3F,0x5B, - 0x4C,0x93,0x5E,0x0F,0xC9,0x69,0xDF,0xBA,0xB5,0x60,0xB4,0x72,0xA9,0x79,0x9E,0x4C, - 0xA7,0xC8,0x16,0xA9,0x54,0x42,0x9A,0x13,0x58,0xF4,0x6D,0xBA,0xCC,0x7A,0xC7,0x98, - 0xE2,0xA3,0x51,0xA4,0x39,0xFE,0x58,0x8C,0x0B,0x87,0x31,0xB8,0x59,0xAF,0x98,0x7E, - 0x2D,0x23,0x19,0x88,0xAE,0x23,0x59,0xE4,0x72,0x19,0xC9,0xCD,0x1A,0xC5,0x33,0xAD, - 0x6A,0x32,0xA9,0x9D,0x9F,0x63,0xB0,0x91,0x9D,0x2F,0x5B,0x86,0xB5,0x58,0x6E,0x34, - 0x90,0x0C,0xEA,0xD9,0x99,0x4F,0x55,0x11,0x9C,0x38,0xBA,0xE6,0x0C,0x67,0x17,0x6B, - 0xF1,0xF7,0xA9,0x35,0xE9,0x74,0x66,0xCA,0xF4,0xB7,0x37,0x24,0x4B,0x40,0x51,0x90, - 0x96,0xDB,0xCC,0x0D,0xFD,0xCC,0x51,0x18,0x3D,0x3D,0xE9,0xCE,0xCB,0xE5,0xB7,0x0D, - 0xDF,0xD0,0xAB,0x85,0x02,0x12,0xBD,0x9A,0x3D,0x3C,0x2C,0x6B,0xB5,0xDB,0xFD,0x84, - 0xF1,0xCC,0xAE,0xD8,0x33,0x5B,0x2B,0xDE,0xFD,0xF9,0xE2,0x11,0x9F,0xEF,0x13,0x73, - 0x58,0x88,0xAC,0x57,0x96,0x5C,0x12,0x00,0x00,0x00,0x00,0x49,0x45,0x4E,0x44,0xAE, - 0x42,0x60,0x82 -}; -const unsigned int img_size_cancel = sizeof(img_cancel); - -const unsigned char img_repeat[] = { - 0x89,0x50,0x4E,0x47,0x0D,0x0A,0x1A,0x0A,0x00,0x00,0x00,0x0D,0x49,0x48,0x44,0x52, - 0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x28,0x08,0x02,0x00,0x00,0x00,0x03,0x9C,0x2F, - 0x3A,0x00,0x00,0x00,0x01,0x73,0x52,0x47,0x42,0x00,0xAE,0xCE,0x1C,0xE9,0x00,0x00, - 0x00,0x04,0x67,0x41,0x4D,0x41,0x00,0x00,0xB1,0x8F,0x0B,0xFC,0x61,0x05,0x00,0x00, - 0x00,0x09,0x70,0x48,0x59,0x73,0x00,0x00,0x0E,0xC3,0x00,0x00,0x0E,0xC3,0x01,0xC7, - 0x6F,0xA8,0x64,0x00,0x00,0x00,0x18,0x74,0x45,0x58,0x74,0x53,0x6F,0x66,0x74,0x77, - 0x61,0x72,0x65,0x00,0x70,0x61,0x69,0x6E,0x74,0x2E,0x6E,0x65,0x74,0x20,0x34,0x2E, - 0x30,0x2E,0x35,0x65,0x85,0x32,0x65,0x00,0x00,0x03,0xBC,0x49,0x44,0x41,0x54,0x58, - 0x47,0xC5,0x96,0xDB,0x4B,0x14,0x51,0x18,0xC0,0x8D,0xC8,0x6B,0x66,0xDE,0xD2,0x4C, - 0xCB,0x92,0x12,0xA9,0x28,0x33,0x0D,0x83,0x1E,0xA2,0x07,0xC9,0x0C,0xB2,0xE8,0x42, - 0x06,0x15,0x51,0x10,0x81,0x4A,0x51,0x16,0xDD,0xAC,0x97,0xDE,0x83,0x1E,0x24,0xF7, - 0x7E,0x71,0x35,0x6F,0x85,0x9A,0xE6,0x25,0xBB,0x78,0xB7,0xB0,0xB7,0xA8,0x99,0x33, - 0x33,0x8E,0xEB,0xAE,0xAB,0xDB,0x93,0x7F,0x40,0x9F,0x8E,0x7E,0xDA,0xD9,0xD9,0x99, - 0xDD,0x45,0x37,0xF8,0x31,0xEC,0x7C,0x67,0x66,0x7F,0xE7,0x32,0xE7,0xFB,0x4E,0xC8, - 0xCF,0x96,0xFF,0x03,0x7D,0x1F,0x34,0xE8,0xFB,0xA0,0xB1,0xF4,0x6B,0x76,0x36,0x27, - 0x08,0xA0,0x2E,0x00,0xF1,0xC1,0xD9,0xD9,0x5C,0x8F,0x20,0x90,0x37,0x0F,0x15,0xA4, - 0x41,0x5D,0x00,0x62,0x6F,0x1C,0x5A,0xEC,0x93,0x6C,0xB7,0x16,0x40,0xDD,0x0A,0x8A, - 0x25,0x24,0x3D,0x15,0x5C,0x02,0x75,0x2B,0x2E,0x56,0x01,0x75,0x0A,0x62,0xA5,0x8E, - 0x03,0x39,0xCD,0x22,0x15,0xF1,0x05,0xD4,0x29,0x88,0x95,0x28,0x6A,0x9F,0x8C,0xD4, - 0x32,0x54,0xD0,0x17,0x50,0x27,0x2B,0x56,0x19,0xEB,0xB9,0x2E,0xE7,0x76,0x1B,0xBF, - 0x5E,0xC7,0x16,0x77,0x3A,0x2B,0x86,0xDC,0xCF,0xBE,0xFF,0xA1,0x1E,0x50,0x00,0x75, - 0x7E,0x8B,0x8B,0xDA,0x1D,0x19,0x36,0x21,0xD6,0x48,0x92,0xCC,0x24,0xB5,0x86,0x4F, - 0xB7,0x09,0xDB,0x6D,0xC2,0xFE,0x46,0xB1,0xB0,0x7D,0xB2,0xAC,0xDF,0x45,0x3D,0xEC, - 0x09,0xEA,0x64,0xC5,0xF2,0xDC,0x1B,0x9E,0x81,0x81,0x46,0x69,0x49,0x92,0x89,0x4B, - 0xAF,0xE1,0x77,0xD8,0x78,0xB8,0xA6,0x59,0xB9,0xCD,0x66,0x6E,0x93,0x89,0xC4,0x1A, - 0x08,0xCC,0xC1,0x56,0x2B,0x7F,0xAB,0x6F,0x9A,0x7A,0x71,0x39,0xA8,0xF3,0x14,0x7B, - 0x4D,0x02,0x77,0x06,0x67,0x52,0x2C,0x5C,0x68,0x35,0x93,0x68,0x24,0x20,0x48,0xB5, - 0xCC,0xE9,0x81,0x2D,0x16,0x3E,0xC1,0xC8,0xC5,0xE8,0x49,0x94,0x8E,0x8D,0x31,0x90, - 0x9C,0x26,0xB1,0xB4,0xDF,0xAB,0x1B,0x75,0x9E,0x62,0xA5,0xED,0x5F,0xFC,0xC1,0xB1, - 0xB3,0x96,0x4F,0x31,0x73,0x89,0x26,0x98,0x6A,0xEE,0xF8,0x7B,0xFB,0xE5,0xDE,0xA9, - 0x92,0x9E,0xA9,0xC2,0x76,0x47,0x6E,0x93,0x08,0xA3,0x8F,0x33,0x92,0x78,0x23,0xD9, - 0x55,0x27,0x2C,0x7B,0x2B,0x7F,0xD9,0xEF,0x80,0xA6,0x5A,0xA2,0xBC,0x7F,0x3A,0xB3, - 0x96,0x0F,0xD7,0x30,0x20,0xA6,0x9A,0xF2,0xDF,0x8A,0xC9,0x66,0x2E,0x5A,0x47,0xE2, - 0x0C,0x24,0xBB,0x51,0x7E,0xB3,0xA1,0xCE,0x6F,0xB1,0x44,0x41,0x9B,0x3D,0x5C,0xC3, - 0x52,0x41,0xE0,0x68,0xAB,0x3D,0xD1,0xC4,0xC1,0x7A,0xC7,0x19,0xB8,0xDB,0x03,0x33, - 0x54,0x2B,0x80,0xBA,0x00,0xC5,0x40,0xBE,0x5C,0x02,0x79,0x38,0xE2,0x3E,0xD8,0x24, - 0x82,0x38,0xB4,0x9A,0x3D,0xD3,0xE9,0x5C,0x8C,0x2F,0x2D,0x1F,0xEA,0x02,0x17,0x7B, - 0x03,0x36,0x55,0x8C,0x81,0x8D,0xD0,0xB2,0xB9,0xCD,0x62,0xE5,0x37,0x37,0xD5,0x8A, - 0xBA,0x95,0x17,0x03,0xA9,0x56,0x7E,0xA3,0x81,0x64,0xD5,0x09,0xD7,0x3E,0x4D,0x51, - 0x4D,0xA8,0x5B,0x15,0x71,0x46,0xAD,0x00,0xDF,0x76,0x86,0x8D,0x3F,0xDB,0xE5,0xA0, - 0x9A,0x50,0xB7,0x4A,0x62,0x7E,0x4E,0x5C,0x2B,0x9C,0xEB,0xC6,0x65,0x5E,0x00,0x75, - 0xAB,0x22,0x86,0xF4,0x12,0xAD,0x27,0x7B,0x1B,0xC6,0xCB,0x07,0x26,0xE7,0x23,0x50, - 0xA4,0x17,0x9A,0x50,0xA7,0x22,0x2E,0x6C,0xB5,0xE7,0x37,0x89,0x25,0x1E,0x1D,0x57, - 0xE0,0xD1,0x88,0x3B,0xC1,0xC4,0xC1,0x66,0x3B,0xD6,0x6A,0xA7,0x9A,0x00,0xD4,0x29, - 0x89,0x5F,0xFE,0xE8,0x8A,0xAE,0xFA,0x1D,0xF2,0xEA,0x57,0xA6,0x8D,0xA7,0x9A,0x14, - 0x38,0xD9,0x31,0x19,0xA1,0x63,0xD7,0xBE,0x66,0xAF,0xF6,0xCA,0xD4,0x0C,0xD4,0x29, - 0x89,0x81,0x38,0x3D,0x1B,0x56,0xCD,0xA4,0x59,0xF8,0x82,0x36,0x69,0xD2,0x54,0xB8, - 0xD2,0xEB,0xDC,0x62,0xE1,0xA0,0x5A,0xC4,0x1B,0xB9,0x07,0xC3,0xD2,0x5E,0xFA,0x27, - 0x07,0xA3,0x4E,0x45,0x7C,0xA0,0x91,0x40,0x26,0x82,0x1A,0x00,0xEE,0xC7,0x23,0xF4, - 0xA6,0xF4,0x64,0x5F,0xC3,0x78,0x98,0x86,0x89,0xD5,0x93,0x13,0x1D,0xF2,0x1D,0x45, - 0x9D,0x8A,0xF8,0xEE,0xE0,0x58,0xD6,0x1B,0x01,0x46,0x00,0x64,0x37,0x8C,0xDF,0x1F, - 0x96,0xC9,0x82,0x12,0x15,0x43,0xD3,0xC9,0xE6,0xB9,0xCA,0x18,0xA9,0x65,0xB7,0x59, - 0xBC,0x2E,0x0D,0xEA,0x54,0xC4,0xC0,0xA9,0x8E,0x89,0x30,0x0D,0x1B,0xA3,0x67,0xA1, - 0x00,0xC0,0x80,0x2E,0x7D,0x74,0xBE,0x18,0xFB,0xE7,0xC8,0xF1,0x74,0xD4,0x0D,0x55, - 0x6B,0xF7,0x1B,0x61,0x83,0x9E,0x0D,0xD7,0xB2,0x7B,0xEA,0x85,0xB2,0x3E,0x5C,0x5D, - 0xFA,0x4C,0x81,0x3A,0x75,0x31,0x70,0xB4,0xC5,0x9E,0x68,0x84,0xB2,0xC3,0x42,0x12, - 0xDE,0x66,0xE5,0x8F,0xBC,0x9B,0x38,0xDF,0xED,0x28,0xED,0x73,0x5D,0xFF,0xEC,0x3A, - 0xFD,0x61,0xAE,0x20,0xC2,0x59,0x00,0x06,0x1A,0xA1,0x61,0xF2,0x9A,0xC5,0xBB,0x43, - 0x5E,0x67,0x05,0x40,0x9D,0x4F,0x62,0x60,0x5F,0xBD,0x98,0x3C,0x5F,0x76,0x20,0x33, - 0x6C,0xD0,0x13,0x48,0xC5,0xEB,0xAA,0x19,0x00,0xB6,0x0D,0x4C,0x2F,0x8C,0x15,0xD6, - 0x75,0xAB,0x99,0x7B,0xEE,0x91,0x9C,0x29,0x50,0xE7,0xAB,0x18,0x80,0x32,0x07,0x03, - 0x4A,0xB1,0x72,0x51,0x3A,0xB2,0xF6,0x35,0xB3,0xA6,0x8A,0x81,0x2B,0x58,0xE1,0x33, - 0x3E,0xFC,0x76,0xA2,0x54,0xF1,0xC4,0x83,0xA0,0xCE,0x0F,0xB1,0xC4,0x93,0x51,0xF7, - 0x8D,0x2F,0xAE,0x0B,0xDD,0xCE,0xB3,0x9D,0x8E,0x8B,0x3D,0xCE,0x9B,0x5F,0x5D,0x95, - 0xA3,0xEA,0x5F,0x3B,0x82,0x3A,0xBF,0xC5,0x6A,0xA8,0x1C,0x8D,0x51,0xE7,0x8B,0x58, - 0xE5,0xBF,0xFC,0x02,0x75,0xBE,0x88,0x01,0x70,0x43,0x02,0x92,0xED,0x01,0x04,0x25, - 0xA8,0xB8,0x3C,0xA8,0xF3,0x51,0xBC,0x62,0xA0,0x6E,0x49,0x1C,0x64,0xE8,0xFB,0xA0, - 0x41,0xDF,0x07,0x89,0x96,0x90,0xBF,0x89,0x72,0xE6,0x27,0x5C,0x0A,0x6C,0x17,0x00, - 0x00,0x00,0x00,0x49,0x45,0x4E,0x44,0xAE,0x42,0x60,0x82 -}; -const unsigned int img_size_repeat = sizeof(img_repeat); - -#endif /* if defined(DM_BOARD_USE_BUILTIN_IMAGES) */
--- a/Application/basic_image_data.h Mon Mar 09 14:24:54 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -extern const unsigned char img_ok[]; -extern const unsigned int img_size_ok; - -extern const unsigned char img_cancel[]; -extern const unsigned int img_size_cancel; - -extern const unsigned char img_repeat[]; -extern const unsigned int img_size_repeat;
--- a/SlideShow/AppSlideShow.cpp Mon Mar 09 14:24:54 2015 +0000 +++ b/SlideShow/AppSlideShow.cpp Fri Mar 20 14:25:46 2015 +0100 @@ -17,7 +17,7 @@ #include "mbed.h" #include "AppSlideShow.h" -#include "basic_image_data.h" + /****************************************************************************** * Defines and typedefs @@ -25,8 +25,6 @@ #define TICKER_RESOLUTION_IN_MS 10 -#define BTN_WIDTH 40 -#define BTN_HEIGHT 40 #define BTN_OFF 20 /****************************************************************************** @@ -98,10 +96,10 @@ err = _show->prepare(_script); } - _btnRepeat = new ImageButton((COLOR_T*)_fb, _disp->width() - 2*BTN_OFF - 2*BTN_WIDTH, _disp->height() - BTN_OFF - BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT); - _btnRepeat->loadImages(img_repeat, img_size_repeat); - _btnDone = new ImageButton((COLOR_T*)_fb, _disp->width() - BTN_OFF - BTN_WIDTH, _disp->height() - BTN_OFF - BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT); - _btnDone->loadImages(img_ok, img_size_ok); + _btnRepeat = new ImageButton((COLOR_T*)_fb, _disp->width() - 2*BTN_OFF - _resOk->width() - _resRepeat->width(), _disp->height() - BTN_OFF - _resRepeat->height(), _resRepeat->width(), _resRepeat->height()); + _btnRepeat->loadImages(_resRepeat); + _btnDone = new ImageButton((COLOR_T*)_fb, _disp->width() - BTN_OFF - _resOk->width(), _disp->height() - BTN_OFF - _resOk->height(), _resOk->width(), _resOk->height()); + _btnDone->loadImages(_resOk); return (err == SlideShow::Ok); } @@ -183,3 +181,12 @@ } +void AppSlideShow::addResource(Resources id, Resource* res) +{ + if (id == Resource_Ok_button) { + _resOk = res; + } else { + _resRepeat = res; + } +} +
--- a/SlideShow/AppSlideShow.h Mon Mar 09 14:24:54 2015 +0000 +++ b/SlideShow/AppSlideShow.h Fri Mar 20 14:25:46 2015 +0100 @@ -22,6 +22,7 @@ #include "SlideShow.h" #include "rtos.h" #include "ImageButton.h" +#include "Resource.h" /** * An App example showing how to use the SlideShow engine. @@ -45,6 +46,22 @@ virtual void runToCompletion(); virtual bool teardown(); + enum Resources { + Resource_Ok_button, + Resource_Repeat_button, + }; + + /** Specifies the resource to use + * + * Adds a resource for a specific id. This allows the + * user program to select e.g. which image to use and + * if it should be loaded from a file or an array. + * + * @param id the identifier + * @param res the resource + */ + void addResource(Resources id, Resource* res); + private: void* _fb; Display* _disp; @@ -57,6 +74,8 @@ char* _path; int _xoff; int _yoff; + Resource* _resOk; + Resource* _resRepeat; }; #endif
--- a/lpc_swim/lpc_swim.c Mon Mar 09 14:24:54 2015 +0000 +++ b/lpc_swim/lpc_swim.c Fri Mar 20 14:25:46 2015 +0100 @@ -37,6 +37,8 @@ * Private types/enumerations/variables ****************************************************************************/ +static const FONT_T* defaultFont = (FONT_T*)&font_helvr10; + /***************************************************************************** * Public types/enumerations/variables ****************************************************************************/ @@ -184,7 +186,7 @@ } /* Use the default font and make background transparent */ - win->font = (FONT_T *) &font_helvr10; + win->font = (FONT_T*)defaultFont; /* Set starting text position in upper left of window */ win->xvpos = win->xpvmin; @@ -579,6 +581,12 @@ win->bkg = bkg_color; } +/* Sets the font to be used for all new windows */ +void swim_set_default_font(const FONT_T* def_font) +{ + defaultFont = def_font; +} + /* Get the virtual window horizontal size */ int32_t swim_get_horizontal_size(SWIM_WINDOW_T *win) {
--- a/lpc_swim/lpc_swim.h Mon Mar 09 14:24:54 2015 +0000 +++ b/lpc_swim/lpc_swim.h Fri Mar 20 14:25:46 2015 +0100 @@ -165,7 +165,7 @@ /** * @brief Initializes a window and the default values for the window - * @param win s: Pointer to window data structure + * @param win : Pointer to window data structure * @param xsize : Physical horizontal dimension of the display * @param ysize : Physical vertical dimension of the display * @param fbaddr : Address of the display's frame buffer @@ -260,6 +260,13 @@ COLOR_T bkg_color); /** + * @brief Sets the font to be used for all new windows + * @param def_font : New default font + * @return Nothing + */ +void swim_set_default_font(const FONT_T* def_font); + +/** * @brief Get the virtual window horizontal size * @param win : Pointer to window data structure * @return The virtual window horizontal size