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
lpc_swim/lpc_swim_font.h@22:f0d00f29bfeb, 2019-11-04 (annotated)
- Committer:
- embeddedartists
- Date:
- Mon Nov 04 14:31:50 2019 +0000
- Revision:
- 22:f0d00f29bfeb
- Parent:
- 0:4977187e90c7
More updates related to mbed OS 5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:4977187e90c7 | 1 | /* |
embeddedartists | 0:4977187e90c7 | 2 | * @brief SWIM font management |
embeddedartists | 0:4977187e90c7 | 3 | * |
embeddedartists | 0:4977187e90c7 | 4 | * @note |
embeddedartists | 0:4977187e90c7 | 5 | * Copyright(C) NXP Semiconductors, 2012 |
embeddedartists | 0:4977187e90c7 | 6 | * All rights reserved. |
embeddedartists | 0:4977187e90c7 | 7 | * |
embeddedartists | 0:4977187e90c7 | 8 | * @par |
embeddedartists | 0:4977187e90c7 | 9 | * Software that is described herein is for illustrative purposes only |
embeddedartists | 0:4977187e90c7 | 10 | * which provides customers with programming information regarding the |
embeddedartists | 0:4977187e90c7 | 11 | * LPC products. This software is supplied "AS IS" without any warranties of |
embeddedartists | 0:4977187e90c7 | 12 | * any kind, and NXP Semiconductors and its licensor disclaim any and |
embeddedartists | 0:4977187e90c7 | 13 | * all warranties, express or implied, including all implied warranties of |
embeddedartists | 0:4977187e90c7 | 14 | * merchantability, fitness for a particular purpose and non-infringement of |
embeddedartists | 0:4977187e90c7 | 15 | * intellectual property rights. NXP Semiconductors assumes no responsibility |
embeddedartists | 0:4977187e90c7 | 16 | * or liability for the use of the software, conveys no license or rights under any |
embeddedartists | 0:4977187e90c7 | 17 | * patent, copyright, mask work right, or any other intellectual property rights in |
embeddedartists | 0:4977187e90c7 | 18 | * or to any products. NXP Semiconductors reserves the right to make changes |
embeddedartists | 0:4977187e90c7 | 19 | * in the software without notification. NXP Semiconductors also makes no |
embeddedartists | 0:4977187e90c7 | 20 | * representation or warranty that such application will be suitable for the |
embeddedartists | 0:4977187e90c7 | 21 | * specified use without further testing or modification. |
embeddedartists | 0:4977187e90c7 | 22 | * |
embeddedartists | 0:4977187e90c7 | 23 | * @par |
embeddedartists | 0:4977187e90c7 | 24 | * Permission to use, copy, modify, and distribute this software and its |
embeddedartists | 0:4977187e90c7 | 25 | * documentation is hereby granted, under NXP Semiconductors' and its |
embeddedartists | 0:4977187e90c7 | 26 | * licensor's relevant copyrights in the software, without fee, provided that it |
embeddedartists | 0:4977187e90c7 | 27 | * is used in conjunction with NXP Semiconductors microcontrollers. This |
embeddedartists | 0:4977187e90c7 | 28 | * copyright, permission, and disclaimer notice must appear in all copies of |
embeddedartists | 0:4977187e90c7 | 29 | * this code. |
embeddedartists | 0:4977187e90c7 | 30 | */ |
embeddedartists | 0:4977187e90c7 | 31 | |
embeddedartists | 0:4977187e90c7 | 32 | #ifndef __LPC_SWIM_FONT_H_ |
embeddedartists | 0:4977187e90c7 | 33 | #define __LPC_SWIM_FONT_H_ |
embeddedartists | 0:4977187e90c7 | 34 | |
embeddedartists | 0:4977187e90c7 | 35 | #include "lpc_types.h" |
embeddedartists | 0:4977187e90c7 | 36 | #include "lpc_swim.h" |
embeddedartists | 0:4977187e90c7 | 37 | |
embeddedartists | 0:4977187e90c7 | 38 | #if defined(__cplusplus) |
embeddedartists | 0:4977187e90c7 | 39 | extern "C" |
embeddedartists | 0:4977187e90c7 | 40 | { |
embeddedartists | 0:4977187e90c7 | 41 | #endif |
embeddedartists | 0:4977187e90c7 | 42 | |
embeddedartists | 0:4977187e90c7 | 43 | /** @defgroup GUI_SWIM_FONT SWIM font manager |
embeddedartists | 0:4977187e90c7 | 44 | * @ingroup GUI_SWIM |
embeddedartists | 0:4977187e90c7 | 45 | * This package provides basic SWIM font management capabilities such as |
embeddedartists | 0:4977187e90c7 | 46 | * font selection, text positioning, newline and window scrolling, and |
embeddedartists | 0:4977187e90c7 | 47 | * text display with multiple, selectable fonts. |
embeddedartists | 0:4977187e90c7 | 48 | * @{ |
embeddedartists | 0:4977187e90c7 | 49 | */ |
embeddedartists | 0:4977187e90c7 | 50 | |
embeddedartists | 0:4977187e90c7 | 51 | /** |
embeddedartists | 0:4977187e90c7 | 52 | * @brief Put text at x, y (char) position on screen |
embeddedartists | 0:4977187e90c7 | 53 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 54 | * @param text : Text string to output in window |
embeddedartists | 0:4977187e90c7 | 55 | * @param x : Virtual X position of start of text |
embeddedartists | 0:4977187e90c7 | 56 | * @param y : Virtual Y position of start of text |
embeddedartists | 0:4977187e90c7 | 57 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 58 | * @note Sets the virtual (upper left) text position in the window and |
embeddedartists | 0:4977187e90c7 | 59 | * render the text string at this position. |
embeddedartists | 0:4977187e90c7 | 60 | */ |
embeddedartists | 0:4977187e90c7 | 61 | void swim_put_text_xy(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 62 | const CHAR *text, |
embeddedartists | 0:4977187e90c7 | 63 | int32_t x, |
embeddedartists | 0:4977187e90c7 | 64 | int32_t y); |
embeddedartists | 0:4977187e90c7 | 65 | |
embeddedartists | 0:4977187e90c7 | 66 | /** |
embeddedartists | 0:4977187e90c7 | 67 | * @brief Put text horizontally centered at y position on screen |
embeddedartists | 0:4977187e90c7 | 68 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 69 | * @param text : Text string to output in window |
embeddedartists | 0:4977187e90c7 | 70 | * @param x : Virtual X position of start of text |
embeddedartists | 0:4977187e90c7 | 71 | * @param y : Virtual Y position of start of text |
embeddedartists | 0:4977187e90c7 | 72 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 73 | * @note Sets the virtual (upper left) text position in the window and |
embeddedartists | 0:4977187e90c7 | 74 | * render the text string at this position. |
embeddedartists | 0:4977187e90c7 | 75 | */ |
embeddedartists | 0:4977187e90c7 | 76 | void swim_put_text_centered_win(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 77 | const CHAR *text, |
embeddedartists | 0:4977187e90c7 | 78 | int32_t y); |
embeddedartists | 0:4977187e90c7 | 79 | |
embeddedartists | 0:4977187e90c7 | 80 | /** |
embeddedartists | 0:4977187e90c7 | 81 | * @brief Put text horizontally centered between x0 and x1 at y position on screen |
embeddedartists | 0:4977187e90c7 | 82 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 83 | * @param text : Text string to output in window |
embeddedartists | 0:4977187e90c7 | 84 | * @param x0 : Virtual X left position |
embeddedartists | 0:4977187e90c7 | 85 | * @param x1 : Virtual X right position |
embeddedartists | 0:4977187e90c7 | 86 | * @param y : Virtual Y position of start of text |
embeddedartists | 0:4977187e90c7 | 87 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 88 | * @note Sets the virtual (upper left) text position in the window and |
embeddedartists | 0:4977187e90c7 | 89 | * render the text string at this position. |
embeddedartists | 0:4977187e90c7 | 90 | */ |
embeddedartists | 0:4977187e90c7 | 91 | void swim_put_text_centered(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 92 | const CHAR *text, |
embeddedartists | 0:4977187e90c7 | 93 | int32_t x0, |
embeddedartists | 0:4977187e90c7 | 94 | int32_t x1, |
embeddedartists | 0:4977187e90c7 | 95 | int32_t y); |
embeddedartists | 0:4977187e90c7 | 96 | |
embeddedartists | 0:4977187e90c7 | 97 | /** |
embeddedartists | 0:4977187e90c7 | 98 | * @brief Sets the X, Y pixel coordinates for the next text operation |
embeddedartists | 0:4977187e90c7 | 99 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 100 | * @param x : Virtual X position of start of text |
embeddedartists | 0:4977187e90c7 | 101 | * @param y : Virtual Y position of start of text |
embeddedartists | 0:4977187e90c7 | 102 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 103 | */ |
embeddedartists | 0:4977187e90c7 | 104 | void swim_set_xy(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 105 | int32_t x, |
embeddedartists | 0:4977187e90c7 | 106 | int32_t y); |
embeddedartists | 0:4977187e90c7 | 107 | |
embeddedartists | 0:4977187e90c7 | 108 | /** |
embeddedartists | 0:4977187e90c7 | 109 | * @brief Returns the X, Y pixel coordinates for the next text operation |
embeddedartists | 0:4977187e90c7 | 110 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 111 | * @param x : Address of where to return virtual X value |
embeddedartists | 0:4977187e90c7 | 112 | * @param y : Address of where to return virtual X value |
embeddedartists | 0:4977187e90c7 | 113 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 114 | * @note The logical X and Y positions are computed by subtracting the |
embeddedartists | 0:4977187e90c7 | 115 | * physical text position values by the physical minimum window |
embeddedartists | 0:4977187e90c7 | 116 | * limits. |
embeddedartists | 0:4977187e90c7 | 117 | */ |
embeddedartists | 0:4977187e90c7 | 118 | void swim_get_xy(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 119 | int32_t *x, |
embeddedartists | 0:4977187e90c7 | 120 | int32_t *y); |
embeddedartists | 0:4977187e90c7 | 121 | |
embeddedartists | 0:4977187e90c7 | 122 | /** |
embeddedartists | 0:4977187e90c7 | 123 | * @brief Puts a string of text in a window |
embeddedartists | 0:4977187e90c7 | 124 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 125 | * @param text : Text string to output in window |
embeddedartists | 0:4977187e90c7 | 126 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 127 | * @note Each character will be routed to the swim_put_char function until |
embeddedartists | 0:4977187e90c7 | 128 | * a string terminator is reached. For newline characters, a newline |
embeddedartists | 0:4977187e90c7 | 129 | * will occur instead of a character output. |
embeddedartists | 0:4977187e90c7 | 130 | */ |
embeddedartists | 0:4977187e90c7 | 131 | void swim_put_text(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 132 | const CHAR *text); |
embeddedartists | 0:4977187e90c7 | 133 | |
embeddedartists | 0:4977187e90c7 | 134 | /** |
embeddedartists | 0:4977187e90c7 | 135 | * @brief Puts a string of text in a window with breaks |
embeddedartists | 0:4977187e90c7 | 136 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 137 | * @param text : Text string to output in window |
embeddedartists | 0:4977187e90c7 | 138 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 139 | * @note Puts a string of text in a window, but will adjust the position of |
embeddedartists | 0:4977187e90c7 | 140 | * a word if the word length exceeds the edge of the display. |
embeddedartists | 0:4977187e90c7 | 141 | */ |
embeddedartists | 0:4977187e90c7 | 142 | void swim_put_ltext(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 143 | const CHAR *text); |
embeddedartists | 0:4977187e90c7 | 144 | |
embeddedartists | 0:4977187e90c7 | 145 | /** |
embeddedartists | 0:4977187e90c7 | 146 | * @brief Scrolls the window up one line |
embeddedartists | 0:4977187e90c7 | 147 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 148 | * @param lines : Number of lines to scroll up |
embeddedartists | 0:4977187e90c7 | 149 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 150 | */ |
embeddedartists | 0:4977187e90c7 | 151 | void swim_window_scroll(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 152 | int32_t lines); |
embeddedartists | 0:4977187e90c7 | 153 | |
embeddedartists | 0:4977187e90c7 | 154 | /** |
embeddedartists | 0:4977187e90c7 | 155 | * @brief Puts a single character in the window |
embeddedartists | 0:4977187e90c7 | 156 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 157 | * @param textchar : Character to print |
embeddedartists | 0:4977187e90c7 | 158 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 159 | * @note The character is placed at the end of the last text operation |
embeddedartists | 0:4977187e90c7 | 160 | * or the current text X, Y position. |
embeddedartists | 0:4977187e90c7 | 161 | */ |
embeddedartists | 0:4977187e90c7 | 162 | void swim_put_char(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 163 | const CHAR textchar); |
embeddedartists | 0:4977187e90c7 | 164 | |
embeddedartists | 0:4977187e90c7 | 165 | /** |
embeddedartists | 0:4977187e90c7 | 166 | * @brief Puts a newline in the window |
embeddedartists | 0:4977187e90c7 | 167 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 168 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 169 | */ |
embeddedartists | 0:4977187e90c7 | 170 | void swim_put_newline(SWIM_WINDOW_T *win); |
embeddedartists | 0:4977187e90c7 | 171 | |
embeddedartists | 0:4977187e90c7 | 172 | /** |
embeddedartists | 0:4977187e90c7 | 173 | * @brief Sets the active font |
embeddedartists | 0:4977187e90c7 | 174 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 175 | * @param font : Pointer to font data structure to use for font |
embeddedartists | 0:4977187e90c7 | 176 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 177 | */ |
embeddedartists | 0:4977187e90c7 | 178 | void swim_set_font(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 179 | FONT_T *font); |
embeddedartists | 0:4977187e90c7 | 180 | |
embeddedartists | 0:4977187e90c7 | 181 | /** |
embeddedartists | 0:4977187e90c7 | 182 | * @brief Returns the active font's height in pixels |
embeddedartists | 0:4977187e90c7 | 183 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 184 | * @return The height of the current font in pixels |
embeddedartists | 0:4977187e90c7 | 185 | */ |
embeddedartists | 0:4977187e90c7 | 186 | int16_t swim_get_font_height(SWIM_WINDOW_T *win); |
embeddedartists | 0:4977187e90c7 | 187 | |
embeddedartists | 0:4977187e90c7 | 188 | /** |
embeddedartists | 0:4977187e90c7 | 189 | * @brief Returns the width and height of the string rendered with the active font |
embeddedartists | 0:4977187e90c7 | 190 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 191 | * @param text : Text to render |
embeddedartists | 0:4977187e90c7 | 192 | * @param width : Width of text in pixels |
embeddedartists | 0:4977187e90c7 | 193 | * @param height : Height of text in pixels |
embeddedartists | 0:4977187e90c7 | 194 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 195 | */ |
embeddedartists | 0:4977187e90c7 | 196 | void swim_get_string_bounds(SWIM_WINDOW_T *win, const CHAR * text, int* width, int* height); |
embeddedartists | 0:4977187e90c7 | 197 | |
embeddedartists | 0:4977187e90c7 | 198 | /** |
embeddedartists | 0:4977187e90c7 | 199 | * @brief Creates a title bar for the window |
embeddedartists | 0:4977187e90c7 | 200 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 201 | * @param title : Text for title bard |
embeddedartists | 0:4977187e90c7 | 202 | * @param ttlbkcolor : Totle bar backgorund color |
embeddedartists | 0:4977187e90c7 | 203 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 204 | * @note Creates a title bar in the window and adjusts the client |
embeddedartists | 0:4977187e90c7 | 205 | * area to be outside the title bar area. |
embeddedartists | 0:4977187e90c7 | 206 | */ |
embeddedartists | 0:4977187e90c7 | 207 | void swim_set_title(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 208 | const CHAR *title, |
embeddedartists | 0:4977187e90c7 | 209 | COLOR_T ttlbkcolor); |
embeddedartists | 0:4977187e90c7 | 210 | |
embeddedartists | 0:4977187e90c7 | 211 | /** |
embeddedartists | 0:4977187e90c7 | 212 | * @brief Enables and disables font backgrounds |
embeddedartists | 0:4977187e90c7 | 213 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 214 | * @param trans : 1 for transparent backgrounds, 0 for solid color |
embeddedartists | 0:4977187e90c7 | 215 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 216 | * @note Enables and disables font backgrounds. When set, the font background |
embeddedartists | 0:4977187e90c7 | 217 | * will not be drawn in the background color (useful for painting text |
embeddedartists | 0:4977187e90c7 | 218 | * over pictures). |
embeddedartists | 0:4977187e90c7 | 219 | */ |
embeddedartists | 0:4977187e90c7 | 220 | void swim_set_font_transparency(SWIM_WINDOW_T *win, int32_t trans); |
embeddedartists | 0:4977187e90c7 | 221 | |
embeddedartists | 0:4977187e90c7 | 222 | #if defined(__cplusplus) |
embeddedartists | 0:4977187e90c7 | 223 | } |
embeddedartists | 0:4977187e90c7 | 224 | #endif |
embeddedartists | 0:4977187e90c7 | 225 | |
embeddedartists | 0:4977187e90c7 | 226 | /** |
embeddedartists | 0:4977187e90c7 | 227 | * @} |
embeddedartists | 0:4977187e90c7 | 228 | */ |
embeddedartists | 0:4977187e90c7 | 229 | |
embeddedartists | 0:4977187e90c7 | 230 | #endif /* __LPC_SWIM_FONT_H_ */ |
embeddedartists | 0:4977187e90c7 | 231 |