Update for spelling etc. in comments!
This commit is contained in:
1 parent
aefcf5af63
commit
d506a3c49d
197 files changed
+1006
-757
No files matched your search
+13
-13
@@ -48,7 +48,7 @@ void TFT_eSPI::loadFont(String fontName, bool flash)
|
||||
6. Descent in pixels from baseline to bottom of "p"
|
||||
|
||||
Next are gCount sets of values for each glyph, each set comprises 7 int32t parameters (28 bytes):
|
||||
1. Glyph Unicode stored as a 32 bit value
|
||||
1. Glyph Unicode stored as a 32-bit value
|
||||
2. Height of bitmap bounding box
|
||||
3. Width of bitmap bounding box
|
||||
4. gxAdvance for cursor (setWidth in Processing)
|
||||
@@ -57,7 +57,7 @@ void TFT_eSPI::loadFont(String fontName, bool flash)
|
||||
7. padding value, typically 0
|
||||
|
||||
The bitmaps start next at 24 + (28 * gCount) bytes from the start of the file.
|
||||
Each pixel is 1 byte, an 8 bit Alpha value which represents the transparency from
|
||||
Each pixel is 1 byte, an 8-bit Alpha value which represents the transparency from
|
||||
0xFF foreground colour, 0x00 background. The library uses a linear interpolation
|
||||
between the foreground and background RGB component colours. e.g.
|
||||
pixelRed = ((fgRed * alpha) + (bgRed * (255 - alpha))/255
|
||||
@@ -158,7 +158,7 @@ void TFT_eSPI::loadMetrics(void)
|
||||
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
|
||||
if ( psramFound() )
|
||||
{
|
||||
gUnicode = (uint16_t*)ps_malloc( gFont.gCount * 2); // Unicode 16 bit Basic Multilingual Plane (0-FFFF)
|
||||
gUnicode = (uint16_t*)ps_malloc( gFont.gCount * 2); // Unicode 16-bit Basic Multilingual Plane (0-FFFF)
|
||||
gHeight = (uint8_t*)ps_malloc( gFont.gCount ); // Height of glyph
|
||||
gWidth = (uint8_t*)ps_malloc( gFont.gCount ); // Width of glyph
|
||||
gxAdvance = (uint8_t*)ps_malloc( gFont.gCount ); // xAdvance - to move x cursor
|
||||
@@ -169,7 +169,7 @@ void TFT_eSPI::loadMetrics(void)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
gUnicode = (uint16_t*)malloc( gFont.gCount * 2); // Unicode 16 bit Basic Multilingual Plane (0-FFFF)
|
||||
gUnicode = (uint16_t*)malloc( gFont.gCount * 2); // Unicode 16-bit Basic Multilingual Plane (0-FFFF)
|
||||
gHeight = (uint8_t*)malloc( gFont.gCount ); // Height of glyph
|
||||
gWidth = (uint8_t*)malloc( gFont.gCount ); // Width of glyph
|
||||
gxAdvance = (uint8_t*)malloc( gFont.gCount ); // xAdvance - to move x cursor
|
||||
@@ -308,7 +308,7 @@ void TFT_eSPI::unloadFont( void )
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: readInt32
|
||||
** Description: Get a 32 bit integer from the font file
|
||||
** Description: Get a 32-bit integer from the font file
|
||||
*************************************************************************************x*/
|
||||
uint32_t TFT_eSPI::readInt32(void)
|
||||
{
|
||||
@@ -316,18 +316,18 @@ uint32_t TFT_eSPI::readInt32(void)
|
||||
|
||||
#ifdef FONT_FS_AVAILABLE
|
||||
if (fs_font) {
|
||||
val = fontFile.read() << 24;
|
||||
val |= fontFile.read() << 16;
|
||||
val |= fontFile.read() << 8;
|
||||
val |= fontFile.read();
|
||||
val = (uint32_t)fontFile.read() << 24;
|
||||
val |= (uint32_t)fontFile.read() << 16;
|
||||
val |= (uint32_t)fontFile.read() << 8;
|
||||
val |= (uint32_t)fontFile.read();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
val = pgm_read_byte(fontPtr++) << 24;
|
||||
val |= pgm_read_byte(fontPtr++) << 16;
|
||||
val |= pgm_read_byte(fontPtr++) << 8;
|
||||
val |= pgm_read_byte(fontPtr++);
|
||||
val = (uint32_t)pgm_read_byte(fontPtr++) << 24;
|
||||
val |= (uint32_t)pgm_read_byte(fontPtr++) << 16;
|
||||
val |= (uint32_t)pgm_read_byte(fontPtr++) << 8;
|
||||
val |= (uint32_t)pgm_read_byte(fontPtr++);
|
||||
}
|
||||
|
||||
return val;
|
||||
|
||||
@@ -47,7 +47,7 @@ TFT_eSprite::TFT_eSprite(TFT_eSPI *tft)
|
||||
** Function name: createSprite
|
||||
** Description: Create a sprite (bitmap) of defined width and height
|
||||
***************************************************************************************/
|
||||
// cast returned value to (uint8_t*) for 8 bit or (uint16_t*) for 16 bit colours
|
||||
// cast returned value to (uint8_t*) for 8-bit or (uint16_t*) for 16-bit colours
|
||||
void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
|
||||
{
|
||||
|
||||
@@ -1104,7 +1104,7 @@ void TFT_eSprite::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_
|
||||
}
|
||||
else if (_bpp == 4)
|
||||
{
|
||||
// The image is assumed to be 4 bit, where each byte corresponds to two pixels.
|
||||
// The image is assumed to be 4-bit, where each byte corresponds to two pixels.
|
||||
// much faster when aligned to a byte boundary, because the alternative is slower, requiring
|
||||
// tedious bit operations.
|
||||
|
||||
@@ -1355,10 +1355,10 @@ void TFT_eSprite::writeColor(uint16_t color)
|
||||
{
|
||||
if (!_created ) return;
|
||||
|
||||
// Write 16 bit RGB 565 encoded colour to RAM
|
||||
// Write 16-bit RGB 565 encoded colour to RAM
|
||||
if (_bpp == 16) _img [_xptr + _yptr * _iwidth] = color;
|
||||
|
||||
// Write 8 bit RGB 332 encoded colour to RAM
|
||||
// Write 8-bit RGB 332 encoded colour to RAM
|
||||
else if (_bpp == 8) _img8[_xptr + _yptr * _iwidth] = (uint8_t) color;
|
||||
|
||||
else if (_bpp == 4)
|
||||
@@ -2138,7 +2138,7 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: drawChar
|
||||
** Description: draw a unicode glyph into the sprite
|
||||
** Description: draw a Unicode glyph into the sprite
|
||||
***************************************************************************************/
|
||||
// TODO: Rationalise with TFT_eSPI
|
||||
// Any UTF-8 decoding must be done before calling drawChar()
|
||||
@@ -2290,7 +2290,7 @@ int16_t TFT_eSprite::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t fo
|
||||
|
||||
uint8_t tnp = 0; // Temporary copy of np for while loop
|
||||
uint8_t ts = textsize - 1; // Temporary copy of textsize
|
||||
// 16 bit pixel count so maximum font size is equivalent to 180x180 pixels in area
|
||||
// 16-bit pixel count so maximum font size is equivalent to 180x180 pixels in area
|
||||
// w is total number of pixels to plot to fill character block
|
||||
while (pc < w) {
|
||||
line = pgm_read_byte((uint8_t *)flash_address);
|
||||
|
||||
+12
-12
@@ -13,12 +13,12 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
~TFT_eSprite(void);
|
||||
|
||||
// Create a sprite of width x height pixels, return a pointer to the RAM area
|
||||
// Sketch can cast returned value to (uint16_t*) for 16 bit depth if needed
|
||||
// Sketch can cast returned value to (uint16_t*) for 16-bit depth if needed
|
||||
// RAM required is:
|
||||
// - 1 bit per pixel for 1 bit colour depth
|
||||
// - 1 nibble per pixel for 4 bit colour (with palette table)
|
||||
// - 1 byte per pixel for 8 bit colour (332 RGB format)
|
||||
// - 2 bytes per pixel for 16 bit color depth (565 RGB format)
|
||||
// - 1 nibble per pixel for 4-bit colour (with palette table)
|
||||
// - 1 byte per pixel for 8-bit colour (332 RGB format)
|
||||
// - 2 bytes per pixel for 16-bit color depth (565 RGB format)
|
||||
void* createSprite(int16_t width, int16_t height, uint8_t frames = 1);
|
||||
|
||||
// Returns a pointer to the sprite or nullptr if not created, user must cast to pointer type
|
||||
@@ -39,7 +39,7 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
void* setColorDepth(int8_t b);
|
||||
int8_t getColorDepth(void);
|
||||
|
||||
// Set the palette for a 4 bit depth sprite. Only the first 16 colours in the map are used.
|
||||
// Set the palette for a 4-bit depth sprite. Only the first 16 colours in the map are used.
|
||||
void createPalette(uint16_t *palette = nullptr, uint8_t colors = 16); // Palette in RAM
|
||||
void createPalette(const uint16_t *palette = nullptr, uint8_t colors = 16); // Palette in FLASH
|
||||
|
||||
@@ -61,14 +61,14 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
// Fill Sprite with a colour
|
||||
fillSprite(uint32_t color),
|
||||
|
||||
// Define a window to push 16 bit colour pixels into in a raster order
|
||||
// Define a window to push 16-bit colour pixels into in a raster order
|
||||
// Colours are converted to the set Sprite colour bit depth
|
||||
setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1),
|
||||
// Push a color (aka singe pixel) to the sprite's set window area
|
||||
pushColor(uint16_t color),
|
||||
// Push len colors (pixels) to the sprite's set window area
|
||||
pushColor(uint16_t color, uint32_t len),
|
||||
// Push a pixel pre-formatted as a 1, 4, 8 or 16 bit colour (avoids conversion overhead)
|
||||
// Push a pixel pre-formatted as a 1, 4, 8 or 16-bit colour (avoids conversion overhead)
|
||||
writeColor(uint16_t color),
|
||||
|
||||
// Set the scroll zone, top left corner at x,y with defined width and height
|
||||
@@ -139,7 +139,7 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
height(void);
|
||||
|
||||
// Functions associated with anti-aliased fonts
|
||||
// Draw a single unicode character using the loaded font
|
||||
// Draw a single Unicode character using the loaded font
|
||||
void drawGlyph(uint16_t code);
|
||||
// Print string to sprite using loaded font at cursor position
|
||||
void printToSprite(String string);
|
||||
@@ -162,13 +162,13 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
protected:
|
||||
|
||||
uint8_t _bpp; // bits per pixel (1, 4, 8 or 16)
|
||||
uint16_t *_img; // pointer to 16 bit sprite
|
||||
uint8_t *_img8; // pointer to 1 and 8 bit sprite frame 1 or frame 2
|
||||
uint8_t *_img4; // pointer to 4 bit sprite (uses color map)
|
||||
uint16_t *_img; // pointer to 16-bit sprite
|
||||
uint8_t *_img8; // pointer to 1 and 8-bit sprite frame 1 or frame 2
|
||||
uint8_t *_img4; // pointer to 4-bit sprite (uses color map)
|
||||
uint8_t *_img8_1; // pointer to frame 1
|
||||
uint8_t *_img8_2; // pointer to frame 2
|
||||
|
||||
uint16_t *_colorMap; // color map pointer: 16 entries, used with 4 bit color map.
|
||||
uint16_t *_colorMap; // color map pointer: 16 entries, used with 4-bit color map.
|
||||
|
||||
int32_t _sinra; // Sine of rotation angle in fixed point
|
||||
int32_t _cosra; // Cosine of rotation angle in fixed point
|
||||
|
||||
Reference in new issue
Block a user