13 #include "../../gfx.h"
15 #if GFX_USE_GWIN && GWIN_NEED_IMAGE
17 #include "gwin_class.h"
19 #define gw ((GImageObject *)gh)
23 #if GWIN_NEED_IMAGE_ANIMATION
30 #if GWIN_NEED_IMAGE_ANIMATION
31 static void ImageTimer(
void *param) {
36 static void ImageRedraw(
GHandle gh) {
39 #if GWIN_NEED_IMAGE_ANIMATION
59 if (gw->image.width < w) {
70 else if (gw->image.width > w) {
71 dx = (gw->image.width - w)/2;
75 if (gw->image.height < h) {
86 else if (gw->image.height > h) {
87 dy = (gw->image.height - h)/2;
96 #if GWIN_NEED_IMAGE_ANIMATION
111 gtimerStart(&gw->timer, ImageTimer, (
void*)gh, gFalse, delay);
117 static const gwinVMT imageVMT = {
119 sizeof(GImageObject),
126 if (!(gobj = (GImageObject *)_gwindowCreate(g, &gobj->g, pInit, &imageVMT, 0)))
133 #if GWIN_NEED_IMAGE_ANIMATION
161 return GDISP_IMAGE_ERR_BADFORMAT;
COLOR_TYPE gColor
The color type definition.
void gdispGFillArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color)
Fill an area with a color.
gI16 gCoord
The type for a coordinate or length on the screen.
struct GFILE GFILE
A file pointer.
void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, gBool periodic, gDelay millisec)
Set a timer going or alter its properties if it is already going.
void gtimerInit(GTimer *pt)
Initialise a timer.
void gtimerStop(GTimer *pt)
Stop a timer (periodic or otherwise)
gdispImageError gwinImageCache(GHandle gh)
Cache the image.
GHandle gwinGImageCreate(GDisplay *g, GImageObject *widget, GWindowInit *pInit)
Create an image widget.
gBool gwinImageOpenGFile(GHandle gh, GFILE *f)
Opens the image using a GFILE.
gdispImageError gdispImageCache(gImage *img)
Cache the image.
gdispImageError gdispImageOpenGFile(gImage *img, GFILE *f)
Open an image using an open GFILE and get it ready for drawing.
gdispImageError gdispGImageDraw(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy)
Draw the image.
void gdispImageInit(gImage *img)
Initialise a gImage object.
gU16 gdispImageError
An image error code.
gDelay gdispImageNext(gImage *img)
Prepare for the next frame/page in the image file.
gBool gdispImageIsOpen(gImage *img)
Is an image open.
void gdispImageClose(gImage *img)
Close an image and release any dynamically allocated working storage.
void gdispImageSetBgColor(gImage *img, gColor bgcolor)
Set the background color of the image.
void gwinSetVisible(GHandle gh, gBool visible)
Sets whether a window is visible or not.
gColor gwinGetDefaultBgColor(void)
Get the default background color for all new GWIN windows.
The structure to initialise a GWIN.
A window object structure.
const struct gwinVMT * vmt
The Virtual Method Table for a GWIN window.