| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 32 | kaklik | /***************************************************************************** |
| 2 | * Module for Microchip Graphics Library |
||
| 3 | * GOL Layer |
||
| 4 | * Picture control |
||
| 5 | ***************************************************************************** |
||
| 6 | * FileName: Picture.h |
||
| 7 | * Dependencies: None |
||
| 8 | * Processor: PIC24F, PIC24H, dsPIC, PIC32 |
||
| 9 | * Compiler: MPLAB C30 V3.00, MPLAB C32 |
||
| 10 | * Linker: MPLAB LINK30, MPLAB LINK32 |
||
| 11 | * Company: Microchip Technology Incorporated |
||
| 12 | * |
||
| 13 | * Software License Agreement |
||
| 14 | * |
||
| 15 | * Copyright © 2008 Microchip Technology Inc. All rights reserved. |
||
| 16 | * Microchip licenses to you the right to use, modify, copy and distribute |
||
| 17 | * Software only when embedded on a Microchip microcontroller or digital |
||
| 18 | * signal controller, which is integrated into your product or third party |
||
| 19 | * product (pursuant to the sublicense terms in the accompanying license |
||
| 20 | * agreement). |
||
| 21 | * |
||
| 22 | * You should refer to the license agreement accompanying this Software |
||
| 23 | * for additional information regarding your rights and obligations. |
||
| 24 | * |
||
| 25 | * SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY |
||
| 26 | * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY |
||
| 27 | * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR |
||
| 28 | * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR |
||
| 29 | * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, |
||
| 30 | * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT |
||
| 31 | * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, |
||
| 32 | * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, |
||
| 33 | * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY |
||
| 34 | * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), |
||
| 35 | * OR OTHER SIMILAR COSTS. |
||
| 36 | * |
||
| 37 | * Author Date Comment |
||
| 38 | *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||
| 39 | * Anton Alkhimenok 11/12/07 Version 1.0 release |
||
| 40 | *****************************************************************************/ |
||
| 41 | #ifndef _PICTURE_H |
||
| 42 | #define _PICTURE_H |
||
| 43 | |||
| 44 | #include <Graphics\GOL.h> |
||
| 45 | |||
| 46 | /********************************************************************* |
||
| 47 | * Object States Definition: |
||
| 48 | *********************************************************************/ |
||
| 49 | #define PICT_DISABLED 0x0002 // Bit to indicate Picture is in a disabled state. |
||
| 50 | #define PICT_FRAME 0x0004 // Bit to indicate Picture has a frame. |
||
| 51 | #define PICT_HIDE 0x8000 // Bit to indicate Picture must be hidden. |
||
| 52 | #define PICT_DRAW 0x4000 // Bit to indicate Picture will be redrawn. |
||
| 53 | |||
| 54 | /***************************************************************************** |
||
| 55 | * Overview: The structure contains data for picture control |
||
| 56 | *****************************************************************************/ |
||
| 57 | typedef struct |
||
| 58 | { |
||
| 59 | OBJ_HEADER hdr; // Generic header for all Objects (see OBJ_HEADER). |
||
| 60 | char scale; // Scale factor for the bitmap |
||
| 61 | void *pBitmap; // Pointer to the bitmap |
||
| 62 | } PICTURE; |
||
| 63 | |||
| 64 | /********************************************************************* |
||
| 65 | * Macros: PictGetBitmap(pPict) |
||
| 66 | * |
||
| 67 | * Overview: This macro returns the pointer to the bitmap used in the object. |
||
| 68 | * |
||
| 69 | * PreCondition: none |
||
| 70 | * |
||
| 71 | * Input: pPict - Pointer to the object |
||
| 72 | * |
||
| 73 | * Output: Returns the pointer to the bitmap used. |
||
| 74 | * |
||
| 75 | * Side Effects: none |
||
| 76 | * |
||
| 77 | ********************************************************************/ |
||
| 78 | #define PictGetBitmap(pPict) pPict->pBitmap |
||
| 79 | |||
| 80 | /********************************************************************* |
||
| 81 | * Macros: PictSetBitmap(pPict,pBtMap) |
||
| 82 | * |
||
| 83 | * Overview: This macro sets the bitmap used in the object. |
||
| 84 | * |
||
| 85 | * PreCondition: none |
||
| 86 | * |
||
| 87 | * Input: pPict - Pointer to the object |
||
| 88 | * pBtMap - Pointer to the bitmap to be used |
||
| 89 | * |
||
| 90 | * Output: none |
||
| 91 | * |
||
| 92 | * Side Effects: none |
||
| 93 | * |
||
| 94 | ********************************************************************/ |
||
| 95 | #define PictSetBitmap(pPict, pBtMap) pPict->pBitmap = pBtMap |
||
| 96 | |||
| 97 | /********************************************************************* |
||
| 98 | * Macros: PictSetScale(pPict,scl) |
||
| 99 | * |
||
| 100 | * Overview: This macro sets the scale factor used to render the |
||
| 101 | * bitmap used in the object. |
||
| 102 | * |
||
| 103 | * PreCondition: none |
||
| 104 | * |
||
| 105 | * Input: pPict - Pointer to the object |
||
| 106 | * scl - The scale factor that will be used to display the |
||
| 107 | * bitmap. |
||
| 108 | * |
||
| 109 | * Output: none |
||
| 110 | * |
||
| 111 | * Side Effects: none |
||
| 112 | * |
||
| 113 | ********************************************************************/ |
||
| 114 | #define PictSetScale(pPict, scl) pPict->scale = scl |
||
| 115 | |||
| 116 | /********************************************************************* |
||
| 117 | * Macros: PictGetScale(pPict,scl) |
||
| 118 | * |
||
| 119 | * Overview: This macro returns the current scale factor used to |
||
| 120 | * render the bitmap. |
||
| 121 | * |
||
| 122 | * PreCondition: none |
||
| 123 | * |
||
| 124 | * Input: pPict - Pointer to the object |
||
| 125 | * |
||
| 126 | * Output: Returns the current scale factor used to display the |
||
| 127 | * bitmap. |
||
| 128 | * |
||
| 129 | * Side Effects: none |
||
| 130 | * |
||
| 131 | ********************************************************************/ |
||
| 132 | #define PictGetScale(pPict) pPict->scale |
||
| 133 | |||
| 134 | /********************************************************************* |
||
| 135 | * Function: PICTURE *PictCreate(WORD ID, SHORT left, SHORT top, SHORT right, |
||
| 136 | * SHORT bottom, WORD state, char scale, |
||
| 137 | * void *pBitmap, GOL_SCHEME *pScheme) |
||
| 138 | * |
||
| 139 | * Overview: This function creates a PICTURE object with the parameters given. |
||
| 140 | * It automatically attaches the new object into a global linked list of |
||
| 141 | * objects and returns the address of the object. |
||
| 142 | * |
||
| 143 | * PreCondition: none |
||
| 144 | * |
||
| 145 | * Input: ID - Unique user defined ID for the object instance. |
||
| 146 | * left - Left most position of the Object. |
||
| 147 | * top - Top most position of the Object. |
||
| 148 | * right - Right most position of the Object. |
||
| 149 | * bottom - Bottom most position of the object. |
||
| 150 | * radius - Radius of the rounded edge. |
||
| 151 | * state - Sets the initial state of the object. |
||
| 152 | * scale - Sets the scale factor used to render the bitmap. |
||
| 153 | * pBitmap - Pointer to the bitmap that will be used. |
||
| 154 | * pScheme - Pointer to the style scheme |
||
| 155 | * |
||
| 156 | * Output: Returns the pointer to the object created |
||
| 157 | * |
||
| 158 | * Side Effects: none |
||
| 159 | * |
||
| 160 | ********************************************************************/ |
||
| 161 | PICTURE * PictCreate |
||
| 162 | ( |
||
| 163 | WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, WORD state, char scale, void *pBitmap, GOL_SCHEME * |
||
| 164 | pScheme |
||
| 165 | ); |
||
| 166 | |||
| 167 | /********************************************************************* |
||
| 168 | * Function: WORD PictTranslateMsg(PICTURE *pPict, GOL_MSG *pMsg) |
||
| 169 | * |
||
| 170 | * Overview: This function evaluates the message from a user if the |
||
| 171 | * message will affect the object or not. The table below |
||
| 172 | * enumerates the translated messages for each event |
||
| 173 | * accepted by the PICTURE Object. |
||
| 174 | * |
||
| 175 | * <TABLE> |
||
| 176 | * Translated Message Input Source Events Description |
||
| 177 | * ################## ############ ###### ########### |
||
| 178 | * PICT_MSG_SELECTED Touch Screen EVENT_PRESS, EVENT_RELEASE, EVENT_MOVE If events occurs and the x,y position falls in the area of the picture. |
||
| 179 | * OBJ_MSG_INVALID Any Any If the message did not affect the object. |
||
| 180 | * </TABLE> |
||
| 181 | * |
||
| 182 | * PreCondition: none |
||
| 183 | * |
||
| 184 | * Input: pPict - The pointer to the object where the message will be |
||
| 185 | * evaluated to check if the message will affect the object. |
||
| 186 | * pMsg - Pointer to the message struct containing the message from |
||
| 187 | * the user interface. |
||
| 188 | * |
||
| 189 | * Output: Returns the translated message depending on the received GOL message: |
||
| 190 | * - PICT_MSG_SELECTED Picture is touched. |
||
| 191 | * - OBJ_MSG_INVALID Picture is not affected |
||
| 192 | * |
||
| 193 | * Side Effects: none |
||
| 194 | * |
||
| 195 | ********************************************************************/ |
||
| 196 | WORD PictTranslateMsg(PICTURE *pPict, GOL_MSG *pMsg); |
||
| 197 | |||
| 198 | /********************************************************************* |
||
| 199 | * Function: WORD PictDraw(PICTURE *pPict) |
||
| 200 | * |
||
| 201 | * Overview: This function renders the object on the screen using |
||
| 202 | * the current parameter settings. Location of the object is |
||
| 203 | * determined by the left, top, right and bottom parameters. |
||
| 204 | * The colors used are dependent on the state of the object. |
||
| 205 | * |
||
| 206 | * When rendering objects of the same type, each object |
||
| 207 | * must be rendered completely before the rendering of the |
||
| 208 | * next object is started. This is to avoid incomplete |
||
| 209 | * object rendering. |
||
| 210 | * |
||
| 211 | * PreCondition: Object must be created before this function is called. |
||
| 212 | * |
||
| 213 | * Input: pPict - Pointer to the object to be rendered. |
||
| 214 | * |
||
| 215 | * Output: Returns the status of the drawing |
||
| 216 | * - 1 - If the rendering was completed and |
||
| 217 | * - 0 - If the rendering is not yet finished. |
||
| 218 | * Next call to the function will resume the |
||
| 219 | * rendering on the pending drawing state. |
||
| 220 | * |
||
| 221 | * Side Effects: none |
||
| 222 | * |
||
| 223 | ********************************************************************/ |
||
| 224 | WORD PictDraw(PICTURE *pPict); |
||
| 225 | #endif // _PICTURE_H |
Powered by WebSVN v2.8.3