2013-07-01 08:10:45 +00:00
|
|
|
/*
|
|
|
|
* This file is subject to the terms of the GFX License. If a copy of
|
|
|
|
* the license was not distributed with this file, you can obtain one at:
|
|
|
|
*
|
2013-07-21 20:20:37 +00:00
|
|
|
* http://ugfx.org/license.html
|
2013-07-01 08:10:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file include/gwin/image.h
|
|
|
|
* @brief GWIN image widget header file.
|
|
|
|
*
|
|
|
|
* @defgroup Image Image
|
|
|
|
* @ingroup GWIN
|
|
|
|
*
|
|
|
|
* @details GWIN allos it to create an image widget. The widget
|
|
|
|
* takes no user input.
|
|
|
|
*
|
2013-07-01 15:40:31 +00:00
|
|
|
* @pre GFX_USE_GDISP must be set to TRUE in your gfxconf.h
|
2013-07-01 08:10:45 +00:00
|
|
|
* @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h
|
2013-07-01 15:40:31 +00:00
|
|
|
* @pre GDISP_NEED_IMAGE must be set to TRUE in your gfxconf.h
|
2013-07-01 08:10:45 +00:00
|
|
|
* @pre GWIN_NEED_IMAGE must be set to TRUE in your gfxconf.h
|
2013-07-01 15:40:31 +00:00
|
|
|
* @pre At least one image type must be enabled in your gfxconf.h
|
2013-07-01 08:10:45 +00:00
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GWIN_IMAGE_H
|
|
|
|
#define _GWIN_IMAGE_H
|
|
|
|
|
|
|
|
// This file is included within "gwin/gwin.h"
|
|
|
|
|
|
|
|
// An image window
|
2013-07-07 09:40:37 +00:00
|
|
|
typedef struct GImageObject {
|
2013-07-01 08:10:45 +00:00
|
|
|
GWindowObject g;
|
2013-07-18 23:37:50 +00:00
|
|
|
gdispImage image; // The image itself
|
|
|
|
#if GWIN_NEED_IMAGE_ANIMATION
|
|
|
|
GTimer timer; // Timer used for animated images
|
|
|
|
#endif
|
2013-07-07 09:40:37 +00:00
|
|
|
} GImageObject;
|
2013-07-01 08:10:45 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-07-01 15:40:31 +00:00
|
|
|
/**
|
|
|
|
* @brief Create an image widget.
|
2013-07-07 09:40:37 +00:00
|
|
|
* @details Display's a picture.
|
2013-07-01 15:40:31 +00:00
|
|
|
* @return NULL if there is no resultant drawing area, otherwise the widget handle.
|
|
|
|
*
|
2013-10-24 08:36:11 +00:00
|
|
|
* @param[in] g The GDisplay to display this window on
|
2013-07-01 15:40:31 +00:00
|
|
|
* @param[in] widget The image widget structure to initialise. If this is NULL, the structure is dynamically allocated.
|
|
|
|
* @param[in] pInit The initialization parameters to use.
|
|
|
|
*
|
|
|
|
* @note The default background color gets set to the current default one.
|
2013-07-03 14:20:32 +00:00
|
|
|
* @note An image window knows how to redraw.
|
2013-07-01 15:40:31 +00:00
|
|
|
*
|
|
|
|
* @api
|
2013-07-03 14:20:32 +00:00
|
|
|
*/
|
2013-10-24 08:36:11 +00:00
|
|
|
GHandle gwinGImageCreate(GDisplay *g, GImageObject *widget, GWindowInit *pInit);
|
|
|
|
#define gwinImageCreate(w, pInit) gwinGImageCreate(GDISP, w, pInit)
|
2013-07-01 15:40:31 +00:00
|
|
|
|
|
|
|
/**
|
2013-07-07 09:40:37 +00:00
|
|
|
* @brief Sets the input routines that support reading the image from memory
|
2013-07-01 15:40:31 +00:00
|
|
|
* in RAM or flash.
|
|
|
|
* @return TRUE if the IO open function succeeds
|
|
|
|
*
|
|
|
|
* @param[in] gh The widget (must be an image widget)
|
2013-07-01 15:42:31 +00:00
|
|
|
* @param[in] memory A pointer to the image in RAM or Flash
|
2013-07-01 15:40:31 +00:00
|
|
|
*
|
|
|
|
* @api
|
|
|
|
*/
|
|
|
|
bool_t gwinImageOpenMemory(GHandle gh, const void* memory);
|
|
|
|
|
2013-07-23 16:52:52 +00:00
|
|
|
#if defined(WIN32) || GFX_USE_OS_WIN32 || GFX_USE_OS_LINUX || GFX_USE_OS_OSX || defined(__DOXYGEN__)
|
2013-07-01 15:40:31 +00:00
|
|
|
/**
|
2013-07-07 09:40:37 +00:00
|
|
|
* @brief Sets the input routines that support reading the image from a file
|
2013-07-01 15:40:31 +00:00
|
|
|
* @return TRUE if the IO open function succeeds
|
|
|
|
*
|
|
|
|
* @param[in] gh The widget (must be an image widget)
|
2013-07-01 15:42:31 +00:00
|
|
|
* @param[in] filename The filename to open
|
2013-07-01 15:40:31 +00:00
|
|
|
*
|
|
|
|
* @api
|
|
|
|
*/
|
|
|
|
bool_t gwinImageOpenFile(GHandle gh, const char* filename);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if GFX_USE_OS_CHIBIOS || defined(__DOXYGEN__)
|
|
|
|
/**
|
2013-07-07 09:40:37 +00:00
|
|
|
* @brief Sets the input routines that support reading the image from a BaseFileStream (eg. an SD-Card).
|
2013-07-01 15:40:31 +00:00
|
|
|
* @return TRUE if the IO open function succeeds
|
|
|
|
*
|
|
|
|
* @param[in] gh The widget (must be an image widget)
|
2013-07-01 15:42:31 +00:00
|
|
|
* @param[in] streamPtr A pointer to the (open) BaseFileStream object.
|
2013-07-01 15:40:31 +00:00
|
|
|
*
|
|
|
|
* @api
|
|
|
|
*/
|
|
|
|
bool_t gwinImageOpenStream(GHandle gh, void *streamPtr);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2013-07-03 14:20:32 +00:00
|
|
|
* @brief Cache the image.
|
2013-07-01 15:40:31 +00:00
|
|
|
* @details Decodes and caches the current frame into RAM.
|
|
|
|
*
|
2013-07-17 02:44:29 +00:00
|
|
|
* @param[in] gh The widget (must be an image widget)
|
2013-07-01 15:40:31 +00:00
|
|
|
*
|
|
|
|
* @return GDISP_IMAGE_ERR_OK (0) on success or an error code.
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
*/
|
|
|
|
gdispImageError gwinImageCache(GHandle gh);
|
|
|
|
|
2013-07-01 08:10:45 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // _GWIN_IMAGE_H
|
|
|
|
/** @} */
|
|
|
|
|