landtiger with ili9325 lcd controller based on the TFTLCD libary from Todor Todorov
lcd_base.cpp@1:1a3dd94e13cf, 2015-06-08 (annotated)
- Committer:
- casval
- Date:
- Mon Jun 08 09:59:17 2015 +0000
- Revision:
- 1:1a3dd94e13cf
- Parent:
- 0:0099ad246127
Mutex form for other project was still there
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| casval | 0:0099ad246127 | 1 | /* |
| casval | 0:0099ad246127 | 2 | * Copyright (C)2010-2012 Henning Karlsen. All right reserved. |
| casval | 0:0099ad246127 | 3 | * Copyright (C)2012 Todor Todorov. |
| casval | 0:0099ad246127 | 4 | * |
| casval | 0:0099ad246127 | 5 | * This library is free software; you can redistribute it and/or |
| casval | 0:0099ad246127 | 6 | * modify it under the terms of the GNU Lesser General Public |
| casval | 0:0099ad246127 | 7 | * License as published by the Free Software Foundation; either |
| casval | 0:0099ad246127 | 8 | * version 2.1 of the License, or (at your option) any later version. |
| casval | 0:0099ad246127 | 9 | * |
| casval | 0:0099ad246127 | 10 | * This library is distributed in the hope that it will be useful, |
| casval | 0:0099ad246127 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| casval | 0:0099ad246127 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| casval | 0:0099ad246127 | 13 | * Lesser General Public License for more details. |
| casval | 0:0099ad246127 | 14 | * |
| casval | 0:0099ad246127 | 15 | * You should have received a copy of the GNU Lesser General Public |
| casval | 0:0099ad246127 | 16 | * License along with this library; if not, write to: |
| casval | 0:0099ad246127 | 17 | * |
| casval | 0:0099ad246127 | 18 | * Free Software Foundation, Inc. |
| casval | 0:0099ad246127 | 19 | * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA |
| casval | 0:0099ad246127 | 20 | * |
| casval | 0:0099ad246127 | 21 | *********************************************************************/ |
| casval | 0:0099ad246127 | 22 | #include "lcd_base.h" |
| casval | 0:0099ad246127 | 23 | #include "helpers.h" |
| casval | 0:0099ad246127 | 24 | |
| casval | 0:0099ad246127 | 25 | LCD::LCD( unsigned short width, unsigned short height, PinName CS, PinName RS, PinName DIR, PinName EN, PinName LE, PinName BL, backlight_t blType, float defaultBacklight ) |
| casval | 0:0099ad246127 | 26 | : _disp_width( width ), _disp_height( height ), _lcd_pin_cs( CS ), _lcd_pin_rs( RS ), _lcd_pin_dir(DIR), _lcd_pin_en(EN), _lcd_pin_le(LE), _bl_type( blType ) |
| casval | 0:0099ad246127 | 27 | { |
| casval | 0:0099ad246127 | 28 | SetForeground(); |
| casval | 0:0099ad246127 | 29 | SetBackground(); |
| casval | 0:0099ad246127 | 30 | _font = &TerminusFont; |
| casval | 0:0099ad246127 | 31 | if ( defaultBacklight < 0 ) _bl_pwm_default = 0; |
| casval | 0:0099ad246127 | 32 | else if ( defaultBacklight > 1.0 ) _bl_pwm_default = 1.0; |
| casval | 0:0099ad246127 | 33 | else _bl_pwm_default = defaultBacklight; |
| casval | 0:0099ad246127 | 34 | if ( BL != NC ) |
| casval | 0:0099ad246127 | 35 | { |
| casval | 0:0099ad246127 | 36 | if ( blType == Constant ) |
| casval | 0:0099ad246127 | 37 | { |
| casval | 0:0099ad246127 | 38 | _bl_pwm = 0; |
| casval | 0:0099ad246127 | 39 | _lcd_pin_bl = new DigitalOut( BL ); |
| casval | 0:0099ad246127 | 40 | } |
| casval | 0:0099ad246127 | 41 | else |
| casval | 0:0099ad246127 | 42 | { |
| casval | 0:0099ad246127 | 43 | _lcd_pin_bl = 0; |
| casval | 0:0099ad246127 | 44 | _bl_pwm = new PwmOut( BL ); |
| casval | 0:0099ad246127 | 45 | _bl_pwm->period_ms( 8.33 ); // 120 Hz |
| casval | 0:0099ad246127 | 46 | _bl_pwm_current = _bl_pwm_default; |
| casval | 0:0099ad246127 | 47 | // initially off |
| casval | 0:0099ad246127 | 48 | *_bl_pwm = 0; |
| casval | 0:0099ad246127 | 49 | } |
| casval | 0:0099ad246127 | 50 | |
| casval | 0:0099ad246127 | 51 | } |
| casval | 0:0099ad246127 | 52 | else |
| casval | 0:0099ad246127 | 53 | { |
| casval | 0:0099ad246127 | 54 | _lcd_pin_bl = 0; |
| casval | 0:0099ad246127 | 55 | _bl_pwm = 0; |
| casval | 0:0099ad246127 | 56 | } |
| casval | 0:0099ad246127 | 57 | } |
| casval | 0:0099ad246127 | 58 | |
| casval | 0:0099ad246127 | 59 | void LCD::Sleep( void ) |
| casval | 0:0099ad246127 | 60 | { |
| casval | 0:0099ad246127 | 61 | if ( _lcd_pin_bl != 0 ) |
| casval | 0:0099ad246127 | 62 | *_lcd_pin_bl = LOW; |
| casval | 0:0099ad246127 | 63 | else if ( _bl_pwm != 0 ) |
| casval | 0:0099ad246127 | 64 | *_bl_pwm = 0; |
| casval | 0:0099ad246127 | 65 | } |
| casval | 0:0099ad246127 | 66 | |
| casval | 0:0099ad246127 | 67 | void LCD::WakeUp( void ) |
| casval | 0:0099ad246127 | 68 | { |
| casval | 0:0099ad246127 | 69 | if ( _lcd_pin_bl != 0 ) |
| casval | 0:0099ad246127 | 70 | *_lcd_pin_bl = HIGH; |
| casval | 0:0099ad246127 | 71 | else if ( _bl_pwm != 0 ) |
| casval | 0:0099ad246127 | 72 | *_bl_pwm = _bl_pwm_current; |
| casval | 0:0099ad246127 | 73 | } |
| casval | 0:0099ad246127 | 74 | |
| casval | 0:0099ad246127 | 75 | inline |
| casval | 0:0099ad246127 | 76 | void LCD::SetForeground( unsigned int color ) |
| casval | 0:0099ad246127 | 77 | { |
| casval | 0:0099ad246127 | 78 | _foreground = color; |
| casval | 0:0099ad246127 | 79 | } |
| casval | 0:0099ad246127 | 80 | |
| casval | 0:0099ad246127 | 81 | inline |
| casval | 0:0099ad246127 | 82 | void LCD::SetBackground( unsigned int color ) |
| casval | 0:0099ad246127 | 83 | { |
| casval | 0:0099ad246127 | 84 | _background = color; |
| casval | 0:0099ad246127 | 85 | } |
| casval | 0:0099ad246127 | 86 | |
| casval | 0:0099ad246127 | 87 | void LCD::SetFont( const font_t *font ) |
| casval | 0:0099ad246127 | 88 | { |
| casval | 0:0099ad246127 | 89 | _font = font; |
| casval | 0:0099ad246127 | 90 | } |
| casval | 0:0099ad246127 | 91 | |
| casval | 0:0099ad246127 | 92 | inline |
| casval | 0:0099ad246127 | 93 | unsigned short LCD::GetWidth( void ) |
| casval | 0:0099ad246127 | 94 | { |
| casval | 0:0099ad246127 | 95 | if ( _orientation == LANDSCAPE || _orientation == LANDSCAPE_REV ) return _disp_height; |
| casval | 0:0099ad246127 | 96 | return _disp_width; |
| casval | 0:0099ad246127 | 97 | } |
| casval | 0:0099ad246127 | 98 | |
| casval | 0:0099ad246127 | 99 | inline |
| casval | 0:0099ad246127 | 100 | unsigned short LCD::GetHeight( void ) |
| casval | 0:0099ad246127 | 101 | { |
| casval | 0:0099ad246127 | 102 | if ( _orientation == LANDSCAPE || _orientation == LANDSCAPE_REV ) return _disp_width; |
| casval | 0:0099ad246127 | 103 | return _disp_height; |
| casval | 0:0099ad246127 | 104 | } |
| casval | 0:0099ad246127 | 105 | |
| casval | 0:0099ad246127 | 106 | inline |
| casval | 0:0099ad246127 | 107 | uint8_t LCD::GetFontWidth( void ) |
| casval | 0:0099ad246127 | 108 | { |
| casval | 0:0099ad246127 | 109 | if ( _font != 0 ) return _font->Width; |
| casval | 0:0099ad246127 | 110 | return 0; |
| casval | 0:0099ad246127 | 111 | } |
| casval | 0:0099ad246127 | 112 | |
| casval | 0:0099ad246127 | 113 | inline |
| casval | 0:0099ad246127 | 114 | uint8_t LCD::GetFontHeight( void ) |
| casval | 0:0099ad246127 | 115 | { |
| casval | 0:0099ad246127 | 116 | if ( _font != 0 ) return _font->Height; |
| casval | 0:0099ad246127 | 117 | return 0; |
| casval | 0:0099ad246127 | 118 | } |
| casval | 0:0099ad246127 | 119 | |
| casval | 0:0099ad246127 | 120 | void LCD::SetBacklightLevel( float level ) |
| casval | 0:0099ad246127 | 121 | { |
| casval | 0:0099ad246127 | 122 | switch ( _bl_type ) |
| casval | 0:0099ad246127 | 123 | { |
| casval | 0:0099ad246127 | 124 | case Direct: |
| casval | 0:0099ad246127 | 125 | if ( _bl_pwm != 0 ) |
| casval | 0:0099ad246127 | 126 | { |
| casval | 0:0099ad246127 | 127 | *_bl_pwm = level; |
| casval | 0:0099ad246127 | 128 | _bl_pwm_current = level; |
| casval | 0:0099ad246127 | 129 | } |
| casval | 0:0099ad246127 | 130 | break; |
| casval | 0:0099ad246127 | 131 | |
| casval | 0:0099ad246127 | 132 | case Indirect: |
| casval | 0:0099ad246127 | 133 | break; |
| casval | 0:0099ad246127 | 134 | case Constant: |
| casval | 0:0099ad246127 | 135 | default: |
| casval | 0:0099ad246127 | 136 | break; |
| casval | 0:0099ad246127 | 137 | } |
| casval | 0:0099ad246127 | 138 | } |
| casval | 0:0099ad246127 | 139 | |
| casval | 0:0099ad246127 | 140 | void LCD::FillScreen( int color ) |
| casval | 0:0099ad246127 | 141 | { |
| casval | 0:0099ad246127 | 142 | unsigned int rgb = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color; |
| casval | 0:0099ad246127 | 143 | Activate(); |
| casval | 0:0099ad246127 | 144 | ClearXY(); |
| casval | 0:0099ad246127 | 145 | for ( int i = 0; i < ( ( _disp_width ) * ( _disp_height ) ); i++ ) |
| casval | 0:0099ad246127 | 146 | SetPixelColor( rgb ); |
| casval | 1:1a3dd94e13cf | 147 | Deactivate(); |
| casval | 0:0099ad246127 | 148 | } |
| casval | 0:0099ad246127 | 149 | |
| casval | 0:0099ad246127 | 150 | inline |
| casval | 0:0099ad246127 | 151 | void LCD::ClearScreen( void ) |
| casval | 0:0099ad246127 | 152 | { |
| casval | 0:0099ad246127 | 153 | FillScreen( -1 ); |
| casval | 0:0099ad246127 | 154 | } |
| casval | 0:0099ad246127 | 155 | |
| casval | 0:0099ad246127 | 156 | void LCD::DrawPixel( unsigned short x, unsigned short y, int color ) |
| casval | 0:0099ad246127 | 157 | { |
| casval | 0:0099ad246127 | 158 | Activate(); |
| casval | 0:0099ad246127 | 159 | SetXY( x, y, x, y ); |
| casval | 0:0099ad246127 | 160 | SetPixelColor( color == -1 ? _background : |
| casval | 0:0099ad246127 | 161 | color == -2 ? _foreground : color ); |
| casval | 0:0099ad246127 | 162 | } |
| casval | 0:0099ad246127 | 163 | |
| casval | 0:0099ad246127 | 164 | void LCD::DrawLine( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color ) |
| casval | 0:0099ad246127 | 165 | { |
| casval | 0:0099ad246127 | 166 | double delta, tx, ty; |
| casval | 0:0099ad246127 | 167 | |
| casval | 0:0099ad246127 | 168 | if ( ( ( x2 - x1 ) < 0 ) ) |
| casval | 0:0099ad246127 | 169 | { |
| casval | 0:0099ad246127 | 170 | swap( ushort, x1, x2 ) |
| casval | 0:0099ad246127 | 171 | swap( ushort, y1, y2 ) |
| casval | 0:0099ad246127 | 172 | } |
| casval | 0:0099ad246127 | 173 | if ( ( ( y2 - y1 ) < 0 ) ) |
| casval | 0:0099ad246127 | 174 | { |
| casval | 0:0099ad246127 | 175 | swap( ushort, x1, x2 ) |
| casval | 0:0099ad246127 | 176 | swap( ushort, y1, y2 ) |
| casval | 0:0099ad246127 | 177 | } |
| casval | 0:0099ad246127 | 178 | |
| casval | 0:0099ad246127 | 179 | if ( y1 == y2 ) |
| casval | 0:0099ad246127 | 180 | { |
| casval | 0:0099ad246127 | 181 | if ( x1 > x2 ) |
| casval | 0:0099ad246127 | 182 | swap( ushort, x1, x2 ) |
| casval | 0:0099ad246127 | 183 | DrawHLine( x1, y1, x2 - x1, color ); |
| casval | 0:0099ad246127 | 184 | } |
| casval | 0:0099ad246127 | 185 | else if ( x1 == x2 ) |
| casval | 0:0099ad246127 | 186 | { |
| casval | 0:0099ad246127 | 187 | if ( y1 > y2 ) |
| casval | 0:0099ad246127 | 188 | swap( ushort, y1, y2 ) |
| casval | 0:0099ad246127 | 189 | DrawVLine( x1, y1, y2 - y1, color ); |
| casval | 0:0099ad246127 | 190 | } |
| casval | 0:0099ad246127 | 191 | else |
| casval | 0:0099ad246127 | 192 | { |
| casval | 0:0099ad246127 | 193 | unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color; |
| casval | 0:0099ad246127 | 194 | Activate(); |
| casval | 0:0099ad246127 | 195 | if ( abs( x2 - x1 ) > abs( y2 - y1 ) ) |
| casval | 0:0099ad246127 | 196 | { |
| casval | 0:0099ad246127 | 197 | delta = ( double( y2 - y1 ) / double( x2 - x1 ) ); |
| casval | 0:0099ad246127 | 198 | ty = double( y1 ); |
| casval | 0:0099ad246127 | 199 | if ( x1 > x2 ) |
| casval | 0:0099ad246127 | 200 | { |
| casval | 0:0099ad246127 | 201 | for ( int i = x1; i >= x2; i-- ) |
| casval | 0:0099ad246127 | 202 | { |
| casval | 0:0099ad246127 | 203 | SetXY( i, int( ty + 0.5 ), i, int( ty + 0.5 ) ); |
| casval | 0:0099ad246127 | 204 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 205 | ty = ty - delta; |
| casval | 0:0099ad246127 | 206 | } |
| casval | 0:0099ad246127 | 207 | } |
| casval | 0:0099ad246127 | 208 | else |
| casval | 0:0099ad246127 | 209 | { |
| casval | 0:0099ad246127 | 210 | for ( int i = x1; i <= x2; i++ ) |
| casval | 0:0099ad246127 | 211 | { |
| casval | 0:0099ad246127 | 212 | SetXY( i, int( ty + 0.5 ), i, int( ty + 0.5 ) ); |
| casval | 0:0099ad246127 | 213 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 214 | ty = ty + delta; |
| casval | 0:0099ad246127 | 215 | } |
| casval | 0:0099ad246127 | 216 | } |
| casval | 0:0099ad246127 | 217 | } |
| casval | 0:0099ad246127 | 218 | else |
| casval | 0:0099ad246127 | 219 | { |
| casval | 0:0099ad246127 | 220 | delta = ( float( x2 - x1 ) / float( y2 - y1 ) ); |
| casval | 0:0099ad246127 | 221 | tx = float( x1 ); |
| casval | 0:0099ad246127 | 222 | if ( y1 > y2 ) |
| casval | 0:0099ad246127 | 223 | { |
| casval | 0:0099ad246127 | 224 | for ( int i = y2 + 1; i > y1; i-- ) |
| casval | 0:0099ad246127 | 225 | { |
| casval | 0:0099ad246127 | 226 | SetXY( int( tx + 0.5 ), i, int( tx + 0.5 ), i ); |
| casval | 0:0099ad246127 | 227 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 228 | tx = tx + delta; |
| casval | 0:0099ad246127 | 229 | } |
| casval | 0:0099ad246127 | 230 | } |
| casval | 0:0099ad246127 | 231 | else |
| casval | 0:0099ad246127 | 232 | { |
| casval | 0:0099ad246127 | 233 | for ( int i = y1; i < y2 + 1; i++ ) |
| casval | 0:0099ad246127 | 234 | { |
| casval | 0:0099ad246127 | 235 | SetXY( int( tx + 0.5 ), i, int( tx + 0.5 ), i ); |
| casval | 0:0099ad246127 | 236 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 237 | tx = tx + delta; |
| casval | 0:0099ad246127 | 238 | } |
| casval | 0:0099ad246127 | 239 | } |
| casval | 0:0099ad246127 | 240 | } |
| casval | 0:0099ad246127 | 241 | Deactivate(); |
| casval | 0:0099ad246127 | 242 | } |
| casval | 0:0099ad246127 | 243 | } |
| casval | 0:0099ad246127 | 244 | |
| casval | 0:0099ad246127 | 245 | void LCD::DrawRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color ) |
| casval | 0:0099ad246127 | 246 | { |
| casval | 0:0099ad246127 | 247 | if ( x1 > x2 ) swap( ushort, x1, x2 ) |
| casval | 0:0099ad246127 | 248 | if ( y1 > y2 ) swap( ushort, y1, y2 ) |
| casval | 0:0099ad246127 | 249 | |
| casval | 0:0099ad246127 | 250 | DrawHLine( x1, y1, x2 - x1, color ); |
| casval | 0:0099ad246127 | 251 | DrawHLine( x1, y2, x2 - x1, color ); |
| casval | 0:0099ad246127 | 252 | DrawVLine( x1, y1, y2 - y1, color ); |
| casval | 0:0099ad246127 | 253 | DrawVLine( x2, y1, y2 - y1, color ); |
| casval | 0:0099ad246127 | 254 | } |
| casval | 0:0099ad246127 | 255 | |
| casval | 0:0099ad246127 | 256 | void LCD::DrawRoundRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color ) |
| casval | 0:0099ad246127 | 257 | { |
| casval | 0:0099ad246127 | 258 | if ( x1 > x2 ) swap( ushort, x1, x2 ) |
| casval | 0:0099ad246127 | 259 | if ( y1 > y2 ) swap( ushort, y1, y2 ) |
| casval | 0:0099ad246127 | 260 | |
| casval | 0:0099ad246127 | 261 | if ( ( x2 - x1 ) > 4 && ( y2 - y1 ) > 4 ) |
| casval | 0:0099ad246127 | 262 | { |
| casval | 0:0099ad246127 | 263 | DrawPixel( x1 + 1, y1 + 1, color ); |
| casval | 0:0099ad246127 | 264 | DrawPixel( x2 - 1, y1 + 1, color ); |
| casval | 0:0099ad246127 | 265 | DrawPixel( x1 + 1, y2 - 1, color ); |
| casval | 0:0099ad246127 | 266 | DrawPixel( x2 - 1, y2 - 1, color ); |
| casval | 0:0099ad246127 | 267 | DrawHLine( x1 + 2, y1, x2 - x1 - 4, color ); |
| casval | 0:0099ad246127 | 268 | DrawHLine( x1 + 2, y2, x2 - x1 - 4, color ); |
| casval | 0:0099ad246127 | 269 | DrawVLine( x1, y1 + 2, y2 - y1 - 4, color ); |
| casval | 0:0099ad246127 | 270 | DrawVLine( x2, y1 + 2, y2 - y1 - 4, color ); |
| casval | 0:0099ad246127 | 271 | } |
| casval | 0:0099ad246127 | 272 | } |
| casval | 0:0099ad246127 | 273 | |
| casval | 0:0099ad246127 | 274 | void LCD::FillRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color ) |
| casval | 0:0099ad246127 | 275 | { |
| casval | 0:0099ad246127 | 276 | if ( x1 > x2 ) swap( ushort, x1, x2 ); |
| casval | 0:0099ad246127 | 277 | if ( y1 > y2 ) swap( ushort, y1, y2 ); |
| casval | 0:0099ad246127 | 278 | |
| casval | 0:0099ad246127 | 279 | for ( int i = 0; i < ( ( y2 - y1 ) / 2 ) + 1; i++ ) |
| casval | 0:0099ad246127 | 280 | { |
| casval | 0:0099ad246127 | 281 | DrawHLine( x1, y1 + i, x2 - x1, color ); |
| casval | 0:0099ad246127 | 282 | DrawHLine( x1, y2 - i, x2 - x1, color ); |
| casval | 1:1a3dd94e13cf | 283 | } |
| casval | 0:0099ad246127 | 284 | } |
| casval | 0:0099ad246127 | 285 | |
| casval | 0:0099ad246127 | 286 | void LCD::FillRoundRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color ) |
| casval | 0:0099ad246127 | 287 | { |
| casval | 0:0099ad246127 | 288 | if ( x1 > x2 ) swap( ushort, x1, x2 ) |
| casval | 0:0099ad246127 | 289 | if ( y1 > y2 ) swap( ushort, y1, y2 ) |
| casval | 0:0099ad246127 | 290 | |
| casval | 0:0099ad246127 | 291 | if ( ( x2 - x1 ) > 4 && ( y2 - y1 ) > 4 ) |
| casval | 0:0099ad246127 | 292 | { |
| casval | 0:0099ad246127 | 293 | for ( int i = 0; i < ( ( y2 - y1 ) / 2 ) + 1; i++ ) |
| casval | 0:0099ad246127 | 294 | { |
| casval | 0:0099ad246127 | 295 | switch ( i ) |
| casval | 0:0099ad246127 | 296 | { |
| casval | 0:0099ad246127 | 297 | case 0: |
| casval | 0:0099ad246127 | 298 | DrawHLine( x1 + 2, y1 + i, x2 - x1 - 4, color ); |
| casval | 0:0099ad246127 | 299 | DrawHLine( x1 + 2, y2 - i, x2 - x1 - 4, color ); |
| casval | 0:0099ad246127 | 300 | break; |
| casval | 0:0099ad246127 | 301 | |
| casval | 0:0099ad246127 | 302 | case 1: |
| casval | 0:0099ad246127 | 303 | DrawHLine( x1 + 1, y1 + i, x2 - x1 - 2, color ); |
| casval | 0:0099ad246127 | 304 | DrawHLine( x1 + 1, y2 - i, x2 - x1 - 2, color ); |
| casval | 0:0099ad246127 | 305 | break; |
| casval | 0:0099ad246127 | 306 | |
| casval | 0:0099ad246127 | 307 | default: |
| casval | 0:0099ad246127 | 308 | DrawHLine( x1, y1 + i, x2 - x1, color ); |
| casval | 0:0099ad246127 | 309 | DrawHLine( x1, y2 - i, x2 - x1, color ); |
| casval | 0:0099ad246127 | 310 | break; |
| casval | 0:0099ad246127 | 311 | } |
| casval | 0:0099ad246127 | 312 | } |
| casval | 0:0099ad246127 | 313 | } |
| casval | 0:0099ad246127 | 314 | } |
| casval | 0:0099ad246127 | 315 | |
| casval | 0:0099ad246127 | 316 | void LCD::DrawCircle( unsigned short x, unsigned short y, unsigned short radius, int color ) |
| casval | 0:0099ad246127 | 317 | { |
| casval | 0:0099ad246127 | 318 | int f = 1 - radius; |
| casval | 0:0099ad246127 | 319 | int ddF_x = 1; |
| casval | 0:0099ad246127 | 320 | int ddF_y = -2 * radius; |
| casval | 0:0099ad246127 | 321 | int x1 = 0; |
| casval | 0:0099ad246127 | 322 | int y1 = radius; |
| casval | 0:0099ad246127 | 323 | unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color; |
| casval | 0:0099ad246127 | 324 | |
| casval | 0:0099ad246127 | 325 | Activate(); |
| casval | 0:0099ad246127 | 326 | SetXY( x, y + radius, x, y + radius ); |
| casval | 0:0099ad246127 | 327 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 328 | SetXY( x, y - radius, x, y - radius ); |
| casval | 0:0099ad246127 | 329 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 330 | SetXY( x + radius, y, x + radius, y ); |
| casval | 0:0099ad246127 | 331 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 332 | SetXY( x - radius, y, x - radius, y ); |
| casval | 0:0099ad246127 | 333 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 334 | |
| casval | 0:0099ad246127 | 335 | while ( x1 < y1 ) |
| casval | 0:0099ad246127 | 336 | { |
| casval | 0:0099ad246127 | 337 | if ( f >= 0 ) |
| casval | 0:0099ad246127 | 338 | { |
| casval | 0:0099ad246127 | 339 | y1--; |
| casval | 0:0099ad246127 | 340 | ddF_y += 2; |
| casval | 0:0099ad246127 | 341 | f += ddF_y; |
| casval | 0:0099ad246127 | 342 | } |
| casval | 0:0099ad246127 | 343 | x1++; |
| casval | 0:0099ad246127 | 344 | ddF_x += 2; |
| casval | 0:0099ad246127 | 345 | f += ddF_x; |
| casval | 0:0099ad246127 | 346 | SetXY( x + x1, y + y1, x + x1, y + y1 ); |
| casval | 0:0099ad246127 | 347 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 348 | SetXY( x - x1, y + y1, x - x1, y + y1 ); |
| casval | 0:0099ad246127 | 349 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 350 | SetXY( x + x1, y - y1, x + x1, y - y1 ); |
| casval | 0:0099ad246127 | 351 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 352 | SetXY( x - x1, y - y1, x - x1, y - y1 ); |
| casval | 0:0099ad246127 | 353 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 354 | SetXY( x + y1, y + x1, x + y1, y + x1 ); |
| casval | 0:0099ad246127 | 355 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 356 | SetXY( x - y1, y + x1, x - y1, y + x1 ); |
| casval | 0:0099ad246127 | 357 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 358 | SetXY( x + y1, y - x1, x + y1, y - x1 ); |
| casval | 0:0099ad246127 | 359 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 360 | SetXY( x - y1, y - x1, x - y1, y - x1 ); |
| casval | 0:0099ad246127 | 361 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 362 | } |
| casval | 0:0099ad246127 | 363 | Deactivate(); |
| casval | 0:0099ad246127 | 364 | } |
| casval | 0:0099ad246127 | 365 | |
| casval | 0:0099ad246127 | 366 | void LCD::FillCircle( unsigned short x, unsigned short y, unsigned short radius, int color ) |
| casval | 0:0099ad246127 | 367 | { |
| casval | 0:0099ad246127 | 368 | unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color; |
| casval | 0:0099ad246127 | 369 | Activate(); |
| casval | 0:0099ad246127 | 370 | for ( int y1 = -radius; y1 <= radius; y1++ ) |
| casval | 0:0099ad246127 | 371 | for ( int x1 = -radius; x1 <= radius; x1++ ) |
| casval | 0:0099ad246127 | 372 | if ( x1 * x1 + y1 * y1 <= radius * radius ) |
| casval | 0:0099ad246127 | 373 | { |
| casval | 0:0099ad246127 | 374 | SetXY( x + x1, y + y1, x + x1, y + y1 ); |
| casval | 0:0099ad246127 | 375 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 376 | } |
| casval | 0:0099ad246127 | 377 | Deactivate(); |
| casval | 0:0099ad246127 | 378 | } |
| casval | 0:0099ad246127 | 379 | |
| casval | 0:0099ad246127 | 380 | void LCD::Print( const char *str, unsigned short x, unsigned short y, int fgColor, int bgColor, unsigned short deg ) |
| casval | 0:0099ad246127 | 381 | { |
| casval | 0:0099ad246127 | 382 | int stl, i; |
| casval | 0:0099ad246127 | 383 | |
| casval | 0:0099ad246127 | 384 | stl = strlen( str ); |
| casval | 0:0099ad246127 | 385 | |
| casval | 0:0099ad246127 | 386 | if ( x == RIGHT ) |
| casval | 0:0099ad246127 | 387 | x = GetWidth() - ( stl * _font->Width ); |
| casval | 0:0099ad246127 | 388 | if ( x == CENTER ) |
| casval | 0:0099ad246127 | 389 | x = ( GetWidth() - ( stl * _font->Width ) ) / 2; |
| casval | 0:0099ad246127 | 390 | |
| casval | 0:0099ad246127 | 391 | for ( i = 0; i < stl; i++ ) |
| casval | 0:0099ad246127 | 392 | if ( deg == 0 ) |
| casval | 0:0099ad246127 | 393 | PrintChar( *str++, x + ( i * ( _font->Width ) ), y, fgColor, bgColor ); |
| casval | 0:0099ad246127 | 394 | else |
| casval | 1:1a3dd94e13cf | 395 | RotateChar( *str++, x, y, i, fgColor, bgColor, deg ); |
| casval | 0:0099ad246127 | 396 | } |
| casval | 0:0099ad246127 | 397 | |
| casval | 0:0099ad246127 | 398 | void LCD::DrawBitmap( unsigned short x, unsigned short y, const bitmap_t* img, unsigned char scale ) |
| casval | 0:0099ad246127 | 399 | { |
| casval | 0:0099ad246127 | 400 | int tx, ty, tc, tsx, tsy; |
| casval | 0:0099ad246127 | 401 | |
| casval | 0:0099ad246127 | 402 | Activate(); |
| casval | 0:0099ad246127 | 403 | if ( scale == 1 ) |
| casval | 0:0099ad246127 | 404 | { |
| casval | 0:0099ad246127 | 405 | SetXY( x, y, x + img->Width - 1, y + img->Height - 1 ); |
| casval | 0:0099ad246127 | 406 | |
| casval | 0:0099ad246127 | 407 | if ( img->Format == RGB16 ) |
| casval | 0:0099ad246127 | 408 | { |
| casval | 0:0099ad246127 | 409 | const unsigned short *pixel = ( const unsigned short* ) img->PixelData; |
| casval | 0:0099ad246127 | 410 | for ( tc = 0; tc < ( img->Width * img->Height ); tc++ ) |
| casval | 0:0099ad246127 | 411 | SetPixelColor( *pixel++, img->Format ); |
| casval | 0:0099ad246127 | 412 | } |
| casval | 0:0099ad246127 | 413 | else if ( img->Format == RGB18 ) |
| casval | 0:0099ad246127 | 414 | { |
| casval | 0:0099ad246127 | 415 | const unsigned int *pixel = ( const unsigned int* ) img->PixelData; |
| casval | 0:0099ad246127 | 416 | for ( tc = 0; tc < ( img->Width * img->Height ); tc++ ) |
| casval | 0:0099ad246127 | 417 | SetPixelColor( *pixel++, img->Format ); |
| casval | 0:0099ad246127 | 418 | } |
| casval | 0:0099ad246127 | 419 | } |
| casval | 0:0099ad246127 | 420 | else |
| casval | 0:0099ad246127 | 421 | { |
| casval | 0:0099ad246127 | 422 | if ( img->Format == RGB16 ) |
| casval | 0:0099ad246127 | 423 | { |
| casval | 0:0099ad246127 | 424 | const unsigned short *pixel = ( const unsigned short* ) img->PixelData; |
| casval | 0:0099ad246127 | 425 | |
| casval | 0:0099ad246127 | 426 | for ( ty = 0; ty < img->Height; ty++ ) |
| casval | 0:0099ad246127 | 427 | { |
| casval | 0:0099ad246127 | 428 | SetXY( x, y + ( ty * scale ), x + ( ( img->Width * scale ) - 1 ), y + ( ty * scale ) + scale ); |
| casval | 0:0099ad246127 | 429 | for ( tsy = 0; tsy < scale; tsy++ ) |
| casval | 0:0099ad246127 | 430 | { |
| casval | 0:0099ad246127 | 431 | for ( tx = 0; tx < img->Width; tx++ ) |
| casval | 0:0099ad246127 | 432 | { |
| casval | 0:0099ad246127 | 433 | for ( tsx = 0; tsx < scale; tsx++ ) |
| casval | 0:0099ad246127 | 434 | SetPixelColor( pixel[ ( ty * img->Width ) + tx ], img->Format ); |
| casval | 0:0099ad246127 | 435 | } |
| casval | 0:0099ad246127 | 436 | } |
| casval | 0:0099ad246127 | 437 | } |
| casval | 0:0099ad246127 | 438 | } |
| casval | 0:0099ad246127 | 439 | else if ( img->Format == RGB18 ) |
| casval | 0:0099ad246127 | 440 | { |
| casval | 0:0099ad246127 | 441 | const unsigned int *pixel = ( const unsigned int* ) img->PixelData; |
| casval | 0:0099ad246127 | 442 | |
| casval | 0:0099ad246127 | 443 | for ( ty = 0; ty < img->Height; ty++ ) |
| casval | 0:0099ad246127 | 444 | { |
| casval | 0:0099ad246127 | 445 | SetXY( x, y + ( ty * scale ), x + ( ( img->Width * scale ) - 1 ), y + ( ty * scale ) + scale ); |
| casval | 0:0099ad246127 | 446 | for ( tsy = 0; tsy < scale; tsy++ ) |
| casval | 0:0099ad246127 | 447 | { |
| casval | 0:0099ad246127 | 448 | for ( tx = 0; tx < img->Width; tx++ ) |
| casval | 0:0099ad246127 | 449 | { |
| casval | 0:0099ad246127 | 450 | for ( tsx = 0; tsx < scale; tsx++ ) |
| casval | 0:0099ad246127 | 451 | SetPixelColor( pixel[ ( ty * img->Width ) + tx ], img->Format ); |
| casval | 0:0099ad246127 | 452 | } |
| casval | 0:0099ad246127 | 453 | } |
| casval | 0:0099ad246127 | 454 | } |
| casval | 0:0099ad246127 | 455 | } |
| casval | 0:0099ad246127 | 456 | } |
| casval | 1:1a3dd94e13cf | 457 | Deactivate(); |
| casval | 0:0099ad246127 | 458 | } |
| casval | 0:0099ad246127 | 459 | |
| casval | 0:0099ad246127 | 460 | void LCD::DrawBitmap( unsigned short x, unsigned short y, const bitmap_t* img, unsigned short deg, unsigned short rox, unsigned short roy ) |
| casval | 0:0099ad246127 | 461 | { |
| casval | 0:0099ad246127 | 462 | int tx, ty, newx, newy; |
| casval | 0:0099ad246127 | 463 | double radian; |
| casval | 0:0099ad246127 | 464 | radian = deg * 0.0175; |
| casval | 0:0099ad246127 | 465 | |
| casval | 0:0099ad246127 | 466 | if ( deg == 0 ) |
| casval | 0:0099ad246127 | 467 | DrawBitmap( x, y, img ); |
| casval | 0:0099ad246127 | 468 | else |
| casval | 0:0099ad246127 | 469 | { |
| casval | 0:0099ad246127 | 470 | Activate(); |
| casval | 0:0099ad246127 | 471 | |
| casval | 0:0099ad246127 | 472 | if ( img->Format == RGB16 ) |
| casval | 0:0099ad246127 | 473 | { |
| casval | 0:0099ad246127 | 474 | const unsigned short *pixel = ( const unsigned short* ) img->PixelData; |
| casval | 0:0099ad246127 | 475 | |
| casval | 0:0099ad246127 | 476 | for ( ty = 0; ty < img->Height; ty++ ) |
| casval | 0:0099ad246127 | 477 | for ( tx = 0; tx < img->Width; tx++ ) |
| casval | 0:0099ad246127 | 478 | { |
| casval | 0:0099ad246127 | 479 | newx = x + rox + ( ( ( tx - rox ) * cos( radian ) ) - ( ( ty - roy ) * sin( radian ) ) ); |
| casval | 0:0099ad246127 | 480 | newy = y + roy + ( ( ( ty - roy ) * cos( radian ) ) + ( ( tx - rox ) * sin( radian ) ) ); |
| casval | 0:0099ad246127 | 481 | |
| casval | 0:0099ad246127 | 482 | SetXY( newx, newy, newx, newy ); |
| casval | 0:0099ad246127 | 483 | SetPixelColor( pixel[ ( ty * img->Width ) + tx ], img->Format ); |
| casval | 0:0099ad246127 | 484 | } |
| casval | 0:0099ad246127 | 485 | } |
| casval | 0:0099ad246127 | 486 | else if ( img->Format == RGB18 ) |
| casval | 0:0099ad246127 | 487 | { |
| casval | 0:0099ad246127 | 488 | const unsigned int *pixel = ( const unsigned int* ) img->PixelData; |
| casval | 0:0099ad246127 | 489 | |
| casval | 0:0099ad246127 | 490 | for ( ty = 0; ty < img->Height; ty++ ) |
| casval | 0:0099ad246127 | 491 | for ( tx = 0; tx < img->Width; tx++ ) |
| casval | 0:0099ad246127 | 492 | { |
| casval | 0:0099ad246127 | 493 | newx = x + rox + ( ( ( tx - rox ) * cos( radian ) ) - ( ( ty - roy ) * sin( radian ) ) ); |
| casval | 0:0099ad246127 | 494 | newy = y + roy + ( ( ( ty - roy ) * cos( radian ) ) + ( ( tx - rox ) * sin( radian ) ) ); |
| casval | 0:0099ad246127 | 495 | |
| casval | 0:0099ad246127 | 496 | SetXY( newx, newy, newx, newy ); |
| casval | 0:0099ad246127 | 497 | SetPixelColor( pixel[ ( ty * img->Width ) + tx ], img->Format ); |
| casval | 0:0099ad246127 | 498 | } |
| casval | 0:0099ad246127 | 499 | } |
| casval | 0:0099ad246127 | 500 | Deactivate(); |
| casval | 0:0099ad246127 | 501 | } |
| casval | 0:0099ad246127 | 502 | } |
| casval | 0:0099ad246127 | 503 | |
| casval | 0:0099ad246127 | 504 | inline |
| casval | 0:0099ad246127 | 505 | void LCD::Activate( void ) |
| casval | 0:0099ad246127 | 506 | { |
| casval | 0:0099ad246127 | 507 | _lcd_pin_cs = LOW; |
| casval | 0:0099ad246127 | 508 | } |
| casval | 0:0099ad246127 | 509 | |
| casval | 0:0099ad246127 | 510 | inline |
| casval | 0:0099ad246127 | 511 | void LCD::Deactivate( void ) |
| casval | 0:0099ad246127 | 512 | { |
| casval | 0:0099ad246127 | 513 | _lcd_pin_cs = HIGH; |
| casval | 0:0099ad246127 | 514 | } |
| casval | 0:0099ad246127 | 515 | |
| casval | 0:0099ad246127 | 516 | inline |
| casval | 0:0099ad246127 | 517 | void LCD::WriteCmdData( unsigned short cmd, unsigned short data ) |
| casval | 0:0099ad246127 | 518 | { |
| casval | 0:0099ad246127 | 519 | WriteCmd( cmd ); |
| casval | 0:0099ad246127 | 520 | WriteData( data ); |
| casval | 0:0099ad246127 | 521 | } |
| casval | 0:0099ad246127 | 522 | |
| casval | 0:0099ad246127 | 523 | inline |
| casval | 0:0099ad246127 | 524 | void LCD::ClearXY( void ) |
| casval | 0:0099ad246127 | 525 | { |
| casval | 0:0099ad246127 | 526 | SetXY( 0, 0, GetWidth() - 1, GetHeight() - 1 ); |
| casval | 0:0099ad246127 | 527 | } |
| casval | 0:0099ad246127 | 528 | |
| casval | 0:0099ad246127 | 529 | void LCD::DrawHLine( unsigned short x, unsigned short y, unsigned short len, int color ) |
| casval | 0:0099ad246127 | 530 | { |
| casval | 0:0099ad246127 | 531 | unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color; |
| casval | 0:0099ad246127 | 532 | |
| casval | 0:0099ad246127 | 533 | Activate(); |
| casval | 0:0099ad246127 | 534 | SetXY( x, y, x + len, y ); |
| casval | 0:0099ad246127 | 535 | for ( int i = 0; i < len + 1; i++ ) |
| casval | 0:0099ad246127 | 536 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 537 | Deactivate(); |
| casval | 0:0099ad246127 | 538 | } |
| casval | 0:0099ad246127 | 539 | |
| casval | 0:0099ad246127 | 540 | void LCD::DrawVLine( unsigned short x, unsigned short y, unsigned short len, int color ) |
| casval | 0:0099ad246127 | 541 | { |
| casval | 0:0099ad246127 | 542 | unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color; |
| casval | 0:0099ad246127 | 543 | |
| casval | 0:0099ad246127 | 544 | Activate(); |
| casval | 0:0099ad246127 | 545 | SetXY( x, y, x, y + len ); |
| casval | 0:0099ad246127 | 546 | for ( int i = 0; i < len; i++ ) |
| casval | 0:0099ad246127 | 547 | SetPixelColor( usedColor ); |
| casval | 0:0099ad246127 | 548 | Deactivate(); |
| casval | 0:0099ad246127 | 549 | } |
| casval | 0:0099ad246127 | 550 | |
| casval | 0:0099ad246127 | 551 | void LCD::PrintChar( char c, unsigned short x, unsigned short y, int fgColor, int bgColor ) |
| casval | 0:0099ad246127 | 552 | { |
| casval | 0:0099ad246127 | 553 | uint8_t i, ch; |
| casval | 0:0099ad246127 | 554 | uint16_t j; |
| casval | 0:0099ad246127 | 555 | unsigned int usedColorFG = fgColor == -1 ? _background : fgColor == -2 ? _foreground : ( unsigned int ) fgColor; |
| casval | 0:0099ad246127 | 556 | unsigned int usedColorBG = bgColor == -1 ? _background : bgColor == -2 ? _foreground : ( unsigned int ) bgColor; |
| casval | 0:0099ad246127 | 557 | |
| casval | 0:0099ad246127 | 558 | uint16_t totalCharBytes = ( _font->Width * _font->Height ) / 8; |
| casval | 0:0099ad246127 | 559 | int16_t position = _font->Position[ c - _font->Offset ]; |
| casval | 0:0099ad246127 | 560 | if ( position == -1 ) position = 0; // will print space character |
| casval | 0:0099ad246127 | 561 | |
| casval | 0:0099ad246127 | 562 | Activate(); |
| casval | 0:0099ad246127 | 563 | |
| casval | 0:0099ad246127 | 564 | SetXY( x, y, x + _font->Width - 1, y + _font->Height - 1 ); |
| casval | 0:0099ad246127 | 565 | |
| casval | 0:0099ad246127 | 566 | for ( j = 0; j < totalCharBytes; j++ ) |
| casval | 0:0099ad246127 | 567 | { |
| casval | 0:0099ad246127 | 568 | ch = _font->Data[ position ]; |
| casval | 0:0099ad246127 | 569 | for ( i = 0; i < 8; i++ ) |
| casval | 0:0099ad246127 | 570 | { |
| casval | 0:0099ad246127 | 571 | if ( ( ch & ( 1 << ( 7 - i ) ) ) != 0 ) SetPixelColor( usedColorFG ); |
| casval | 0:0099ad246127 | 572 | else SetPixelColor( usedColorBG ); |
| casval | 0:0099ad246127 | 573 | } |
| casval | 0:0099ad246127 | 574 | position++; |
| casval | 0:0099ad246127 | 575 | } |
| casval | 0:0099ad246127 | 576 | Deactivate(); |
| casval | 0:0099ad246127 | 577 | } |
| casval | 0:0099ad246127 | 578 | |
| casval | 0:0099ad246127 | 579 | void LCD::RotateChar( char c, unsigned short x, unsigned short y, int pos, int fgColor, int bgColor, unsigned short deg ) |
| casval | 0:0099ad246127 | 580 | { |
| casval | 0:0099ad246127 | 581 | uint8_t i, j, ch; |
| casval | 0:0099ad246127 | 582 | int newx, newy; |
| casval | 0:0099ad246127 | 583 | double radian; |
| casval | 0:0099ad246127 | 584 | radian = deg * 0.0175; |
| casval | 0:0099ad246127 | 585 | |
| casval | 0:0099ad246127 | 586 | unsigned int usedColorFG = fgColor == -1 ? _background : fgColor == -2 ? _foreground : ( unsigned int ) fgColor; |
| casval | 0:0099ad246127 | 587 | unsigned int usedColorBG = bgColor == -1 ? _background : bgColor == -2 ? _foreground : ( unsigned int ) bgColor; |
| casval | 0:0099ad246127 | 588 | |
| casval | 0:0099ad246127 | 589 | int16_t position = _font->Position[ c - _font->Offset ]; |
| casval | 0:0099ad246127 | 590 | if ( position == -1 ) position = 0; // will print space character |
| casval | 0:0099ad246127 | 591 | |
| casval | 0:0099ad246127 | 592 | Activate(); |
| casval | 0:0099ad246127 | 593 | |
| casval | 0:0099ad246127 | 594 | for ( j = 0; j < _font->Height; j++ ) |
| casval | 0:0099ad246127 | 595 | { |
| casval | 0:0099ad246127 | 596 | for ( uint16_t zz = 0; zz < ( ( double ) _font->Width / 8 ); zz++ ) |
| casval | 0:0099ad246127 | 597 | { |
| casval | 0:0099ad246127 | 598 | ch = _font->Data[ position + zz ]; |
| casval | 0:0099ad246127 | 599 | for ( i = 0; i < 8; i++ ) |
| casval | 0:0099ad246127 | 600 | { |
| casval | 0:0099ad246127 | 601 | newx = x + ( ( ( i + ( zz * 8 ) + ( pos * _font->Width ) ) * cos( radian ) ) - ( ( j ) * sin( radian ) ) ); |
| casval | 0:0099ad246127 | 602 | newy = y + ( ( ( j ) * cos( radian ) ) + ( ( i + ( zz * 8 ) + ( pos * _font->Width ) ) * sin( radian ) ) ); |
| casval | 0:0099ad246127 | 603 | |
| casval | 0:0099ad246127 | 604 | SetXY( newx, newy, newx + 1, newy + 1 ); |
| casval | 0:0099ad246127 | 605 | |
| casval | 0:0099ad246127 | 606 | if ( ( ch & ( 1 << ( 7 - i ) ) ) != 0 ) SetPixelColor( usedColorFG ); |
| casval | 0:0099ad246127 | 607 | else SetPixelColor( usedColorBG ); |
| casval | 0:0099ad246127 | 608 | } |
| casval | 0:0099ad246127 | 609 | } |
| casval | 0:0099ad246127 | 610 | position += ( _font->Width / 8 ); |
| casval | 0:0099ad246127 | 611 | } |
| casval | 0:0099ad246127 | 612 | |
| casval | 0:0099ad246127 | 613 | Deactivate(); |
| casval | 0:0099ad246127 | 614 | } |
| casval | 0:0099ad246127 | 615 |