eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_picture.c
Go to the documentation of this file.
1 /**************************************************************************
2 *
3 * Copyright 2014 by Petr Gargulak. eGUI Community.
4 * Copyright 2009-2013 by Petr Gargulak. Freescale Semiconductor, Inc.
5 *
6 ***************************************************************************
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License Version 3
9 * or later (the "LGPL").
10 *
11 * As a special exception, the copyright holders of the eGUI project give you
12 * permission to link the eGUI sources with independent modules to produce an
13 * executable, regardless of the license terms of these independent modules,
14 * and to copy and distribute the resulting executable under terms of your
15 * choice, provided that you also meet, for each linked independent module,
16 * the terms and conditions of the license of that module.
17 * An independent module is a module which is not derived from or based
18 * on this library.
19 * If you modify the eGUI sources, you may extend this exception
20 * to your version of the eGUI sources, but you are not obligated
21 * to do so. If you do not wish to do so, delete this
22 * exception statement from your version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 *
28 * You should have received a copy of the GNU General Public License
29 * and the GNU Lesser General Public License along with this program.
30 * If not, see <http://www.gnu.org/licenses/>.
31 *
32 ***************************************************************************/
46 #include "d4d.h"
48 
49 //Internal API
50 void D4D_PictOnMessage(D4D_MESSAGE* pMsg);
52 
54 {
55  D4D_DEFSTR("Picture"),
57  NULL,
58  NULL
59 };
60 
61 /*******************************************************
62 *
63 * PICTURE Drawing routine
64 *
65 *******************************************************/
66 
67 static void D4D_PictOnDraw(D4D_MESSAGE* pMsg)
68 {
69  D4D_OBJECT* pThis = pMsg->pObject;
70  D4D_PICTURE* pPict = D4D_GET_PICTURE(pThis);
72  D4D_COLOR clrT = D4D_ObjectGetForeColor(pThis, pMsg->prm.draw);
73 
74  // Draw the frame if needed
76  D4D_DrawFrame(pThis, clrT, clrB);
77 
78  // draw the bitmap
79  if(pPict->pBmp != NULL)
80  {
81  D4D_GEOMETRY contentGeom;
82  D4D_ComputeGeometry(&contentGeom, pThis);
83 
84  D4D_DrawRBmpRect(&contentGeom.pnt, &contentGeom.sz, pPict->pBmp, (D4D_PIC_PRTY_DEFAULT), clrB, (D4D_BOOL)!D4D_IsEnabled(pThis), pThis->radius);
85  }
86 }
87 
88 /**************************************************************/
98 /*******************************************************
99 *
100 * The main PICTURE message handler
101 *
102 *******************************************************/
103 
105 {
106  switch(pMsg->nMsgId)
107  {
108  case D4D_MSG_DRAW:
109  D4D_PictOnDraw(pMsg);
110  break;
111 
112  default:
113  // call the default behavior
114  D4D_ObjOnMessage(pMsg);
115  }
116 }
117 
118 
119 
D4D_COLOR D4D_ObjectGetBckgFillColor(D4D_OBJECT *pObj)
Function return object current fill background color.
Definition: d4d_scheme.c:225
D4D_COLOR D4D_ObjectGetForeColor(D4D_OBJECT *pObj, D4D_OBJECT_DRAWFLAGS draw)
Function return object current fore color.
Definition: d4d_scheme.c:161
D4D object messages structure.
Definition: d4d_base.h:400
const D4D_BMP * pBmp
Definition: d4d_picture.h:80
The string type. This structure contains all properties about string in eGUI.
Definition: d4d_string.h:100
const D4D_OBJECT_SYS_FUNCTION d4d_pictSysFunc
Definition: d4d_picture.c:53
D4D_STRING * D4D_PictGetTextBuffer(D4D_OBJECT *pThis)
void D4D_DrawFrame(D4D_OBJECT *pObject, D4D_COLOR clrT, D4D_COLOR clrB)
Function draw standard object frame based on the object settings and current state.
struct D4D_OBJECT_S * pObject
Pointer to object who is receiver of this message. If the receiver is just screen this field must be ...
Definition: d4d_base.h:402
D4D Driver main header file.
#define D4D_OBJECT_DRAWFLAGS_COMPLETE
Draw complete flag.
Definition: d4d_base.h:361
D4D Driver private header file.
#define D4D_DEFSTR(str)
Macro that helps declare the strings in eGUI.
Definition: d4d_string.h:246
#define D4D_GET_PICTURE(pObj)
Definition: d4d_picture.h:89
#define D4D_OBJECT_DRAWFLAGS_STATE
Draw just change of state flag.
Definition: d4d_base.h:364
D4D_COOR radius
Object corners radius.
Definition: d4d_object.h:171
#define D4D_DrawRBmpRect(ppt,psz, pBmp, bmpProp, colorBkgd, greyScale, radius)
Definition: d4d.h:188
void D4D_ObjOnMessage(D4D_MESSAGE *pMsg)
Definition: d4d_object.c:443
#define NULL
Type definition of null pointer.
Definition: d4d_types.h:184
D4D_SIZE sz
Size of object.
Definition: d4d_types.h:240
D4D_MSGID nMsgId
Type of message.
Definition: d4d_base.h:404
D4D_POINT pnt
Left Top corner point.
Definition: d4d_types.h:239
The object main structure type definition.
Definition: d4d_object.h:167
Draw message - is send when the object should be redrawed.
Definition: d4d_base.h:371
void D4D_ComputeGeometry(D4D_GEOMETRY *pGeometry, D4D_OBJECT *pObject)
Definition: d4d_base.c:1047
The object system function needed for each object - this is part of D4D_OBJECT main structure...
Definition: d4d_object.h:134
void D4D_PictOnMessage(D4D_MESSAGE *pMsg)
Definition: d4d_picture.c:104
LWord D4D_BOOL
Type definition of eGUI boolean.
Definition: d4d_types.h:204
static void D4D_PictOnDraw(D4D_MESSAGE *pMsg)
Definition: d4d_picture.c:67
D4D_OBJECT_DRAWFLAGS draw
Contains draw flags - is valid with D4D_MSG_DRAW and D4D_MSG_DRAWDONE message.
Definition: d4d_base.h:408
Type definition of eGUI geometry structure.
Definition: d4d_types.h:237
LWord D4D_COLOR
Type definition of eGUI color variables.
Definition: d4d_types.h:262
#define D4D_PIC_PRTY_DEFAULT
This is picture init properties. If not defined, it sets to (D4D_ALIGN_H_CENTER_MASK | D4D_ALIGN_V_CE...
Definition: d4d_picture.h:67
union D4D_MESSAGE_S::@0 prm
Additional data for some type of messages.
D4D_BOOL D4D_IsEnabled(D4D_OBJECT *pObject)
Function find out if the object is enabled or not.
Definition: d4d_object.c:303