Graphical demo for the LPC4088 Experiment Base Board with one of the Display Expansion Kits. This program displays how to write text in different fonts.

Dependencies:   EALib mbed

Committer:
embeddedartists
Date:
Thu Jun 25 10:30:15 2015 +0000
Revision:
0:5e5e9ec91fc8
First version

Who changed what in which revision?

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