Use TouchGFX
This commit is contained in:
1
TouchGFX/generated/fonts/UnicodeListverdana_10_4.txt
Normal file
1
TouchGFX/generated/fonts/UnicodeListverdana_10_4.txt
Normal file
@ -0,0 +1 @@
|
||||
63
|
||||
8
TouchGFX/generated/fonts/UnicodeListverdana_20_4.txt
Normal file
8
TouchGFX/generated/fonts/UnicodeListverdana_20_4.txt
Normal file
@ -0,0 +1,8 @@
|
||||
63
|
||||
66
|
||||
70
|
||||
83
|
||||
84
|
||||
85
|
||||
97
|
||||
101
|
||||
1
TouchGFX/generated/fonts/UnicodeListverdana_40_4.txt
Normal file
1
TouchGFX/generated/fonts/UnicodeListverdana_40_4.txt
Normal file
@ -0,0 +1 @@
|
||||
63
|
||||
1
TouchGFX/generated/fonts/cache/ApplicationFontProvider.cache
vendored
Normal file
1
TouchGFX/generated/fonts/cache/ApplicationFontProvider.cache
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"typographies":[["Default","verdana.ttf",20,4],["Large","verdana.ttf",40,4],["Small","verdana.ttf",10,4]],"generate_font_format":"0"}
|
||||
1
TouchGFX/generated/fonts/cache/ApplicationFontProviderHpp.cache
vendored
Normal file
1
TouchGFX/generated/fonts/cache/ApplicationFontProviderHpp.cache
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"typographies":[["Default","verdana.ttf",20,4],["Large","verdana.ttf",40,4],["Small","verdana.ttf",10,4]],"generate_font_format":"0"}
|
||||
2
TouchGFX/generated/fonts/cache/Font_verdana_10_4bppCpp.cache
vendored
Normal file
2
TouchGFX/generated/fonts/cache/Font_verdana_10_4bppCpp.cache
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
AH:0 BA:1 FC:63 EC:0 FF:0 CF:1
|
||||
63
|
||||
9
TouchGFX/generated/fonts/cache/Font_verdana_20_4bppCpp.cache
vendored
Normal file
9
TouchGFX/generated/fonts/cache/Font_verdana_20_4bppCpp.cache
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
AH:0 BA:1 FC:63 EC:0 FF:0 CF:0
|
||||
63
|
||||
66
|
||||
70
|
||||
83
|
||||
84
|
||||
85
|
||||
97
|
||||
101
|
||||
2
TouchGFX/generated/fonts/cache/Font_verdana_40_4bppCpp.cache
vendored
Normal file
2
TouchGFX/generated/fonts/cache/Font_verdana_40_4bppCpp.cache
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
AH:0 BA:1 FC:63 EC:0 FF:0 CF:0
|
||||
63
|
||||
@ -0,0 +1,44 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#ifndef TOUCHGFX_APPLICATIONFONTPROVIDER_HPP
|
||||
#define TOUCHGFX_APPLICATIONFONTPROVIDER_HPP
|
||||
|
||||
#include <touchgfx/FontManager.hpp>
|
||||
|
||||
namespace touchgfx
|
||||
{
|
||||
class FlashDataReader;
|
||||
}
|
||||
|
||||
struct Typography
|
||||
{
|
||||
static const touchgfx::FontId DEFAULT = 0;
|
||||
static const touchgfx::FontId LARGE = 1;
|
||||
static const touchgfx::FontId SMALL = 2;
|
||||
};
|
||||
|
||||
struct TypographyFontIndex
|
||||
{
|
||||
static const touchgfx::FontId DEFAULT = 0; // verdana_20_4bpp
|
||||
static const touchgfx::FontId LARGE = 1; // verdana_40_4bpp
|
||||
static const touchgfx::FontId SMALL = 2; // verdana_10_4bpp
|
||||
static const uint16_t NUMBER_OF_FONTS = 3;
|
||||
};
|
||||
|
||||
class ApplicationFontProvider : public touchgfx::FontProvider
|
||||
{
|
||||
public:
|
||||
virtual touchgfx::Font* getFont(touchgfx::FontId typography);
|
||||
|
||||
static void setFlashReader(touchgfx::FlashDataReader* /*flashReader*/)
|
||||
{
|
||||
}
|
||||
|
||||
static touchgfx::FlashDataReader* getFlashReader()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // TOUCHGFX_APPLICATIONFONTPROVIDER_HPP
|
||||
92
TouchGFX/generated/fonts/include/fonts/CachedFont.hpp
Normal file
92
TouchGFX/generated/fonts/include/fonts/CachedFont.hpp
Normal file
@ -0,0 +1,92 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#ifndef TOUCHGFX_CACHEDFONT_HPP
|
||||
#define TOUCHGFX_CACHEDFONT_HPP
|
||||
|
||||
#include <fonts/FontCache.hpp>
|
||||
#include <fonts/GeneratedFont.hpp>
|
||||
|
||||
namespace touchgfx
|
||||
{
|
||||
class CachedFont : public GeneratedFont
|
||||
{
|
||||
public:
|
||||
CachedFont(const struct touchgfx::BinaryFontData* data, FontId id, FontCache* _cache, const GeneratedFont* _flashFont)
|
||||
: GeneratedFont(0, // GlyphNode*
|
||||
data->numberOfGlyphs,
|
||||
data->fontHeight,
|
||||
data->baseline,
|
||||
data->pixAboveTop,
|
||||
data->pixBelowBottom,
|
||||
data->bitsPerPixel,
|
||||
data->byteAlignRow,
|
||||
data->maxLeft,
|
||||
data->maxRight,
|
||||
0, // glyphDataPointer
|
||||
0, // Kerning table not used for cached font
|
||||
data->fallbackChar,
|
||||
data->ellipsisChar,
|
||||
0, // lsubTablePointer
|
||||
0), // contextualFormsPointer
|
||||
fontId(id),
|
||||
cache(_cache),
|
||||
flashFont(_flashFont)
|
||||
{
|
||||
}
|
||||
|
||||
CachedFont()
|
||||
: GeneratedFont()
|
||||
{
|
||||
}
|
||||
|
||||
using GeneratedFont::getGlyph;
|
||||
|
||||
virtual const GlyphNode* getGlyph(Unicode::UnicodeChar unicode, const uint8_t*& pixelData, uint8_t& bitsPerPixel) const;
|
||||
|
||||
virtual const uint8_t* getPixelData(const GlyphNode* glyph) const;
|
||||
|
||||
virtual int8_t getKerning(Unicode::UnicodeChar prevChar, const GlyphNode* glyph) const;
|
||||
|
||||
void setFontCache(FontCache& cache);
|
||||
FontId getFontId() const
|
||||
{
|
||||
return fontId;
|
||||
}
|
||||
|
||||
virtual const uint16_t* getGSUBTable() const
|
||||
{
|
||||
if (gsubTable != 0)
|
||||
{
|
||||
return gsubTable;
|
||||
}
|
||||
return flashFont->getGSUBTable();
|
||||
}
|
||||
|
||||
virtual void setGSUBTable(const uint16_t* table)
|
||||
{
|
||||
gsubTable = table;
|
||||
}
|
||||
|
||||
virtual const FontContextualFormsTable* getContextualFormsTable() const
|
||||
{
|
||||
if (arabicTable != 0)
|
||||
{
|
||||
return arabicTable;
|
||||
}
|
||||
return flashFont->getContextualFormsTable();
|
||||
}
|
||||
|
||||
virtual void setContextualFormsTable(const FontContextualFormsTable* table)
|
||||
{
|
||||
arabicTable = table;
|
||||
}
|
||||
|
||||
private:
|
||||
FontId fontId;
|
||||
FontCache* cache;
|
||||
const GeneratedFont* flashFont;
|
||||
};
|
||||
} // namespace touchgfx
|
||||
|
||||
#endif // TOUCHGFX_CACHEDFONT_HPP
|
||||
96
TouchGFX/generated/fonts/include/fonts/FontCache.hpp
Normal file
96
TouchGFX/generated/fonts/include/fonts/FontCache.hpp
Normal file
@ -0,0 +1,96 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#ifndef TOUCHGFX_FONTCACHE_HPP
|
||||
#define TOUCHGFX_FONTCACHE_HPP
|
||||
|
||||
#include <touchgfx/Font.hpp>
|
||||
#include <touchgfx/TypedText.hpp>
|
||||
#include <fonts/ApplicationFontProvider.hpp>
|
||||
|
||||
namespace touchgfx
|
||||
{
|
||||
class CachedFont;
|
||||
|
||||
class FontDataReader
|
||||
{
|
||||
public:
|
||||
virtual ~FontDataReader()
|
||||
{
|
||||
}
|
||||
virtual void open() = 0;
|
||||
virtual void close() = 0;
|
||||
virtual void setPosition(uint32_t position) = 0;
|
||||
virtual void readData(void* out, uint32_t numberOfBytes) = 0;
|
||||
};
|
||||
|
||||
class FontCache
|
||||
{
|
||||
public:
|
||||
FontCache();
|
||||
void setReader(FontDataReader* reader);
|
||||
void clear(bool keepGsubOrContextTable = false);
|
||||
void setMemory(uint8_t* memory, uint32_t size);
|
||||
void initializeCachedFont(TypedText t, CachedFont* font, bool loadGsubOrContextTable = false);
|
||||
bool cacheString(TypedText t, const Unicode::UnicodeChar* string);
|
||||
bool cacheLigatures(CachedFont* font, TypedText t, const Unicode::UnicodeChar* string);
|
||||
|
||||
const GlyphNode* getGlyph(Unicode::UnicodeChar unicode, FontId font) const;
|
||||
uint32_t getMemoryUsage()
|
||||
{
|
||||
return memorySize - (gsubStart - top);
|
||||
}
|
||||
|
||||
void open();
|
||||
void close();
|
||||
|
||||
static inline const uint8_t* getPixelData(const GlyphNode* glyph)
|
||||
{
|
||||
return ((const uint8_t*)glyph) + SizeGlyphNode + 4;
|
||||
}
|
||||
static inline bool isCached(const GlyphNode* g)
|
||||
{
|
||||
return g->dataOffset == 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint32_t SizeGlyphNode = 16;
|
||||
|
||||
bool contains(Unicode::UnicodeChar unicode, FontId font) const;
|
||||
void insert(Unicode::UnicodeChar unicode, FontId font, uint32_t bpp, bool& outOfMemory);
|
||||
uint8_t* copyGlyph(uint8_t* top, Unicode::UnicodeChar unicode, FontId font, uint32_t bpp, bool& outOfMemory);
|
||||
|
||||
void cacheData(uint32_t bpp, GlyphNode* first);
|
||||
bool cacheSortedString(TypedText t);
|
||||
bool createSortedString(const Unicode::UnicodeChar* string);
|
||||
bool createSortedLigatures(CachedFont* font, TypedText t, const Unicode::UnicodeChar* string, ...);
|
||||
bool sortSortedString(int n);
|
||||
|
||||
void setPosition(uint32_t position);
|
||||
void readData(void* out, uint32_t numberOfBytes);
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t* first; // First GlyphNode, glyph in cache;
|
||||
uint8_t* last; // Last GlyphNode, glyph in cache;
|
||||
} fontTable[MAX(TypographyFontIndex::NUMBER_OF_FONTS, 1)];
|
||||
|
||||
uint32_t memorySize;
|
||||
uint8_t* memory; // Start of memory
|
||||
uint8_t* top; // First unused byte
|
||||
uint8_t* gsubStart; // First address of GSUB tables, allocated in the end of the cache
|
||||
|
||||
FontDataReader* reader;
|
||||
|
||||
Unicode::UnicodeChar* sortedString;
|
||||
// Must be bigger than BinaryFontData
|
||||
static const uint32_t MAX_BUFFER_SIZE = 64;
|
||||
char buffer[MAX_BUFFER_SIZE];
|
||||
uint32_t glyphDataOffset;
|
||||
uint16_t numGlyphs;
|
||||
uint16_t currentFileGlyphNumber;
|
||||
GlyphNode currentFileGlyphNode;
|
||||
};
|
||||
} // namespace touchgfx
|
||||
|
||||
#endif // TOUCHGFX_FONTCACHE_HPP
|
||||
132
TouchGFX/generated/fonts/include/fonts/GeneratedFont.hpp
Normal file
132
TouchGFX/generated/fonts/include/fonts/GeneratedFont.hpp
Normal file
@ -0,0 +1,132 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#ifndef TOUCHGFX_GENERATEDFONT_HPP
|
||||
#define TOUCHGFX_GENERATEDFONT_HPP
|
||||
|
||||
#include <touchgfx/ConstFont.hpp>
|
||||
|
||||
namespace touchgfx
|
||||
{
|
||||
class GeneratedFont : public ConstFont
|
||||
{
|
||||
public:
|
||||
GeneratedFont(const GlyphNode* glyphs, uint16_t numGlyphs, uint16_t height, uint16_t baseline, uint8_t pixAboveTop, uint8_t pixBelowBottom, uint8_t bitsPerPixel, uint8_t byteAlignRow, uint8_t maxLeft, uint8_t maxRight, const uint8_t* const* glyphDataInternalFlash, const KerningNode* kerningList, const Unicode::UnicodeChar fallbackChar, const Unicode::UnicodeChar ellipsisChar, const uint16_t* const gsubData, const FontContextualFormsTable* formsTable);
|
||||
|
||||
using ConstFont::getGlyph;
|
||||
|
||||
virtual const uint8_t* getPixelData(const GlyphNode* glyph) const;
|
||||
|
||||
virtual int8_t getKerning(Unicode::UnicodeChar prevChar, const GlyphNode* glyph) const;
|
||||
|
||||
virtual const uint16_t* getGSUBTable() const
|
||||
{
|
||||
return gsubTable;
|
||||
}
|
||||
|
||||
virtual const FontContextualFormsTable* getContextualFormsTable() const
|
||||
{
|
||||
return arabicTable;
|
||||
}
|
||||
|
||||
protected:
|
||||
GeneratedFont()
|
||||
: ConstFont(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), glyphData(0), kerningData(0), gsubTable(0), arabicTable(0)
|
||||
{
|
||||
}
|
||||
|
||||
const void* glyphData; ///< The glyphs
|
||||
const KerningNode* kerningData; ///< The kerning
|
||||
const uint16_t* gsubTable; ///< The GSUB tables
|
||||
|
||||
const FontContextualFormsTable* arabicTable; ///< Contextual forms
|
||||
};
|
||||
|
||||
struct BinaryFontData
|
||||
{
|
||||
uint32_t fontIndex; // The font index (as used by TypedTextDatabase)
|
||||
uint32_t sizeOfFontData; // Size of the complete BinaryFont
|
||||
uint32_t offsetToTable; // GlyphNode[]
|
||||
uint32_t offsetToKerning; // KerningNode[]
|
||||
uint32_t offsetToGlyphs; // uint8_t[]
|
||||
uint32_t offsetToGSUB; // uint16_t[]
|
||||
uint32_t offsetToArabicTable; // FontContextualFormsTable
|
||||
uint16_t numberOfGlyphs; // Number of glyphs in Table and Glyphs
|
||||
uint16_t fontHeight; // Font height
|
||||
uint16_t baseline; // Distance to baseline
|
||||
uint8_t pixAboveTop; // Max pixels above top
|
||||
uint8_t pixBelowBottom; // Max pixels below bottom
|
||||
uint8_t bitsPerPixel; // Bpp
|
||||
uint8_t byteAlignRow; // A4/A2/A1
|
||||
uint8_t maxLeft; // The maximum a glyph extends to the left
|
||||
uint8_t maxRight; // The maximum a glyph extends to the right
|
||||
Unicode::UnicodeChar fallbackChar; // Fallback Character for the font
|
||||
Unicode::UnicodeChar ellipsisChar; // Ellipsis Character for the font
|
||||
};
|
||||
|
||||
class BinaryFont : public GeneratedFont
|
||||
{
|
||||
public:
|
||||
BinaryFont(const struct touchgfx::BinaryFontData* data)
|
||||
: GeneratedFont((const GlyphNode*)((const uint8_t*)data + data->offsetToTable),
|
||||
data->numberOfGlyphs,
|
||||
data->fontHeight,
|
||||
data->baseline,
|
||||
data->pixAboveTop,
|
||||
data->pixBelowBottom,
|
||||
data->bitsPerPixel,
|
||||
data->byteAlignRow,
|
||||
data->maxLeft,
|
||||
data->maxRight,
|
||||
0,
|
||||
(const KerningNode*)((const uint8_t*)data + data->offsetToKerning),
|
||||
data->fallbackChar,
|
||||
data->ellipsisChar,
|
||||
(data->offsetToGSUB == 0) ? 0 : (const uint16_t*)((const uint8_t*)data + data->offsetToGSUB),
|
||||
0),
|
||||
glyphData((const uint8_t*)data + data->offsetToGlyphs)
|
||||
{
|
||||
if (data->offsetToArabicTable > 0)
|
||||
{
|
||||
setupContextualTable(data);
|
||||
}
|
||||
}
|
||||
|
||||
BinaryFont()
|
||||
: GeneratedFont()
|
||||
{
|
||||
}
|
||||
|
||||
virtual const uint8_t* getPixelData(const GlyphNode* glyph) const
|
||||
{
|
||||
const uint8_t* data = (const uint8_t*)glyphData;
|
||||
return &(data[glyph->dataOffset]);
|
||||
}
|
||||
|
||||
protected:
|
||||
const uint8_t* glyphData;
|
||||
FontContextualFormsTable contextualForms;
|
||||
|
||||
private:
|
||||
typedef const Unicode::UnicodeChar (*array5ptr)[5];
|
||||
typedef const Unicode::UnicodeChar (*array4ptr)[4];
|
||||
void setupContextualTable(const struct touchgfx::BinaryFontData* data)
|
||||
{
|
||||
const uint16_t* const base = (const uint16_t*)(((const uint8_t*)data) + data->offsetToArabicTable);
|
||||
// First elements in binary font are offsets to arrays in 16bit words
|
||||
contextualForms.contextualForms4Long = (array5ptr)(base + base[0]);
|
||||
contextualForms.contextualForms3Long = (array5ptr)(base + base[1]);
|
||||
contextualForms.contextualForms2Long = (array5ptr)(base + base[2]);
|
||||
contextualForms.contextualForms0621_063a = (array4ptr)(base + base[3]);
|
||||
contextualForms.contextualForms0641_064a = (array4ptr)(base + base[4]);
|
||||
contextualForms.contextualForms06XX = (array5ptr)(base + base[5]);
|
||||
contextualForms.contextualForms4LongSize = base[6];
|
||||
contextualForms.contextualForms3LongSize = base[7];
|
||||
contextualForms.contextualForms2LongSize = base[8];
|
||||
contextualForms.contextualForms06XXSize = base[9];
|
||||
arabicTable = &contextualForms;
|
||||
}
|
||||
};
|
||||
} // namespace touchgfx
|
||||
|
||||
#endif // TOUCHGFX_GENERATEDFONT_HPP
|
||||
125
TouchGFX/generated/fonts/include/fonts/UnmappedDataFont.hpp
Normal file
125
TouchGFX/generated/fonts/include/fonts/UnmappedDataFont.hpp
Normal file
@ -0,0 +1,125 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#ifndef TOUCHGFX_UNMAPPEDDATAFONT_HPP
|
||||
#define TOUCHGFX_UNMAPPEDDATAFONT_HPP
|
||||
|
||||
#include <touchgfx/Font.hpp>
|
||||
|
||||
namespace touchgfx
|
||||
{
|
||||
/**
|
||||
* An UnmappedDataFont has both glyph table and glyph data placed in a
|
||||
* flash which does not support random access read (indirect
|
||||
* access). A unicode table is located in a flash with random read
|
||||
* access (direct access).
|
||||
*
|
||||
* @see Font, ConstFont
|
||||
*/
|
||||
class UnmappedDataFont : public Font
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Construct the UnmappedDataFont.
|
||||
*
|
||||
* @param glyphs The array of glyphs known to this font (indirect).
|
||||
* @param unicodes The array of unicodes known to this font (direct).
|
||||
* @param numGlyphs The number of glyphs in list.
|
||||
* @param height The height in pixels of the highest character in this font.
|
||||
* @param baseline The height of the baseline in pixels.
|
||||
* @param pixBelowBottom The maximum number of pixels that can be drawn below the
|
||||
* bottom in this font.
|
||||
* @param bitsPerPixel The number of bits per pixel in this font.
|
||||
* @param byteAlignRow Are glyphs encoded using A4 format
|
||||
* @param maxLeft The maximum a character extends to the left.
|
||||
* @param maxRight The maximum a character extends to the right.
|
||||
* @param glyphDataList Pointer to pointers the glyph data for the font (indirect).
|
||||
* @param kerningList pointer to the kerning data for the font (direct).
|
||||
* @param fallbackChar The fallback character for the typography in case no glyph is
|
||||
* available.
|
||||
* @param ellipsisChar The ellipsis character used for truncating long texts.
|
||||
* @param gsubTable Pointer to GSUB table (direct).
|
||||
*/
|
||||
UnmappedDataFont(const GlyphNode* glyphs, const uint16_t* unicodes, uint16_t numGlyphs, uint16_t height, uint16_t baseline, uint8_t pixAboveTop, uint8_t pixBelowBottom, uint8_t bitsPerPixel, uint8_t byteAlignRow, uint8_t maxLeft, uint8_t maxRight, const uint8_t* const* glyphDataList, const KerningNode* kerningList, const Unicode::UnicodeChar fallbackChar, const Unicode::UnicodeChar ellipsisChar, const uint16_t* const gsubData, const FontContextualFormsTable* formsTable);
|
||||
|
||||
using Font::getGlyph;
|
||||
|
||||
/**
|
||||
* Gets the glyph data associated with the specified Unicode. The
|
||||
GlyphNode is allocated in the buffer passed to the constructor.
|
||||
*
|
||||
* Please note that in case of Thai letters and Arabic letters
|
||||
* where diacritics can be placed relative to the previous
|
||||
* character(s), please use TextProvider::getNextLigature()
|
||||
* instead as it will create a temporary GlyphNode that will be
|
||||
* adjusted with respect to X/Y position.
|
||||
*
|
||||
* @param unicode The character to look up.
|
||||
* @param pixelData Pointer to the pixel data for the glyph if the glyph is
|
||||
* found. This is set by this method.
|
||||
* @param [out] bitsPerPixel Reference where to place the number of bits per pixel.
|
||||
*
|
||||
* @return A pointer to the glyph node or null if the glyph was not found.
|
||||
*/
|
||||
virtual const GlyphNode* getGlyph(Unicode::UnicodeChar unicode, const uint8_t*& pixelData, uint8_t& bitsPerPixel) const;
|
||||
|
||||
/**
|
||||
* Obtains the address to the pixel data for the specified glyph.
|
||||
*
|
||||
* @param glyph The glyph to get the pixels data of.
|
||||
*
|
||||
* @return The address of the pixel data of the glyph.
|
||||
*/
|
||||
virtual const uint8_t* getPixelData(const GlyphNode* glyph) const;
|
||||
|
||||
/**
|
||||
* Gets the kerning distance between two characters.
|
||||
*
|
||||
* @param prevChar The unicode value of the previous character.
|
||||
* @param glyph the glyph object for the current character.
|
||||
*
|
||||
* @return The kerning distance between prevChar and glyph char.
|
||||
*/
|
||||
virtual int8_t getKerning(Unicode::UnicodeChar prevChar, const GlyphNode* glyph) const;
|
||||
|
||||
/**
|
||||
* Gets GSUB table.
|
||||
*
|
||||
* @return The GSUB table or null if font has GSUB no table
|
||||
*/
|
||||
virtual const uint16_t* getGSUBTable() const
|
||||
{
|
||||
return gsubTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the contextual forms table used in arabic fonts.
|
||||
*
|
||||
* @return The FontContextualFormsTable or null if the font has no table.
|
||||
*/
|
||||
virtual const FontContextualFormsTable* getContextualFormsTable() const
|
||||
{
|
||||
return arabicTable;
|
||||
}
|
||||
|
||||
protected:
|
||||
UnmappedDataFont()
|
||||
: Font(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), glyphList(0), unicodes(0), glyphDataList(0), kerningData(0), gsubTable(0)
|
||||
{
|
||||
}
|
||||
int lookupUnicode(uint16_t unicode) const;
|
||||
|
||||
const GlyphNode* glyphList; ///< The list of glyphs
|
||||
uint16_t listSize; ///< The size of the list of glyphs
|
||||
const uint16_t* unicodes; ///< LookupTable with all unicodes in this font
|
||||
const void* glyphDataList; ///< The glyphs (list of pointers)
|
||||
const KerningNode* kerningData; ///< The kerning
|
||||
const uint16_t* gsubTable; ///< The GSUB tables
|
||||
|
||||
const FontContextualFormsTable* arabicTable; ///< Contextual forms
|
||||
|
||||
static GlyphNode glyphNodeBuffer; ///< Buffer for GlyphNodes read from unmapped flash
|
||||
};
|
||||
} // namespace touchgfx
|
||||
|
||||
#endif // TOUCHGFX_UNMAPPEDDATAFONT_HPP
|
||||
24
TouchGFX/generated/fonts/src/ApplicationFontProvider.cpp
Normal file
24
TouchGFX/generated/fonts/src/ApplicationFontProvider.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#include <fonts/ApplicationFontProvider.hpp>
|
||||
#include <fonts/GeneratedFont.hpp>
|
||||
#include <texts/TypedTextDatabase.hpp>
|
||||
|
||||
touchgfx::Font* ApplicationFontProvider::getFont(touchgfx::FontId typography)
|
||||
{
|
||||
switch (typography)
|
||||
{
|
||||
case Typography::DEFAULT:
|
||||
// verdana_20_4bpp
|
||||
return const_cast<touchgfx::Font*>(TypedTextDatabase::getFonts()[0]);
|
||||
case Typography::LARGE:
|
||||
// verdana_40_4bpp
|
||||
return const_cast<touchgfx::Font*>(TypedTextDatabase::getFonts()[1]);
|
||||
case Typography::SMALL:
|
||||
// verdana_10_4bpp
|
||||
return const_cast<touchgfx::Font*>(TypedTextDatabase::getFonts()[2]);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
55
TouchGFX/generated/fonts/src/CachedFont.cpp
Normal file
55
TouchGFX/generated/fonts/src/CachedFont.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#include <fonts/CachedFont.hpp>
|
||||
|
||||
namespace touchgfx
|
||||
{
|
||||
const uint8_t* CachedFont::getPixelData(const GlyphNode* glyph) const
|
||||
{
|
||||
// If glyph is cached, then data is present just after the GlyphNode
|
||||
if (FontCache::isCached(glyph))
|
||||
{
|
||||
const uint8_t* data = FontCache::getPixelData(glyph);
|
||||
return data;
|
||||
}
|
||||
return flashFont->getPixelData(glyph);
|
||||
}
|
||||
|
||||
const GlyphNode* CachedFont::getGlyph(Unicode::UnicodeChar unicode, const uint8_t*& pixelData, uint8_t& bitsPerPixel) const
|
||||
{
|
||||
// Look first in internal flash font
|
||||
const GlyphNode* n = flashFont->find(unicode);
|
||||
|
||||
if ((n == 0) && (cache != 0))
|
||||
{
|
||||
// Now look in FontCache table
|
||||
n = cache->getGlyph(unicode, fontId);
|
||||
}
|
||||
|
||||
// Revert to normal behaviour if still not found
|
||||
if (n == 0 && unicode != 0 && unicode != '\n')
|
||||
{
|
||||
Unicode::UnicodeChar fallbackChar = flashFont->getFallbackChar();
|
||||
n = flashFont->find(fallbackChar);
|
||||
if (n == 0)
|
||||
{
|
||||
n = cache->getGlyph(fallbackChar, fontId);
|
||||
}
|
||||
}
|
||||
|
||||
if (n != 0)
|
||||
{
|
||||
pixelData = getPixelData(n);
|
||||
bitsPerPixel = getBitsPerPixel();
|
||||
return n;
|
||||
}
|
||||
return (const GlyphNode*)0;
|
||||
}
|
||||
|
||||
int8_t CachedFont::getKerning(Unicode::UnicodeChar prevChar, const GlyphNode* glyph) const
|
||||
{
|
||||
// Kerning is not supported by Font Caching
|
||||
return 0;
|
||||
}
|
||||
} // namespace touchgfx
|
||||
425
TouchGFX/generated/fonts/src/FontCache.cpp
Normal file
425
TouchGFX/generated/fonts/src/FontCache.cpp
Normal file
@ -0,0 +1,425 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#include <cstring>
|
||||
#include <touchgfx/TextProvider.hpp>
|
||||
#include <touchgfx/Utils.hpp>
|
||||
#include <fonts/CachedFont.hpp>
|
||||
#include <fonts/FontCache.hpp>
|
||||
#include <texts/TypedTextDatabase.hpp>
|
||||
|
||||
namespace touchgfx
|
||||
{
|
||||
FontCache::FontCache()
|
||||
: memorySize(0), memory(0), top(0), gsubStart(0), reader(0)
|
||||
{
|
||||
}
|
||||
|
||||
void FontCache::clear(bool keepGsubOrContextTable /* = false */)
|
||||
{
|
||||
memset(fontTable, 0, sizeof(fontTable));
|
||||
|
||||
// Top is beginning of memory, no glyphs are cached yet
|
||||
top = memory;
|
||||
|
||||
if (!keepGsubOrContextTable)
|
||||
{
|
||||
// gsubStart points to end of memory (nothing loaded yet)
|
||||
gsubStart = memory + memorySize;
|
||||
|
||||
// Round down to 32bit address
|
||||
gsubStart = (uint8_t*)((uintptr_t)gsubStart & ~(uintptr_t)0x3);
|
||||
}
|
||||
}
|
||||
|
||||
void FontCache::setMemory(uint8_t* _memory, uint32_t size)
|
||||
{
|
||||
memory = _memory;
|
||||
memorySize = size;
|
||||
|
||||
clear();
|
||||
}
|
||||
|
||||
void FontCache::setReader(FontDataReader* _reader)
|
||||
{
|
||||
reader = _reader;
|
||||
}
|
||||
|
||||
const GlyphNode* FontCache::getGlyph(Unicode::UnicodeChar unicode, FontId font) const
|
||||
{
|
||||
GlyphNode* g = (GlyphNode*)fontTable[font].first;
|
||||
while (g)
|
||||
{
|
||||
if (g->unicode == unicode)
|
||||
{
|
||||
return g;
|
||||
}
|
||||
GlyphNode** next = (GlyphNode**)((uint8_t*)g + SizeGlyphNode);
|
||||
g = *next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FontCache::open()
|
||||
{
|
||||
if (reader)
|
||||
{
|
||||
reader->open();
|
||||
}
|
||||
}
|
||||
|
||||
void FontCache::close()
|
||||
{
|
||||
if (reader)
|
||||
{
|
||||
reader->close();
|
||||
}
|
||||
}
|
||||
|
||||
void FontCache::initializeCachedFont(TypedText t, CachedFont* font, bool loadGsubOrContextTable /*= false*/)
|
||||
{
|
||||
// Get font index from typed text
|
||||
FontId fontId = t.getFontId();
|
||||
// Reset to start of file
|
||||
open();
|
||||
setPosition(0);
|
||||
|
||||
assert(sizeof(touchgfx::BinaryFontData) < MAX_BUFFER_SIZE);
|
||||
readData(buffer, sizeof(touchgfx::BinaryFontData));
|
||||
const struct touchgfx::BinaryFontData* binaryFontData = reinterpret_cast<const struct touchgfx::BinaryFontData*>(buffer);
|
||||
|
||||
const Font** flashFonts = TypedTextDatabase::getFonts();
|
||||
const GeneratedFont* flashFont = static_cast<const GeneratedFont*>(flashFonts[fontId]);
|
||||
*font = CachedFont(reinterpret_cast<const struct touchgfx::BinaryFontData*>(buffer), fontId, this, flashFont);
|
||||
|
||||
if (loadGsubOrContextTable && (binaryFontData->offsetToGSUB != 0))
|
||||
{
|
||||
setPosition(binaryFontData->offsetToGSUB);
|
||||
|
||||
const uint32_t sizeOfGSUB = (binaryFontData->offsetToArabicTable != 0 ? binaryFontData->offsetToArabicTable : binaryFontData->sizeOfFontData) - binaryFontData->offsetToGSUB;
|
||||
|
||||
if (top + sizeOfGSUB < gsubStart) // Room for this GSUB table
|
||||
{
|
||||
uint8_t* const gsubPosition = gsubStart - sizeOfGSUB;
|
||||
readData(gsubPosition, sizeOfGSUB);
|
||||
font->setGSUBTable(reinterpret_cast<uint16_t*>(gsubPosition));
|
||||
gsubStart -= sizeOfGSUB;
|
||||
|
||||
// Round down to 32bit address
|
||||
gsubStart = (uint8_t*)((uintptr_t)gsubStart & ~(uintptr_t)0x3);
|
||||
}
|
||||
else
|
||||
{
|
||||
font->setGSUBTable(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (loadGsubOrContextTable && (binaryFontData->offsetToArabicTable != 0))
|
||||
{
|
||||
setPosition(binaryFontData->offsetToArabicTable);
|
||||
|
||||
const uint32_t sizeTableData = binaryFontData->sizeOfFontData - binaryFontData->offsetToArabicTable;
|
||||
|
||||
if (top + sizeTableData + sizeof(FontContextualFormsTable) < gsubStart) // Room for the ContextualFormsTables
|
||||
{
|
||||
// Allocate FontContextualFormsTable first
|
||||
gsubStart -= sizeof(FontContextualFormsTable);
|
||||
// Round down to 32bit address
|
||||
gsubStart = (uint8_t*)((uintptr_t)gsubStart & ~(uintptr_t)0x3);
|
||||
|
||||
FontContextualFormsTable* table = (FontContextualFormsTable*)gsubStart;
|
||||
font->setContextualFormsTable(table);
|
||||
gsubStart -= sizeTableData;
|
||||
readData(gsubStart, sizeTableData);
|
||||
|
||||
// Set pointers in table
|
||||
const uint16_t* const base = (const uint16_t*)gsubStart;
|
||||
// First elements in binary font are offsets to arrays in 16bit words
|
||||
table->contextualForms4Long = (FontContextualFormsTable::arrayOf5UnicodesPtr)(base + base[0]);
|
||||
table->contextualForms3Long = (FontContextualFormsTable::arrayOf5UnicodesPtr)(base + base[1]);
|
||||
table->contextualForms2Long = (FontContextualFormsTable::arrayOf5UnicodesPtr)(base + base[2]);
|
||||
table->contextualForms0621_063a = (FontContextualFormsTable::arrayOf4UnicodesPtr)(base + base[3]);
|
||||
table->contextualForms0641_064a = (FontContextualFormsTable::arrayOf4UnicodesPtr)(base + base[4]);
|
||||
table->contextualForms06XX = (FontContextualFormsTable::arrayOf5UnicodesPtr)(base + base[5]);
|
||||
table->contextualForms4LongSize = base[6];
|
||||
table->contextualForms3LongSize = base[7];
|
||||
table->contextualForms2LongSize = base[8];
|
||||
table->contextualForms06XXSize = base[9];
|
||||
}
|
||||
else
|
||||
{
|
||||
font->setContextualFormsTable(0);
|
||||
}
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
bool FontCache::cacheString(TypedText t, const Unicode::UnicodeChar* string)
|
||||
{
|
||||
open();
|
||||
if (!createSortedString(string))
|
||||
{
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
const bool result = cacheSortedString(t);
|
||||
close();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool FontCache::cacheLigatures(CachedFont* font, TypedText t, const Unicode::UnicodeChar* string)
|
||||
{
|
||||
open();
|
||||
if (!createSortedLigatures(font, t, string, 0, 0))
|
||||
{
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
const bool result = cacheSortedString(t);
|
||||
close();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool FontCache::cacheSortedString(TypedText t)
|
||||
{
|
||||
setPosition(8); // Skip font index and size
|
||||
uint32_t glyphNodeOffset;
|
||||
uint32_t dummy;
|
||||
readData(&glyphNodeOffset, sizeof(uint32_t)); // offsetToTable
|
||||
readData(&dummy, sizeof(uint32_t)); // offsetToKerning
|
||||
readData(&glyphDataOffset, sizeof(uint32_t)); // offsetToGlyphs
|
||||
readData(&dummy, sizeof(uint32_t)); // offsetToGlyphs
|
||||
readData(&dummy, sizeof(uint32_t)); // offsetToArabicTable
|
||||
readData(&numGlyphs, sizeof(uint16_t)); // numberOfGlyphs
|
||||
|
||||
FontId fontId = t.getFontId(); // Get font index from typed text
|
||||
uint32_t bpp = t.getFont()->getBitsPerPixel(); // Get BPP from standard font
|
||||
|
||||
setPosition(glyphNodeOffset); // Go to glyph nodes for font
|
||||
currentFileGlyphNumber = 0;
|
||||
currentFileGlyphNode.unicode = 0; // Force reading of first glyph
|
||||
|
||||
const Unicode::UnicodeChar* string = sortedString;
|
||||
Unicode::UnicodeChar last = 0;
|
||||
GlyphNode* firstNewGlyph = 0;
|
||||
bool outOfMemory = false;
|
||||
while (*string)
|
||||
{
|
||||
Unicode::UnicodeChar ch = *string;
|
||||
if (ch != last)
|
||||
{
|
||||
if (!contains(ch, fontId))
|
||||
{
|
||||
insert(ch, fontId, bpp, outOfMemory);
|
||||
if (outOfMemory)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (firstNewGlyph == 0)
|
||||
{
|
||||
firstNewGlyph = (GlyphNode*)fontTable[fontId].last;
|
||||
}
|
||||
}
|
||||
}
|
||||
last = ch;
|
||||
string++;
|
||||
}
|
||||
|
||||
cacheData(bpp, firstNewGlyph);
|
||||
return !outOfMemory;
|
||||
}
|
||||
|
||||
bool FontCache::contains(Unicode::UnicodeChar unicode, FontId font) const
|
||||
{
|
||||
GlyphNode* g = (GlyphNode*)fontTable[font].first;
|
||||
while (g)
|
||||
{
|
||||
if (g->unicode == unicode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
GlyphNode** next = (GlyphNode**)((uint8_t*)g + SizeGlyphNode);
|
||||
g = *next;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void FontCache::insert(Unicode::UnicodeChar unicode, FontId font, uint32_t bpp, bool& outOfMemory)
|
||||
{
|
||||
// Insert new glyphnode and glyph after last for font.
|
||||
uint8_t* oldTop = top;
|
||||
top = copyGlyph(top, unicode, font, bpp, outOfMemory);
|
||||
|
||||
if (top == oldTop)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (fontTable[font].last == 0)
|
||||
{
|
||||
// First glyph
|
||||
fontTable[font].first = oldTop;
|
||||
fontTable[font].last = oldTop;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set next pointer of old last glyph
|
||||
uint8_t** old_next = (uint8_t**)(fontTable[font].last + SizeGlyphNode);
|
||||
*old_next = oldTop;
|
||||
|
||||
// Save new glyph as last glyph
|
||||
fontTable[font].last = oldTop;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t* FontCache::copyGlyph(uint8_t* top, Unicode::UnicodeChar unicode, FontId font, uint32_t bpp, bool& outOfMemory)
|
||||
{
|
||||
while (currentFileGlyphNumber < numGlyphs && currentFileGlyphNode.unicode < unicode)
|
||||
{
|
||||
readData(¤tFileGlyphNode, sizeof(GlyphNode));
|
||||
currentFileGlyphNumber++;
|
||||
}
|
||||
if (currentFileGlyphNode.unicode != unicode)
|
||||
{
|
||||
// GlyphNode not found
|
||||
return top;
|
||||
}
|
||||
|
||||
// GlyphNode found
|
||||
uint32_t glyphSize = ((currentFileGlyphNode.width() + 1) & ~1) * currentFileGlyphNode.height() * bpp / 8;
|
||||
glyphSize = (glyphSize + 3) & ~0x03;
|
||||
uint32_t requiredMem = SizeGlyphNode + 4 + glyphSize; // GlyphNode + next ptr + glyph
|
||||
|
||||
// Is space available before sortedString
|
||||
if (top + requiredMem > (uint8_t*)sortedString)
|
||||
{
|
||||
outOfMemory = true;
|
||||
return top;
|
||||
}
|
||||
|
||||
*(GlyphNode*)top = currentFileGlyphNode;
|
||||
|
||||
// Clear next pointer
|
||||
uint8_t** next = (uint8_t**)(top + SizeGlyphNode);
|
||||
*next = 0;
|
||||
top += requiredMem;
|
||||
return top;
|
||||
}
|
||||
|
||||
void FontCache::cacheData(uint32_t bpp, GlyphNode* first)
|
||||
{
|
||||
GlyphNode* gn = first;
|
||||
while (gn)
|
||||
{
|
||||
uint8_t* p = (uint8_t*)gn;
|
||||
if (gn->dataOffset != 0xFFFFFFFF)
|
||||
{
|
||||
p += SizeGlyphNode;
|
||||
// Next pointer
|
||||
p += 4;
|
||||
|
||||
// Seek and copy
|
||||
setPosition(glyphDataOffset + gn->dataOffset);
|
||||
uint32_t glyphSize = ((gn->width() + 1) & ~1) * gn->height() * bpp / 8;
|
||||
readData(p, glyphSize);
|
||||
|
||||
// Mark glyphNode as cached
|
||||
gn->dataOffset = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
GlyphNode** next = (GlyphNode**)((uint8_t*)gn + SizeGlyphNode);
|
||||
gn = *next;
|
||||
}
|
||||
}
|
||||
|
||||
bool FontCache::createSortedString(const Unicode::UnicodeChar* string)
|
||||
{
|
||||
int length = Unicode::strlen(string);
|
||||
// Sorted string is allocated at end of buffer
|
||||
sortedString = (Unicode::UnicodeChar*)(gsubStart - (length + 1) * 2);
|
||||
if ((uint8_t*)sortedString < top)
|
||||
{
|
||||
// Unable to allocate string buffer in end of memory
|
||||
return false;
|
||||
}
|
||||
int n = 0;
|
||||
Unicode::UnicodeChar* uc = sortedString;
|
||||
while (*string)
|
||||
{
|
||||
*uc++ = *string++;
|
||||
n++;
|
||||
}
|
||||
*uc = 0;
|
||||
return sortSortedString(n);
|
||||
}
|
||||
|
||||
bool FontCache::createSortedLigatures(CachedFont* font, TypedText t, const Unicode::UnicodeChar* string, ...)
|
||||
{
|
||||
va_list pArg;
|
||||
va_start(pArg, string);
|
||||
TextProvider tp;
|
||||
tp.initialize(string, pArg, font->getGSUBTable(), font->getContextualFormsTable());
|
||||
va_end(pArg);
|
||||
Unicode::UnicodeChar ligature;
|
||||
sortedString = (Unicode::UnicodeChar*)(gsubStart);
|
||||
if ((uint8_t*)(sortedString - 1) < top)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*--sortedString = 0;
|
||||
int n = 0;
|
||||
while ((ligature = tp.getNextLigature(t.getTextDirection())) != 0)
|
||||
{
|
||||
if ((uint8_t*)(sortedString - 1) < top)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*--sortedString = ligature;
|
||||
n++;
|
||||
}
|
||||
return sortSortedString(n);
|
||||
}
|
||||
|
||||
bool FontCache::sortSortedString(int n)
|
||||
{
|
||||
Unicode::UnicodeChar* uc = sortedString;
|
||||
for (int i = 0; i < n - 1; i++)
|
||||
{
|
||||
bool swapped = false;
|
||||
for (int j = 0; j < n - i - 1; j++)
|
||||
{
|
||||
if (uc[j] > uc[j + 1])
|
||||
{
|
||||
Unicode::UnicodeChar temp = uc[j];
|
||||
uc[j] = uc[j + 1];
|
||||
uc[j + 1] = temp;
|
||||
swapped = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If no two elements were swapped by inner loop, then break
|
||||
if (!swapped)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void FontCache::setPosition(uint32_t position)
|
||||
{
|
||||
if (reader)
|
||||
{
|
||||
reader->setPosition(position);
|
||||
}
|
||||
}
|
||||
|
||||
void FontCache::readData(void* out, uint32_t numberOfBytes)
|
||||
{
|
||||
if (reader)
|
||||
{
|
||||
reader->readData(out, numberOfBytes);
|
||||
}
|
||||
}
|
||||
} // namespace touchgfx
|
||||
8
TouchGFX/generated/fonts/src/Font_verdana_10_4bpp_0.cpp
Normal file
8
TouchGFX/generated/fonts/src/Font_verdana_10_4bpp_0.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include <touchgfx/hal/Types.hpp>
|
||||
|
||||
FONT_GLYPH_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const uint8_t unicodes_verdana_10_4bpp_0[] FONT_GLYPH_LOCATION_FLASH_ATTRIBUTE = {
|
||||
// Unicode: [0x003F]
|
||||
0xD2, 0xCE, 0x03, 0x21, 0x50, 0x0C, 0x00, 0x30, 0x0C, 0x00, 0xC1, 0x05, 0x00, 0x4D, 0x00, 0x00,
|
||||
0x0C, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0F, 0x00
|
||||
};
|
||||
57
TouchGFX/generated/fonts/src/Font_verdana_20_4bpp_0.cpp
Normal file
57
TouchGFX/generated/fonts/src/Font_verdana_20_4bpp_0.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
#include <touchgfx/hal/Types.hpp>
|
||||
|
||||
FONT_GLYPH_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const uint8_t unicodes_verdana_20_4bpp_0[] FONT_GLYPH_LOCATION_FLASH_ATTRIBUTE = {
|
||||
// Unicode: [0x003F]
|
||||
0x93, 0xEC, 0xDE, 0x29, 0x00, 0xF7, 0xAD, 0xDA, 0xEF, 0x02, 0x33, 0x00, 0x00, 0xF9, 0x0A, 0x00,
|
||||
0x00, 0x00, 0xF3, 0x0C, 0x00, 0x00, 0x00, 0xF5, 0x0A, 0x00, 0x00, 0x10, 0xFD, 0x03, 0x00, 0x00,
|
||||
0xD5, 0x6F, 0x00, 0x00, 0xB0, 0xCF, 0x03, 0x00, 0x00, 0xE0, 0x0C, 0x00, 0x00, 0x00, 0xE0, 0x0C,
|
||||
0x00, 0x00, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0E, 0x00,
|
||||
0x00, 0x00, 0xF0, 0x0E, 0x00, 0x00,
|
||||
// Unicode: [0x0042]
|
||||
0xF1, 0xFF, 0xFF, 0xDF, 0x3A, 0x00, 0xF1, 0x9E, 0x99, 0xDA, 0xFF, 0x03, 0xF1, 0x0D, 0x00, 0x00,
|
||||
0xF9, 0x09, 0xF1, 0x0D, 0x00, 0x00, 0xF6, 0x09, 0xF1, 0x0D, 0x00, 0x00, 0xFB, 0x03, 0xF1, 0x9E,
|
||||
0x99, 0xEA, 0x4E, 0x00, 0xF1, 0xFF, 0xFF, 0xFF, 0xEF, 0x05, 0xF1, 0x0D, 0x00, 0x10, 0xE5, 0x4F,
|
||||
0xF1, 0x0D, 0x00, 0x00, 0x40, 0xBF, 0xF1, 0x0D, 0x00, 0x00, 0x20, 0xDF, 0xF1, 0x0D, 0x00, 0x00,
|
||||
0x30, 0xCF, 0xF1, 0x0D, 0x00, 0x00, 0xC1, 0x7F, 0xF1, 0x9E, 0x99, 0xBA, 0xFF, 0x0A, 0xF1, 0xFF,
|
||||
0xFF, 0xEF, 0x5B, 0x00,
|
||||
// Unicode: [0x0046]
|
||||
0xF1, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0xF1, 0xAE, 0xAA, 0xAA, 0xAA, 0x02, 0xF1, 0x0D, 0x00, 0x00,
|
||||
0x00, 0x00, 0xF1, 0x0D, 0x00, 0x00, 0x00, 0x00, 0xF1, 0x0D, 0x00, 0x00, 0x00, 0x00, 0xF1, 0xAF,
|
||||
0xAA, 0xAA, 0x2A, 0x00, 0xF1, 0xFF, 0xFF, 0xFF, 0x3F, 0x00, 0xF1, 0x0D, 0x00, 0x00, 0x00, 0x00,
|
||||
0xF1, 0x0D, 0x00, 0x00, 0x00, 0x00, 0xF1, 0x0D, 0x00, 0x00, 0x00, 0x00, 0xF1, 0x0D, 0x00, 0x00,
|
||||
0x00, 0x00, 0xF1, 0x0D, 0x00, 0x00, 0x00, 0x00, 0xF1, 0x0D, 0x00, 0x00, 0x00, 0x00, 0xF1, 0x0D,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
// Unicode: [0x0053]
|
||||
0x00, 0xA4, 0xFD, 0xDF, 0x7B, 0x02, 0x80, 0xFF, 0xAC, 0xCA, 0xFF, 0x0E, 0xF4, 0x3E, 0x00, 0x00,
|
||||
0x61, 0x0C, 0xF9, 0x07, 0x00, 0x00, 0x00, 0x00, 0xF7, 0x09, 0x00, 0x00, 0x00, 0x00, 0xF3, 0x8F,
|
||||
0x03, 0x00, 0x00, 0x00, 0x50, 0xFE, 0xFF, 0xAD, 0x17, 0x00, 0x00, 0x50, 0xB8, 0xFE, 0xFF, 0x06,
|
||||
0x00, 0x00, 0x00, 0x20, 0xF7, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x90, 0x7F, 0x03, 0x00, 0x00, 0x00,
|
||||
0x90, 0x6F, 0xBA, 0x04, 0x00, 0x00, 0xE5, 0x2E, 0xFA, 0xEF, 0xAB, 0xDB, 0xEF, 0x05, 0x50, 0xC9,
|
||||
0xFE, 0xCE, 0x28, 0x00,
|
||||
// Unicode: [0x0054]
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0xAA, 0xAA, 0xEA, 0xBF, 0xAA, 0xAA, 0x03, 0x00, 0x00,
|
||||
0xC0, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x2F,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x2F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x2F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xC0, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0,
|
||||
0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x2F, 0x00,
|
||||
0x00, 0x00,
|
||||
// Unicode: [0x0055]
|
||||
0xF4, 0x0A, 0x00, 0x00, 0x00, 0xEF, 0xF4, 0x0A, 0x00, 0x00, 0x00, 0xEF, 0xF4, 0x0A, 0x00, 0x00,
|
||||
0x00, 0xEF, 0xF4, 0x0A, 0x00, 0x00, 0x00, 0xEF, 0xF4, 0x0A, 0x00, 0x00, 0x00, 0xEF, 0xF4, 0x0A,
|
||||
0x00, 0x00, 0x00, 0xEF, 0xF4, 0x0A, 0x00, 0x00, 0x00, 0xEF, 0xF4, 0x0A, 0x00, 0x00, 0x00, 0xEF,
|
||||
0xF4, 0x0A, 0x00, 0x00, 0x10, 0xDF, 0xF3, 0x0B, 0x00, 0x00, 0x20, 0xCF, 0xF0, 0x1F, 0x00, 0x00,
|
||||
0x70, 0x9F, 0x90, 0xAF, 0x01, 0x00, 0xE3, 0x4F, 0x10, 0xFC, 0xBE, 0xCA, 0xFF, 0x08, 0x00, 0x71,
|
||||
0xEC, 0xEF, 0x4B, 0x00,
|
||||
// Unicode: [0x0061]
|
||||
0x90, 0xEC, 0xEF, 0x7C, 0x00, 0xF0, 0xBD, 0xA9, 0xFE, 0x0A, 0x30, 0x00, 0x00, 0xD1, 0x2F, 0x00,
|
||||
0x00, 0x00, 0xA1, 0x4F, 0x20, 0xC8, 0xFE, 0xFF, 0x4F, 0xE3, 0xBF, 0x68, 0xA5, 0x4F, 0xFC, 0x05,
|
||||
0x00, 0x80, 0x4F, 0xEE, 0x00, 0x00, 0x80, 0x4F, 0xFD, 0x03, 0x00, 0xD5, 0x4F, 0xF6, 0xBF, 0xDB,
|
||||
0xEF, 0x4F, 0x50, 0xFC, 0xAE, 0x83, 0x4F,
|
||||
// Unicode: [0x0065]
|
||||
0x00, 0xB4, 0xFE, 0x9D, 0x02, 0x70, 0xDF, 0x89, 0xFA, 0x2E, 0xF3, 0x09, 0x00, 0x50, 0x9F, 0xFA,
|
||||
0x12, 0x11, 0x11, 0xDE, 0xFD, 0xFF, 0xFF, 0xFF, 0xEF, 0xEE, 0x44, 0x44, 0x44, 0x44, 0xFD, 0x01,
|
||||
0x00, 0x00, 0x00, 0xFA, 0x06, 0x00, 0x00, 0x00, 0xF4, 0x4E, 0x00, 0x00, 0x84, 0x70, 0xFF, 0x9C,
|
||||
0xDA, 0xBF, 0x00, 0xA4, 0xFD, 0xCE, 0x28
|
||||
};
|
||||
24
TouchGFX/generated/fonts/src/Font_verdana_40_4bpp_0.cpp
Normal file
24
TouchGFX/generated/fonts/src/Font_verdana_40_4bpp_0.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <touchgfx/hal/Types.hpp>
|
||||
|
||||
FONT_GLYPH_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const uint8_t unicodes_verdana_40_4bpp_0[] FONT_GLYPH_LOCATION_FLASH_ATTRIBUTE = {
|
||||
// Unicode: [0x003F]
|
||||
0x00, 0x10, 0x53, 0x77, 0x57, 0x02, 0x00, 0x00, 0x00, 0x83, 0xFC, 0xFF, 0xFF, 0xFF, 0xDF, 0x17,
|
||||
0x00, 0x00, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0x02, 0x00, 0xFD, 0xFF, 0xFF, 0xEF, 0xFF,
|
||||
0xFF, 0xFF, 0x2E, 0x00, 0xFD, 0x9E, 0x15, 0x00, 0x41, 0xFA, 0xFF, 0xBF, 0x00, 0x6B, 0x00, 0x00,
|
||||
0x00, 0x00, 0x60, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFB, 0xFF, 0x07, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xF7, 0xFF, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF6, 0xFF,
|
||||
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFB, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xFF, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xC1, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xFC, 0xFF, 0x0C, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xD3, 0xFF, 0xDF, 0x02, 0x00, 0x00, 0x00, 0x00, 0x81, 0xFF, 0xFF, 0x2C, 0x00, 0x00,
|
||||
0x00, 0x00, 0x60, 0xFE, 0xFF, 0x9F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xFF, 0xDF, 0x04, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xD0, 0xFF, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xFF, 0x09,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xFF, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0,
|
||||
0xFF, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xFF, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x03, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xF1, 0xFF, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF1, 0xFF,
|
||||
0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF1, 0xFF, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xF1, 0xFF, 0x0E, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
44
TouchGFX/generated/fonts/src/GeneratedFont.cpp
Normal file
44
TouchGFX/generated/fonts/src/GeneratedFont.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#include <fonts/GeneratedFont.hpp>
|
||||
|
||||
namespace touchgfx
|
||||
{
|
||||
GeneratedFont::GeneratedFont(const GlyphNode* glyphs, uint16_t numGlyphs, uint16_t height, uint16_t baseline, uint8_t pixAboveTop, uint8_t pixBelowBottom, uint8_t bitsPerPixel, uint8_t byteAlignRow, uint8_t maxLeft, uint8_t maxRight, const uint8_t* const* glyphDataInternalFlash, const KerningNode* kerningList, const Unicode::UnicodeChar fallbackChar, const Unicode::UnicodeChar ellipsisChar, const uint16_t* const gsubData, const FontContextualFormsTable* formsTable)
|
||||
: ConstFont(glyphs, numGlyphs, height, baseline, pixAboveTop, pixBelowBottom, bitsPerPixel, byteAlignRow, maxLeft, maxRight, fallbackChar, ellipsisChar),
|
||||
glyphData(glyphDataInternalFlash),
|
||||
kerningData(kerningList),
|
||||
gsubTable(gsubData),
|
||||
arabicTable(formsTable)
|
||||
{
|
||||
}
|
||||
|
||||
const uint8_t* GeneratedFont::getPixelData(const GlyphNode* glyph) const
|
||||
{
|
||||
const uint8_t* const* table = (const uint8_t* const*)glyphData;
|
||||
return &(table[glyph->unicode / 2048][glyph->dataOffset]);
|
||||
}
|
||||
|
||||
int8_t GeneratedFont::getKerning(Unicode::UnicodeChar prevChar, const GlyphNode* glyph) const
|
||||
{
|
||||
if (!glyph || glyph->kerningTableSize == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const KerningNode* kerndata = kerningData + glyph->kerningTablePos();
|
||||
for (uint16_t i = glyph->kerningTableSize; i > 0; i--, kerndata++)
|
||||
{
|
||||
if (prevChar == kerndata->unicodePrevChar)
|
||||
{
|
||||
return kerndata->distance;
|
||||
}
|
||||
if (prevChar < kerndata->unicodePrevChar)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace touchgfx
|
||||
6
TouchGFX/generated/fonts/src/Kerning_verdana_10_4bpp.cpp
Normal file
6
TouchGFX/generated/fonts/src/Kerning_verdana_10_4bpp.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include <touchgfx/Font.hpp>
|
||||
|
||||
FONT_KERNING_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::KerningNode kerning_verdana_10_4bpp[] FONT_KERNING_LOCATION_FLASH_ATTRIBUTE = {
|
||||
{ 0, 0 }
|
||||
};
|
||||
10
TouchGFX/generated/fonts/src/Kerning_verdana_20_4bpp.cpp
Normal file
10
TouchGFX/generated/fonts/src/Kerning_verdana_20_4bpp.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include <touchgfx/Font.hpp>
|
||||
|
||||
FONT_KERNING_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::KerningNode kerning_verdana_20_4bpp[] FONT_KERNING_LOCATION_FLASH_ATTRIBUTE = {
|
||||
{ 0x0054, -1 }, // (First char = [0x0054, T], Second char = [0x0054, T], Kerning dist = -1)
|
||||
{ 0x0065, -1 }, // (First char = [0x0065, e], Second char = [0x0054, T], Kerning dist = -1)
|
||||
{ 0x0046, -1 }, // (First char = [0x0046, F], Second char = [0x0061, a], Kerning dist = -1)
|
||||
{ 0x0054, -2 }, // (First char = [0x0054, T], Second char = [0x0061, a], Kerning dist = -2)
|
||||
{ 0x0054, -2 }, // (First char = [0x0054, T], Second char = [0x0065, e], Kerning dist = -2)
|
||||
};
|
||||
6
TouchGFX/generated/fonts/src/Kerning_verdana_40_4bpp.cpp
Normal file
6
TouchGFX/generated/fonts/src/Kerning_verdana_40_4bpp.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include <touchgfx/Font.hpp>
|
||||
|
||||
FONT_KERNING_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::KerningNode kerning_verdana_40_4bpp[] FONT_KERNING_LOCATION_FLASH_ATTRIBUTE = {
|
||||
{ 0, 0 }
|
||||
};
|
||||
27
TouchGFX/generated/fonts/src/Table_verdana_10_4bpp.cpp
Normal file
27
TouchGFX/generated/fonts/src/Table_verdana_10_4bpp.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
// Autogenerated, do not edit
|
||||
|
||||
#include <fonts/GeneratedFont.hpp>
|
||||
|
||||
FONT_TABLE_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::GlyphNode glyphs_verdana_10_4bpp[] FONT_TABLE_LOCATION_FLASH_ATTRIBUTE = {
|
||||
{ 0, 0x003F, 5, 8, 8, 0, 5, 0, 0, 0x00 }
|
||||
};
|
||||
|
||||
// verdana_10_4bpp
|
||||
FONT_TABLE_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::GlyphNode glyphs_verdana_10_4bpp[] FONT_TABLE_LOCATION_FLASH_ATTRIBUTE;
|
||||
FONT_GLYPH_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const uint8_t unicodes_verdana_10_4bpp_0[] FONT_GLYPH_LOCATION_FLASH_ATTRIBUTE;
|
||||
FONT_SEARCHTABLE_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const uint8_t* const unicodes_verdana_10_4bpp[] FONT_SEARCHTABLE_LOCATION_FLASH_ATTRIBUTE = {
|
||||
unicodes_verdana_10_4bpp_0
|
||||
};
|
||||
FONT_KERNING_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::KerningNode kerning_verdana_10_4bpp[] FONT_KERNING_LOCATION_FLASH_ATTRIBUTE;
|
||||
touchgfx::GeneratedFont& getFont_verdana_10_4bpp();
|
||||
|
||||
touchgfx::GeneratedFont& getFont_verdana_10_4bpp()
|
||||
{
|
||||
static touchgfx::GeneratedFont verdana_10_4bpp(glyphs_verdana_10_4bpp, 1, 10, 10, 0, 0, 4, 1, 0, 0, unicodes_verdana_10_4bpp, kerning_verdana_10_4bpp, 63, 0, 0, 0);
|
||||
return verdana_10_4bpp;
|
||||
}
|
||||
34
TouchGFX/generated/fonts/src/Table_verdana_20_4bpp.cpp
Normal file
34
TouchGFX/generated/fonts/src/Table_verdana_20_4bpp.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
// Autogenerated, do not edit
|
||||
|
||||
#include <fonts/GeneratedFont.hpp>
|
||||
|
||||
FONT_TABLE_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::GlyphNode glyphs_verdana_20_4bpp[] FONT_TABLE_LOCATION_FLASH_ATTRIBUTE = {
|
||||
{ 0, 0x003F, 9, 14, 14, 1, 11, 0, 0, 0x00 },
|
||||
{ 70, 0x0042, 12, 14, 14, 1, 14, 0, 0, 0x00 },
|
||||
{ 154, 0x0046, 11, 14, 14, 1, 12, 0, 0, 0x00 },
|
||||
{ 238, 0x0053, 12, 14, 14, 1, 14, 0, 0, 0x00 },
|
||||
{ 322, 0x0054, 13, 14, 14, 0, 12, 0, 2, 0x00 },
|
||||
{ 420, 0x0055, 12, 14, 14, 1, 15, 0, 0, 0x00 },
|
||||
{ 504, 0x0061, 10, 11, 11, 1, 12, 2, 2, 0x00 },
|
||||
{ 559, 0x0065, 10, 11, 11, 1, 12, 4, 1, 0x00 }
|
||||
};
|
||||
|
||||
// verdana_20_4bpp
|
||||
FONT_TABLE_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::GlyphNode glyphs_verdana_20_4bpp[] FONT_TABLE_LOCATION_FLASH_ATTRIBUTE;
|
||||
FONT_GLYPH_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const uint8_t unicodes_verdana_20_4bpp_0[] FONT_GLYPH_LOCATION_FLASH_ATTRIBUTE;
|
||||
FONT_SEARCHTABLE_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const uint8_t* const unicodes_verdana_20_4bpp[] FONT_SEARCHTABLE_LOCATION_FLASH_ATTRIBUTE = {
|
||||
unicodes_verdana_20_4bpp_0
|
||||
};
|
||||
FONT_KERNING_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::KerningNode kerning_verdana_20_4bpp[] FONT_KERNING_LOCATION_FLASH_ATTRIBUTE;
|
||||
touchgfx::GeneratedFont& getFont_verdana_20_4bpp();
|
||||
|
||||
touchgfx::GeneratedFont& getFont_verdana_20_4bpp()
|
||||
{
|
||||
static touchgfx::GeneratedFont verdana_20_4bpp(glyphs_verdana_20_4bpp, 8, 20, 20, 0, 0, 4, 1, 0, 1, unicodes_verdana_20_4bpp, kerning_verdana_20_4bpp, 63, 0, 0, 0);
|
||||
return verdana_20_4bpp;
|
||||
}
|
||||
27
TouchGFX/generated/fonts/src/Table_verdana_40_4bpp.cpp
Normal file
27
TouchGFX/generated/fonts/src/Table_verdana_40_4bpp.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
// Autogenerated, do not edit
|
||||
|
||||
#include <fonts/GeneratedFont.hpp>
|
||||
|
||||
FONT_TABLE_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::GlyphNode glyphs_verdana_40_4bpp[] FONT_TABLE_LOCATION_FLASH_ATTRIBUTE = {
|
||||
{ 0, 0x003F, 17, 31, 31, 3, 22, 0, 0, 0x00 }
|
||||
};
|
||||
|
||||
// verdana_40_4bpp
|
||||
FONT_TABLE_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::GlyphNode glyphs_verdana_40_4bpp[] FONT_TABLE_LOCATION_FLASH_ATTRIBUTE;
|
||||
FONT_GLYPH_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const uint8_t unicodes_verdana_40_4bpp_0[] FONT_GLYPH_LOCATION_FLASH_ATTRIBUTE;
|
||||
FONT_SEARCHTABLE_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const uint8_t* const unicodes_verdana_40_4bpp[] FONT_SEARCHTABLE_LOCATION_FLASH_ATTRIBUTE = {
|
||||
unicodes_verdana_40_4bpp_0
|
||||
};
|
||||
FONT_KERNING_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::KerningNode kerning_verdana_40_4bpp[] FONT_KERNING_LOCATION_FLASH_ATTRIBUTE;
|
||||
touchgfx::GeneratedFont& getFont_verdana_40_4bpp();
|
||||
|
||||
touchgfx::GeneratedFont& getFont_verdana_40_4bpp()
|
||||
{
|
||||
static touchgfx::GeneratedFont verdana_40_4bpp(glyphs_verdana_40_4bpp, 1, 40, 40, 0, 0, 4, 1, 0, 0, unicodes_verdana_40_4bpp, kerning_verdana_40_4bpp, 63, 0, 0, 0);
|
||||
return verdana_40_4bpp;
|
||||
}
|
||||
152
TouchGFX/generated/fonts/src/UnmappedDataFont.cpp
Normal file
152
TouchGFX/generated/fonts/src/UnmappedDataFont.cpp
Normal file
@ -0,0 +1,152 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#include <touchgfx/hal/FlashDataReader.hpp>
|
||||
#include <fonts/ApplicationFontProvider.hpp>
|
||||
#include <fonts/UnmappedDataFont.hpp>
|
||||
|
||||
namespace touchgfx
|
||||
{
|
||||
GlyphNode UnmappedDataFont::glyphNodeBuffer;
|
||||
|
||||
UnmappedDataFont::UnmappedDataFont(const GlyphNode* glyphs, const uint16_t* unicodeList, uint16_t numGlyphs, uint16_t height, uint16_t baseline, uint8_t pixAboveTop, uint8_t pixBelowBottom, uint8_t bitsPerPixel, uint8_t byteAlignRow, uint8_t maxLeft, uint8_t maxRight, const uint8_t* const* glyphDataList, const KerningNode* kerningList, const Unicode::UnicodeChar fallbackChar, const Unicode::UnicodeChar ellipsisChar, const uint16_t* const gsubData, const FontContextualFormsTable* formsTable)
|
||||
: Font(height, baseline, pixAboveTop, pixBelowBottom, bitsPerPixel, byteAlignRow, maxLeft, maxRight, fallbackChar, ellipsisChar),
|
||||
glyphList(glyphs),
|
||||
listSize(numGlyphs),
|
||||
unicodes(unicodeList),
|
||||
glyphDataList(glyphDataList),
|
||||
kerningData(kerningList),
|
||||
gsubTable(gsubData),
|
||||
arabicTable(formsTable)
|
||||
{
|
||||
}
|
||||
|
||||
const GlyphNode* UnmappedDataFont::getGlyph(Unicode::UnicodeChar unicode, const uint8_t*& pixelData, uint8_t& bitsPerPixel) const
|
||||
{
|
||||
int index = lookupUnicode(unicode);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
// Read glyphNode from unmapped flash
|
||||
touchgfx::FlashDataReader* const flashReader = ApplicationFontProvider::getFlashReader();
|
||||
if (flashReader)
|
||||
{
|
||||
flashReader->copyData(glyphList + index, &glyphNodeBuffer, sizeof(GlyphNode));
|
||||
|
||||
pixelData = getPixelData(const_cast<const GlyphNode*>(&glyphNodeBuffer));
|
||||
bitsPerPixel = getBitsPerPixel();
|
||||
return &glyphNodeBuffer;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const uint8_t* UnmappedDataFont::getPixelData(const GlyphNode* glyph) const
|
||||
{
|
||||
const uint8_t* const* table = (const uint8_t* const*)glyphDataList;
|
||||
return &(table[glyph->unicode / 2048][glyph->dataOffset]);
|
||||
}
|
||||
|
||||
int8_t UnmappedDataFont::getKerning(Unicode::UnicodeChar prevChar, const GlyphNode* glyph) const
|
||||
{
|
||||
if (!glyph || glyph->kerningTableSize == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const KerningNode* kerndata = kerningData + glyph->kerningTablePos();
|
||||
for (uint16_t i = glyph->kerningTableSize; i > 0; i--, kerndata++)
|
||||
{
|
||||
if (prevChar == kerndata->unicodePrevChar)
|
||||
{
|
||||
return kerndata->distance;
|
||||
}
|
||||
if (prevChar < kerndata->unicodePrevChar)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int UnmappedDataFont::lookupUnicode(uint16_t unicode) const
|
||||
{
|
||||
int32_t min = 0;
|
||||
int32_t max = listSize - 1;
|
||||
|
||||
int32_t mid = min + (unicode - unicodes[min]); // Linear up from [min].unicode
|
||||
if (mid < min)
|
||||
{
|
||||
// Unicode < unicodes[min] => not found
|
||||
return -1;
|
||||
}
|
||||
if (mid > max)
|
||||
{
|
||||
// Linear up ends too high
|
||||
mid = max - (unicodes[max] - unicode); // Linear down from [max].unicode
|
||||
if (mid > max)
|
||||
{
|
||||
// Unicode > unicodes[max] => not found
|
||||
return -1;
|
||||
}
|
||||
if (mid < min)
|
||||
{
|
||||
// Linear down ends too low, take the middle element
|
||||
mid = (min + max) / 2;
|
||||
}
|
||||
}
|
||||
while (min <= max)
|
||||
{
|
||||
if (unicode == unicodes[mid])
|
||||
{
|
||||
// Found at [mid]
|
||||
return mid;
|
||||
}
|
||||
if (unicode < unicodes[mid])
|
||||
{
|
||||
// Unicode is in lower half
|
||||
max = mid - 1;
|
||||
if (max < min)
|
||||
{
|
||||
// Range is empty => not found
|
||||
break;
|
||||
}
|
||||
// We adjusted max, try linear down from [max].unicode
|
||||
mid = max - (unicodes[max] - unicode);
|
||||
if (mid > max)
|
||||
{
|
||||
// Unicode > [max].unicode => not found
|
||||
break;
|
||||
}
|
||||
if (mid < min)
|
||||
{
|
||||
// Linear down ends too low, take the middle element
|
||||
mid = (min + max) / 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unicode is in upper half
|
||||
min = mid + 1;
|
||||
if (min > max)
|
||||
{
|
||||
// Range is empty => not found
|
||||
break;
|
||||
}
|
||||
// We adjusted min, try linear up from [min].unicode
|
||||
mid = min + (unicode - unicodes[min]);
|
||||
if (mid < min)
|
||||
{
|
||||
// Unicode < [min].unicode => not found
|
||||
break;
|
||||
}
|
||||
if (mid > max)
|
||||
{
|
||||
// Linear up ends too high, take the middle element
|
||||
mid = (min + max) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
} // namespace touchgfx
|
||||
@ -0,0 +1,35 @@
|
||||
/*********************************************************************************/
|
||||
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||||
/*********************************************************************************/
|
||||
#ifndef FRONTENDAPPLICATIONBASE_HPP
|
||||
#define FRONTENDAPPLICATIONBASE_HPP
|
||||
|
||||
#include <mvp/MVPApplication.hpp>
|
||||
#include <gui/model/Model.hpp>
|
||||
|
||||
class FrontendHeap;
|
||||
|
||||
class FrontendApplicationBase : public touchgfx::MVPApplication
|
||||
{
|
||||
public:
|
||||
FrontendApplicationBase(Model& m, FrontendHeap& heap);
|
||||
virtual ~FrontendApplicationBase() { }
|
||||
|
||||
virtual void changeToStartScreen()
|
||||
{
|
||||
gotoscreenScreenNoTransition();
|
||||
}
|
||||
|
||||
// screen
|
||||
void gotoscreenScreenNoTransition();
|
||||
|
||||
protected:
|
||||
touchgfx::Callback<FrontendApplicationBase> transitionCallback;
|
||||
FrontendHeap& frontendHeap;
|
||||
Model& model;
|
||||
|
||||
// screen
|
||||
void gotoscreenScreenNoTransitionImpl();
|
||||
};
|
||||
|
||||
#endif // FRONTENDAPPLICATIONBASE_HPP
|
||||
@ -0,0 +1,87 @@
|
||||
/*********************************************************************************/
|
||||
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||||
/*********************************************************************************/
|
||||
#ifndef FRONTENDHEAPBASE_HPP
|
||||
#define FRONTENDHEAPBASE_HPP
|
||||
|
||||
#include <common/Meta.hpp>
|
||||
#include <common/Partition.hpp>
|
||||
#include <mvp/MVPHeap.hpp>
|
||||
|
||||
#include <touchgfx/transitions/NoTransition.hpp>
|
||||
#include <gui/common/FrontendApplication.hpp>
|
||||
#include <gui/model/Model.hpp>
|
||||
|
||||
#include <gui/screen_screen/screenView.hpp>
|
||||
#include <gui/screen_screen/screenPresenter.hpp>
|
||||
|
||||
|
||||
/**
|
||||
* This class provides the memory that shall be used for memory allocations
|
||||
* in the frontend. A single instance of the FrontendHeap is allocated once (in heap
|
||||
* memory), and all other frontend objects such as views, presenters and data model are
|
||||
* allocated within the scope of this FrontendHeap. As such, the RAM usage of the entire
|
||||
* user interface is sizeof(FrontendHeap).
|
||||
*
|
||||
* @note The FrontendHeap reserves memory for the most memory-consuming presenter and
|
||||
* view only. The largest of these classes are determined at compile-time using template
|
||||
* magic. As such, it is important to add all presenters, views and transitions to the
|
||||
* type lists in this class.
|
||||
*
|
||||
*/
|
||||
class FrontendHeapBase : public touchgfx::MVPHeap
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* A list of all view types. Must end with meta::Nil.
|
||||
* @note All view types used in the application MUST be added to this list!
|
||||
*/
|
||||
typedef touchgfx::meta::TypeList< screenView,
|
||||
touchgfx::meta::Nil
|
||||
> GeneratedViewTypes;
|
||||
|
||||
/**
|
||||
* Determine (compile time) the View type of largest size.
|
||||
*/
|
||||
typedef touchgfx::meta::select_type_maxsize< GeneratedViewTypes >::type MaxGeneratedViewType;
|
||||
|
||||
/**
|
||||
* A list of all presenter types. Must end with meta::Nil.
|
||||
* @note All presenter types used in the application MUST be added to this list!
|
||||
*/
|
||||
typedef touchgfx::meta::TypeList< screenPresenter,
|
||||
touchgfx::meta::Nil
|
||||
> GeneratedPresenterTypes;
|
||||
|
||||
/**
|
||||
* Determine (compile time) the Presenter type of largest size.
|
||||
*/
|
||||
typedef touchgfx::meta::select_type_maxsize< GeneratedPresenterTypes >::type MaxGeneratedPresenterType;
|
||||
|
||||
/**
|
||||
* A list of all transition types. Must end with meta::Nil.
|
||||
* @note All transition types used in the application MUST be added to this list!
|
||||
*/
|
||||
typedef touchgfx::meta::TypeList< touchgfx::NoTransition,
|
||||
touchgfx::meta::Nil
|
||||
> GeneratedTransitionTypes;
|
||||
|
||||
/**
|
||||
* Determine (compile time) the Transition type of largest size.
|
||||
*/
|
||||
typedef touchgfx::meta::select_type_maxsize< GeneratedTransitionTypes >::type MaxGeneratedTransitionType;
|
||||
|
||||
virtual void gotoStartScreen(FrontendApplication& app)
|
||||
{
|
||||
app.gotoscreenScreenNoTransition();
|
||||
}
|
||||
protected:
|
||||
FrontendHeapBase(touchgfx::AbstractPartition& presenters, touchgfx::AbstractPartition& views, touchgfx::AbstractPartition& transitions, FrontendApplication& app)
|
||||
: MVPHeap(presenters, views, transitions, app)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // FRONTENDHEAPBASE_HPP
|
||||
@ -0,0 +1,11 @@
|
||||
/*********************************************************************************/
|
||||
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||||
/*********************************************************************************/
|
||||
#ifndef SIMCONSTANTS_HPP
|
||||
#define SIMCONSTANTS_HPP
|
||||
|
||||
static unsigned short SIM_WIDTH = 320;
|
||||
static unsigned short SIM_HEIGHT = 480;
|
||||
#define SIM_TITLE "MyApplication"
|
||||
|
||||
#endif // SIMCONSTANTS_HPP
|
||||
@ -0,0 +1,45 @@
|
||||
/*********************************************************************************/
|
||||
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||||
/*********************************************************************************/
|
||||
#ifndef SCREENVIEWBASE_HPP
|
||||
#define SCREENVIEWBASE_HPP
|
||||
|
||||
#include <gui/common/FrontendApplication.hpp>
|
||||
#include <mvp/View.hpp>
|
||||
#include <gui/screen_screen/screenPresenter.hpp>
|
||||
#include <touchgfx/widgets/Box.hpp>
|
||||
#include <touchgfx/widgets/TextArea.hpp>
|
||||
#include <touchgfx/widgets/canvas/Circle.hpp>
|
||||
#include <touchgfx/widgets/canvas/PainterRGB565.hpp>
|
||||
|
||||
class screenViewBase : public touchgfx::View<screenPresenter>
|
||||
{
|
||||
public:
|
||||
screenViewBase();
|
||||
virtual ~screenViewBase();
|
||||
virtual void setupScreen();
|
||||
|
||||
protected:
|
||||
FrontendApplication& application() {
|
||||
return *static_cast<FrontendApplication*>(touchgfx::Application::getInstance());
|
||||
}
|
||||
|
||||
/*
|
||||
* Member Declarations
|
||||
*/
|
||||
touchgfx::Box __background;
|
||||
touchgfx::TextArea textArea1;
|
||||
touchgfx::Circle circle1;
|
||||
touchgfx::PainterRGB565 circle1Painter;
|
||||
|
||||
private:
|
||||
|
||||
/*
|
||||
* Canvas Buffer Size
|
||||
*/
|
||||
static const uint32_t CANVAS_BUFFER_SIZE = 7200;
|
||||
uint8_t canvasBuffer[CANVAS_BUFFER_SIZE];
|
||||
|
||||
};
|
||||
|
||||
#endif // SCREENVIEWBASE_HPP
|
||||
@ -0,0 +1,43 @@
|
||||
/*********************************************************************************/
|
||||
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||||
/*********************************************************************************/
|
||||
#include <new>
|
||||
#include <gui_generated/common/FrontendApplicationBase.hpp>
|
||||
#include <gui/common/FrontendHeap.hpp>
|
||||
#include <touchgfx/transitions/NoTransition.hpp>
|
||||
#include <texts/TextKeysAndLanguages.hpp>
|
||||
#include <touchgfx/Texts.hpp>
|
||||
#include <touchgfx/hal/HAL.hpp>
|
||||
#include <platform/driver/lcd/LCD16bpp.hpp>
|
||||
#include <gui/screen_screen/screenView.hpp>
|
||||
#include <gui/screen_screen/screenPresenter.hpp>
|
||||
|
||||
using namespace touchgfx;
|
||||
|
||||
FrontendApplicationBase::FrontendApplicationBase(Model& m, FrontendHeap& heap)
|
||||
: touchgfx::MVPApplication(),
|
||||
transitionCallback(),
|
||||
frontendHeap(heap),
|
||||
model(m)
|
||||
{
|
||||
touchgfx::HAL::getInstance()->setDisplayOrientation(touchgfx::ORIENTATION_LANDSCAPE);
|
||||
touchgfx::Texts::setLanguage(GB);
|
||||
reinterpret_cast<touchgfx::LCD16bpp&>(touchgfx::HAL::lcd()).enableTextureMapperAll();
|
||||
}
|
||||
|
||||
/*
|
||||
* Screen Transition Declarations
|
||||
*/
|
||||
|
||||
// screen
|
||||
|
||||
void FrontendApplicationBase::gotoscreenScreenNoTransition()
|
||||
{
|
||||
transitionCallback = touchgfx::Callback<FrontendApplicationBase>(this, &FrontendApplication::gotoscreenScreenNoTransitionImpl);
|
||||
pendingScreenTransitionCallback = &transitionCallback;
|
||||
}
|
||||
|
||||
void FrontendApplicationBase::gotoscreenScreenNoTransitionImpl()
|
||||
{
|
||||
touchgfx::makeTransition<screenView, screenPresenter, touchgfx::NoTransition, Model >(¤tScreen, ¤tPresenter, frontendHeap, ¤tTransition, &model);
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
/*********************************************************************************/
|
||||
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||||
/*********************************************************************************/
|
||||
#include <gui_generated/screen_screen/screenViewBase.hpp>
|
||||
#include <touchgfx/canvas_widget_renderer/CanvasWidgetRenderer.hpp>
|
||||
#include <touchgfx/Color.hpp>
|
||||
#include <texts/TextKeysAndLanguages.hpp>
|
||||
|
||||
screenViewBase::screenViewBase()
|
||||
{
|
||||
touchgfx::CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);
|
||||
|
||||
__background.setPosition(0, 0, 480, 320);
|
||||
__background.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
|
||||
add(__background);
|
||||
|
||||
textArea1.setXY(190, 29);
|
||||
textArea1.setColor(touchgfx::Color::getColorFromRGB(255, 0, 0));
|
||||
textArea1.setLinespacing(0);
|
||||
textArea1.setTypedText(touchgfx::TypedText(T___SINGLEUSE_6GPV));
|
||||
add(textArea1);
|
||||
|
||||
circle1.setPosition(97, 120, 80, 80);
|
||||
circle1.setCenter(40, 40);
|
||||
circle1.setRadius(40);
|
||||
circle1.setLineWidth(0);
|
||||
circle1.setArc(0, 360);
|
||||
circle1Painter.setColor(touchgfx::Color::getColorFromRGB(3, 255, 226));
|
||||
circle1.setPainter(circle1Painter);
|
||||
add(circle1);
|
||||
}
|
||||
|
||||
screenViewBase::~screenViewBase()
|
||||
{
|
||||
touchgfx::CanvasWidgetRenderer::resetBuffer();
|
||||
}
|
||||
|
||||
void screenViewBase::setupScreen()
|
||||
{
|
||||
|
||||
}
|
||||
1
TouchGFX/generated/images/include/BitmapDatabase.hpp
Normal file
1
TouchGFX/generated/images/include/BitmapDatabase.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include <images/BitmapDatabase.hpp>
|
||||
16
TouchGFX/generated/images/include/images/BitmapDatabase.hpp
Normal file
16
TouchGFX/generated/images/include/images/BitmapDatabase.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
// Generated by imageconverter. Please, do not edit!
|
||||
|
||||
#ifndef TOUCHGFX_BITMAPDATABASE_HPP
|
||||
#define TOUCHGFX_BITMAPDATABASE_HPP
|
||||
|
||||
#include <touchgfx/hal/Types.hpp>
|
||||
#include <touchgfx/Bitmap.hpp>
|
||||
|
||||
|
||||
namespace BitmapDatabase
|
||||
{
|
||||
const touchgfx::Bitmap::BitmapData* getInstance();
|
||||
uint16_t getInstanceSize();
|
||||
} // namespace BitmapDatabase
|
||||
|
||||
#endif // TOUCHGFX_BITMAPDATABASE_HPP
|
||||
20
TouchGFX/generated/images/include/images/SVGDatabase.hpp
Normal file
20
TouchGFX/generated/images/include/images/SVGDatabase.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
// Generated by imageconverter. Please, do not edit!
|
||||
|
||||
#ifndef TOUCHGFX_SVGDATABASE_HPP
|
||||
#define TOUCHGFX_SVGDATABASE_HPP
|
||||
|
||||
#include <touchgfx/hal/Types.hpp>
|
||||
#include <touchgfx/hal/VGData.hpp>
|
||||
|
||||
enum SVGImages
|
||||
{
|
||||
NUMBER_OF_SVG_IMAGES = 0
|
||||
};
|
||||
|
||||
namespace SVGDatabase
|
||||
{
|
||||
const touchgfx::VGObject* getInstance();
|
||||
uint16_t getInstanceSize();
|
||||
} // namespace SVGDatabase
|
||||
|
||||
#endif // TOUCHGFX_SVGDATABASE_HPP
|
||||
23
TouchGFX/generated/images/src/BitmapDatabase.cpp
Normal file
23
TouchGFX/generated/images/src/BitmapDatabase.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
// 4.21.2 0x00000000
|
||||
// Generated by imageconverter. Please, do not edit!
|
||||
|
||||
#include <images/BitmapDatabase.hpp>
|
||||
#include <touchgfx/Bitmap.hpp>
|
||||
|
||||
|
||||
const touchgfx::Bitmap::BitmapData bitmap_database[] = {
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
namespace BitmapDatabase
|
||||
{
|
||||
const touchgfx::Bitmap::BitmapData* getInstance()
|
||||
{
|
||||
return bitmap_database;
|
||||
}
|
||||
|
||||
uint16_t getInstanceSize()
|
||||
{
|
||||
return (uint16_t)(sizeof(bitmap_database) / sizeof(touchgfx::Bitmap::BitmapData));
|
||||
}
|
||||
} // namespace BitmapDatabase
|
||||
19
TouchGFX/generated/images/src/SVGDatabase.cpp
Normal file
19
TouchGFX/generated/images/src/SVGDatabase.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
// Generated by imageconverter. Please, do not edit!
|
||||
|
||||
#include <images/SVGDatabase.hpp>
|
||||
|
||||
using namespace touchgfx;
|
||||
|
||||
|
||||
namespace SVGDatabase
|
||||
{
|
||||
const touchgfx::VGObject* getInstance()
|
||||
{
|
||||
return (const touchgfx::VGObject*)0;
|
||||
}
|
||||
|
||||
uint16_t getInstanceSize()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
} // namespace SVGDatabase
|
||||
242
TouchGFX/generated/simulator/gcc/Makefile
Normal file
242
TouchGFX/generated/simulator/gcc/Makefile
Normal file
@ -0,0 +1,242 @@
|
||||
# Get identification of this system
|
||||
ifeq ($(OS),Windows_NT)
|
||||
UNAME := MINGW32_NT-6.2
|
||||
else
|
||||
UNAME := $(shell uname -s)
|
||||
endif
|
||||
|
||||
board_name := $(UNAME)
|
||||
|
||||
.PHONY: all clean assets
|
||||
|
||||
# Directories containing application-specific source and header files.
|
||||
# Additional components can be added to this list. make will look for
|
||||
# source files recursively in comp_name/src and setup an include directive
|
||||
# for comp_name/include.
|
||||
components := gui simulator generated/gui_generated generated/simulator
|
||||
|
||||
# Location of folder containing bmp/png files.
|
||||
asset_images_input := assets/images
|
||||
|
||||
# Location of folder to search for ttf font files
|
||||
asset_fonts_input := assets/fonts
|
||||
|
||||
# Location of folder where the texts.xml is placed
|
||||
asset_texts_input := assets/texts
|
||||
|
||||
# Location of folder where video files are places
|
||||
asset_videos_input := assets/videos
|
||||
|
||||
build_root_path := build
|
||||
object_output_path := $(build_root_path)/$(board_name)
|
||||
binary_output_path := $(build_root_path)/bin
|
||||
|
||||
# Location of output folders where autogenerated code from assets is placed
|
||||
asset_root_path := generated
|
||||
asset_images_output := $(asset_root_path)/images
|
||||
asset_fonts_output := $(asset_root_path)/fonts
|
||||
asset_texts_output := $(asset_root_path)/texts
|
||||
asset_videos_output := $(asset_root_path)/videos
|
||||
|
||||
#include application specific configuration
|
||||
include config/gcc/app.mk
|
||||
|
||||
### END OF USER SECTION. THE FOLLOWING SHOULD NOT BE MODIFIED ###
|
||||
|
||||
ifeq ($(UNAME), Linux)
|
||||
library_path := $(touchgfx_path)/3rdparty/libjpeg/lib/linux $(touchgfx_path)/lib/linux $(ADDITIONAL_LIBRARY_PATHS)
|
||||
libraries := touchgfx SDL2 SDL2_image jpeg rt m pthread dl $(ADDITIONAL_LIBRARIES)
|
||||
libstart := -Wl,--start-group
|
||||
libend := -Wl,--end-group
|
||||
libextra :=
|
||||
library_includes += $(touchgfx_path)/3rdparty/libjpeg/include
|
||||
linker_options_local := -Xlinker -rpath -Xlinker $(touchgfx_path)/3rdparty/libjpeg/lib/linux
|
||||
resource_file :=
|
||||
imageconvert_executable := $(touchgfx_path)/framework/tools/imageconvert/build/linux/imageconvert.out
|
||||
fontconvert_executable := $(touchgfx_path)/framework/tools/fontconvert/build/linux/fontconvert.out
|
||||
simulator_executable := simulator.out
|
||||
linker_options += -static-libgcc -Xlinker --no-as-needed
|
||||
else
|
||||
sdl_library_path := $(touchgfx_path)/lib/sdl2/win32
|
||||
jpeg_library_path := $(touchgfx_path)/3rdparty/libjpeg/lib/win32
|
||||
library_path := $(sdl_library_path) $(jpeg_library_path) $(touchgfx_path)/lib/win/mingw32 $(ADDITIONAL_LIBRARY_PATHS)
|
||||
libraries := touchgfx SDL2 SDL2_image jpeg-8 m pthread mingw32 $(ADDITIONAL_LIBRARIES)
|
||||
libstart := -Wl,--start-group
|
||||
libend := -Wl,--end-group
|
||||
libextra := -Wl,--subsystem,windows
|
||||
library_includes += $(touchgfx_path)/framework/include/platform/hal/simulator/sdl2/vendor $(touchgfx_path)/3rdparty/libjpeg/include
|
||||
resource_file := generated/simulator/touchgfx.res
|
||||
imageconvert_executable := $(touchgfx_path)/framework/tools/imageconvert/build/win/imageconvert.out
|
||||
fontconvert_executable := $(touchgfx_path)/framework/tools/fontconvert/build/win/fontconvert.out
|
||||
simulator_executable := simulator.exe
|
||||
$(resource_file): $(resource_file:%.res=%.rc) $(resource_file:%.res=%.ico)
|
||||
@echo Creating Windows resource file with program icon
|
||||
@windres $(resource_file:%.res=%.rc) -O coff -o $@
|
||||
linker_options += -static-libgcc -static-libstdc++
|
||||
endif
|
||||
|
||||
c_compiler := g++
|
||||
c_compiler_options += -DSIMULATOR='' -g
|
||||
cpp_compiler := g++
|
||||
cpp_compiler_options += -g -DSIMULATOR='' -DENABLE_LOG
|
||||
linker := g++
|
||||
|
||||
WARN = error all extra write-strings init-self cast-qual \
|
||||
pointer-arith strict-aliasing format=2 uninitialized \
|
||||
missing-declarations no-long-long no-unused-parameter \
|
||||
no-variadic-macros no-format-extra-args \
|
||||
no-conversion no-overloaded-virtual
|
||||
CXXWARN = non-virtual-dtor ctor-dtor-privacy
|
||||
|
||||
c_compiler_options_local += -pedantic $(addprefix -W,$(WARN))
|
||||
cpp_compiler_options_local += -pedantic $(addprefix -W,$(WARN) $(CXXWARN))
|
||||
|
||||
#include everything + specific vendor folders
|
||||
framework_includes := $(touchgfx_path)/framework/include
|
||||
|
||||
#only take in the source we want to build for this sim
|
||||
framework_files := $(touchgfx_path)/framework/source/platform/driver/touch/SDL2TouchController.cpp
|
||||
framework_source := $(touchgfx_path)/framework/source/platform/hal/simulator/sdl2
|
||||
|
||||
#this needs to change when assset include folder changes.
|
||||
all_components := $(components) \
|
||||
$(asset_fonts_output) \
|
||||
$(asset_images_output) \
|
||||
$(asset_texts_output) \
|
||||
$(asset_videos_output)
|
||||
|
||||
#keep framework include and source out of this
|
||||
include_paths := $(library_includes) $(foreach comp, $(all_components), $(comp)/include) $(framework_includes) $(ADDITIONAL_INCLUDE_PATHS)
|
||||
source_paths = $(foreach comp, $(all_components), $(comp)/src) $(framework_source) simulator
|
||||
|
||||
# Finds files that matches the specified pattern. The directory list
|
||||
# is searched recursively. It is safe to invoke this function with an
|
||||
# empty list of directories.
|
||||
#
|
||||
# Param $(1): List of directories to search
|
||||
# Param $(2): The file pattern to search for
|
||||
define find
|
||||
$(foreach dir,$(1),$(foreach d,$(wildcard $(dir)/*),\
|
||||
$(call find,$(d),$(2))) $(wildcard $(dir)/$(strip $(2))))
|
||||
endef
|
||||
unexport find
|
||||
|
||||
fontconvert_ttf_lower_files := $(call find, $(asset_fonts_input), *.ttf)
|
||||
fontconvert_ttf_upper_files := $(call find, $(asset_fonts_input), *.TTF)
|
||||
fontconvert_otf_lower_files := $(call find, $(asset_fonts_input), *.otf)
|
||||
fontconvert_otf_upper_files := $(call find, $(asset_fonts_input), *.OTF)
|
||||
fontconvert_bdf_lower_files := $(call find, $(asset_fonts_input), *.bdf)
|
||||
fontconvert_bdf_upper_files := $(call find, $(asset_fonts_input), *.BDF)
|
||||
fontconvert_font_files := $(fontconvert_ttf_lower_files) \
|
||||
$(fontconvert_ttf_upper_files) \
|
||||
$(fontconvert_otf_lower_files) \
|
||||
$(fontconvert_otf_upper_files) \
|
||||
$(fontconvert_bdf_lower_files) \
|
||||
$(fontconvert_bdf_upper_files)
|
||||
|
||||
source_files := $(call find, $(source_paths),*.cpp) $(framework_files) $(ADDITIONAL_SOURCES)
|
||||
c_source_files := $(call find, $(source_paths),*.c)
|
||||
|
||||
object_files := $(source_files:$(touchgfx_path)/%.cpp=$(object_output_path)/touchgfx/%.o) $(c_source_files:$(touchgfx_path)/%.c=$(object_output_path)/touchgfx/%.o)
|
||||
object_files := $(object_files:%.cpp=$(object_output_path)/%.o)
|
||||
object_files := $(object_files:%.c=$(object_output_path)/%.o)
|
||||
dependency_files := $(object_files:%.o=%.d)
|
||||
|
||||
textconvert_script_path := $(touchgfx_path)/framework/tools/textconvert
|
||||
videoconvert_script_path := $(touchgfx_path)/framework/tools/videoconvert
|
||||
|
||||
text_database := $(asset_texts_input)/texts.xml
|
||||
|
||||
.PHONY: all clean assets generate_assets build_executable
|
||||
|
||||
all: generate_assets
|
||||
|
||||
generate_assets: assets
|
||||
@$(MAKE) -f generated/simulator/gcc/Makefile -r -s $(MFLAGS) build_executable
|
||||
|
||||
build_executable: $(binary_output_path)/$(simulator_executable) post_build
|
||||
|
||||
$(binary_output_path)/$(simulator_executable): $(object_files) $(resource_file)
|
||||
@echo Linking $(@)
|
||||
@mkdir -p $(@D)
|
||||
@mkdir -p $(object_output_path)
|
||||
@$(file >$(build_root_path)/objects.tmp) $(foreach F,$(object_files),$(file >>$(build_root_path)/objects.tmp,$F))
|
||||
@$(linker) \
|
||||
$(linker_options) $(linker_options_local) \
|
||||
$(patsubst %,-L%,$(library_path)) \
|
||||
@$(build_root_path)/objects.tmp -o $@ $(resource_file) \
|
||||
$(libstart) $(patsubst %,-l%,$(libraries)) $(libend) $(libextra)
|
||||
@rm -f $(build_root_path)/objects.tmp
|
||||
# Remove old images
|
||||
@rm -f $(binary_output_path)/*.bin
|
||||
@if ls $(asset_videos_output)/bin/*.bin >/dev/null 2>&1; then cp $(asset_videos_output)/bin/*.bin $(binary_output_path); fi
|
||||
ifneq ($(UNAME), Linux)
|
||||
@if [ ! -f $(binary_output_path)/SDL2.dll ]; then cp $(sdl_library_path)/SDL2.dll $(binary_output_path); fi
|
||||
@if [ ! -f $(binary_output_path)/SDL2_image.dll ]; then cp $(sdl_library_path)/SDL2_image.dll $(binary_output_path); fi
|
||||
@if [ ! -f $(binary_output_path)/libpng16-16.dll ]; then cp $(sdl_library_path)/libpng16-16.dll $(binary_output_path); fi
|
||||
@if [ ! -f $(binary_output_path)/zlib1.dll ]; then cp $(sdl_library_path)/zlib1.dll $(binary_output_path); fi
|
||||
@if [ ! -f $(binary_output_path)/libjpeg-8.dll ]; then cp $(jpeg_library_path)/libjpeg-8.dll $(binary_output_path); fi
|
||||
endif
|
||||
|
||||
.PHONY: post_build
|
||||
post_build:
|
||||
@mkdir -p $(binary_output_path)
|
||||
@if [ -f simulator/landscape.png ]; then cp simulator/landscape.png $(binary_output_path); else rm -f $(binary_output_path)/landscape.png; fi
|
||||
@if [ -f simulator/portrait.png ]; then cp simulator/portrait.png $(binary_output_path); else rm -f $(binary_output_path)/portrait.png; fi
|
||||
|
||||
$(object_output_path)/touchgfx/%.o: $(touchgfx_path)/%.cpp config/gcc/app.mk
|
||||
@echo Compiling $<
|
||||
@mkdir -p $(@D)
|
||||
@$(cpp_compiler) \
|
||||
-MMD -MP $(cpp_compiler_options) $(cpp_compiler_options_local) $(user_cflags) \
|
||||
$(patsubst %,-I%,$(include_paths)) \
|
||||
-c $< -o $@
|
||||
|
||||
$(object_output_path)/%.o: %.cpp config/gcc/app.mk
|
||||
@echo Compiling $<
|
||||
@mkdir -p $(@D)
|
||||
@$(cpp_compiler) \
|
||||
-MMD -MP $(cpp_compiler_options) $(cpp_compiler_options_local) $(user_cflags) \
|
||||
$(patsubst %,-I%,$(include_paths)) \
|
||||
-c $< -o $@
|
||||
|
||||
$(object_output_path)/%.o: %.c config/gcc/app.mk
|
||||
@echo Compiling $<
|
||||
@mkdir -p $(@D)
|
||||
@$(c_compiler) \
|
||||
-MMD -MP $(c_compiler_options) $(c_compiler_options_local) $(user_cflags) \
|
||||
$(patsubst %,-I%,$(include_paths)) \
|
||||
-c $< -o $@
|
||||
|
||||
ifeq ($(MAKECMDGOALS),build_executable)
|
||||
$(firstword $(dependency_files)): config/gcc/app.mk
|
||||
@rm -rf $(object_output_path)
|
||||
-include $(dependency_files)
|
||||
endif
|
||||
|
||||
assets: images texts videos
|
||||
|
||||
.PHONY: images
|
||||
images:
|
||||
@$(imageconvert_executable) -r $(asset_images_input) -w $(asset_images_output)
|
||||
|
||||
.PHONY: texts
|
||||
texts:
|
||||
@ruby $(textconvert_script_path)/main.rb $(text_database) $(fontconvert_executable) $(asset_fonts_output) $(asset_texts_output) $(asset_fonts_input) .
|
||||
|
||||
.PHONY: videos
|
||||
videos:
|
||||
@ruby $(videoconvert_script_path)/videoconvert.rb $(asset_videos_input) $(asset_videos_output)
|
||||
|
||||
clean:
|
||||
@echo Cleaning
|
||||
@rm -rf $(build_root_path)
|
||||
# Do not remove gui_generated
|
||||
@rm -rf $(asset_images_output)
|
||||
@rm -rf $(asset_fonts_output)
|
||||
@rm -rf $(asset_texts_output)
|
||||
@rm -rf $(asset_videos_output)
|
||||
# Create directory to avoid error if it does not exist
|
||||
@mkdir -p $(asset_root_path)
|
||||
# Remove assets folder if it is empty (i.e. no gui_generated folder)
|
||||
@rmdir --ignore-fail-on-non-empty $(asset_root_path)
|
||||
@ -0,0 +1,9 @@
|
||||
/*********************************************************************************/
|
||||
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||||
/*********************************************************************************/
|
||||
#include <touchgfx/hal/HAL.hpp>
|
||||
#include <touchgfx/lcd/LCD.hpp>
|
||||
|
||||
void setupSimulator(int argc, char** argv, touchgfx::HAL& hal);
|
||||
|
||||
touchgfx::LCD& setupLCD();
|
||||
@ -0,0 +1,354 @@
|
||||
/*********************************************************************************/
|
||||
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||||
/*********************************************************************************/
|
||||
#ifndef TOUCHGFX_DIRECTFRAMEBUFFERVIDEOCONTROLLER_HPP
|
||||
#define TOUCHGFX_DIRECTFRAMEBUFFERVIDEOCONTROLLER_HPP
|
||||
|
||||
#include <touchgfx/widgets/VideoWidget.hpp>
|
||||
#include <simulator/video/MJPEGDecoder.hpp>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* Strategy:
|
||||
* Decode directly into the framebuffer in draw.
|
||||
* Tick will decide if we are going to a new frame.
|
||||
*/
|
||||
template <uint32_t no_streams, touchgfx::Bitmap::BitmapFormat output_format>
|
||||
class DirectFrameBufferVideoController : public touchgfx::VideoController
|
||||
{
|
||||
public:
|
||||
DirectFrameBufferVideoController()
|
||||
: VideoController(), allowSkipFrames(true)
|
||||
{
|
||||
assert((no_streams > 0) && "Video: Number of streams zero!");
|
||||
|
||||
// Clear arrays
|
||||
memset(mjpegDecoders, 0, sizeof(mjpegDecoders));
|
||||
}
|
||||
|
||||
Handle registerVideoWidget(touchgfx::VideoWidget& widget)
|
||||
{
|
||||
// Find stream handle for Widget
|
||||
Handle handle = getFreeHandle();
|
||||
|
||||
streams[handle].isActive = true;
|
||||
|
||||
//Set Widget buffer format and address
|
||||
widget.setVideoBufferFormat(output_format, 0, 0);
|
||||
widget.setVideoBuffer((uint8_t*)0);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
void unregisterVideoWidget(const Handle handle)
|
||||
{
|
||||
streams[handle].isActive = false;
|
||||
}
|
||||
|
||||
void setFrameRate(const Handle handle, uint32_t ui_frames, uint32_t video_frames)
|
||||
{
|
||||
assert(handle < no_streams);
|
||||
Stream& stream = streams[handle];
|
||||
|
||||
// Reset counters
|
||||
stream.frameCount = 0;
|
||||
stream.tickCount = 0;
|
||||
|
||||
// Save requested frame rate ratio
|
||||
stream.frame_rate_ticks = ui_frames;
|
||||
stream.frame_rate_video = video_frames;
|
||||
}
|
||||
|
||||
void setVideoData(const Handle handle, const uint8_t* movie, const uint32_t length)
|
||||
{
|
||||
assert(handle < no_streams);
|
||||
|
||||
// Reset decoder to first frame
|
||||
mjpegDecoders[handle]->setVideoData(movie, length);
|
||||
|
||||
// Lower flag to show the first frame
|
||||
Stream& stream = streams[handle];
|
||||
stream.frameNumber = mjpegDecoders[handle]->getCurrentFrameNumber();
|
||||
stream.doDecodeNextFrame = false;
|
||||
|
||||
// Stop playing
|
||||
setCommand(handle, PAUSE, 0);
|
||||
}
|
||||
|
||||
void setVideoData(const Handle handle, touchgfx::VideoDataReader& reader)
|
||||
{
|
||||
assert(handle < no_streams);
|
||||
|
||||
// Reset decoder to first frame
|
||||
mjpegDecoders[handle]->setVideoData(reader);
|
||||
|
||||
// Lower flag to show the first frame
|
||||
Stream& stream = streams[handle];
|
||||
stream.frameNumber = mjpegDecoders[handle]->getCurrentFrameNumber();
|
||||
stream.doDecodeNextFrame = false;
|
||||
|
||||
// Stop playing
|
||||
setCommand(handle, PAUSE, 0);
|
||||
}
|
||||
|
||||
void setCommand(const Handle handle, Command cmd, uint32_t param)
|
||||
{
|
||||
assert(handle < no_streams);
|
||||
Stream& stream = streams[handle];
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case PLAY:
|
||||
// Cannot Play without movie
|
||||
if (mjpegDecoders[handle]->hasVideo())
|
||||
{
|
||||
stream.isPlaying = true;
|
||||
stream.isShowingOneFrame = false;
|
||||
// Reset counters
|
||||
stream.frameCount = 0;
|
||||
stream.tickCount = 0;
|
||||
// If non-repeating video stopped at the end, kick to next frame
|
||||
if (!stream.repeat)
|
||||
{
|
||||
MJPEGDecoder* const decoder = mjpegDecoders[handle];
|
||||
if (decoder->getCurrentFrameNumber() == decoder->getNumberOfFrames())
|
||||
{
|
||||
decoder->gotoNextFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PAUSE:
|
||||
stream.isPlaying = false;
|
||||
stream.isShowingOneFrame = false;
|
||||
break;
|
||||
case SEEK:
|
||||
stream.seek_to_frame = param;
|
||||
// Reset counters
|
||||
stream.frameCount = 0;
|
||||
stream.tickCount = 0;
|
||||
break;
|
||||
case SHOW:
|
||||
stream.seek_to_frame = param;
|
||||
stream.isShowingOneFrame = true;
|
||||
stream.doDecodeNextFrame = true;
|
||||
// Reset counters
|
||||
stream.frameCount = 0;
|
||||
stream.tickCount = 0;
|
||||
break;
|
||||
case STOP:
|
||||
stream.isPlaying = false;
|
||||
stream.isShowingOneFrame = false;
|
||||
stream.seek_to_frame = 1;
|
||||
// Reset counters
|
||||
stream.frameCount = 0;
|
||||
stream.tickCount = 0;
|
||||
break;
|
||||
case SET_REPEAT:
|
||||
stream.repeat = (param > 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool updateFrame(const Handle handle, touchgfx::VideoWidget& widget)
|
||||
{
|
||||
assert(handle < no_streams);
|
||||
Stream& stream = streams[handle];
|
||||
|
||||
bool hasMoreFrames = true;
|
||||
|
||||
if (stream.isPlaying || stream.isShowingOneFrame)
|
||||
{
|
||||
// Increase tickCount
|
||||
stream.tickCount+=HAL::getInstance()->getLCDRefreshCount();
|
||||
|
||||
// Lower flag
|
||||
stream.isShowingOneFrame = false;
|
||||
|
||||
if (stream.doDecodeNextFrame)
|
||||
{
|
||||
MJPEGDecoder* const decoder = mjpegDecoders[handle];
|
||||
// Invalidate to get widget redrawn
|
||||
widget.invalidate();
|
||||
// Seek or increment video frame
|
||||
if (stream.seek_to_frame > 0)
|
||||
{
|
||||
decoder->gotoFrame(stream.seek_to_frame);
|
||||
hasMoreFrames = (stream.seek_to_frame < decoder->getNumberOfFrames());
|
||||
stream.seek_to_frame = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stream.skip_frames > 0)
|
||||
{
|
||||
decoder->gotoFrame(decoder->getCurrentFrameNumber() + stream.skip_frames);
|
||||
stream.frameCount += stream.skip_frames;
|
||||
stream.skip_frames = 0;
|
||||
}
|
||||
if (stream.repeat)
|
||||
{
|
||||
hasMoreFrames = decoder->gotoNextFrame();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (decoder->getCurrentFrameNumber() < decoder->getNumberOfFrames())
|
||||
{
|
||||
hasMoreFrames = decoder->gotoNextFrame();
|
||||
}
|
||||
else
|
||||
{
|
||||
stream.isPlaying = false;
|
||||
hasMoreFrames = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stream.frameNumber = decoder->getCurrentFrameNumber();
|
||||
stream.frameCount++;
|
||||
}
|
||||
|
||||
// Save decode status for next frame
|
||||
stream.doDecodeNextFrame = decodeForNextTick(stream);
|
||||
}
|
||||
|
||||
return hasMoreFrames;
|
||||
}
|
||||
|
||||
void draw(const Handle handle, const touchgfx::Rect& invalidatedArea, const touchgfx::VideoWidget& widget)
|
||||
{
|
||||
assert(handle < no_streams);
|
||||
|
||||
if (output_format != Bitmap::RGB565 && output_format != Bitmap::RGB888 && output_format != Bitmap::ARGB8888)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (mjpegDecoders[handle]->hasVideo())
|
||||
{
|
||||
uint8_t* wbuf = (uint8_t*)touchgfx::HAL::getInstance()->lockFrameBuffer();
|
||||
const touchgfx::Rect& absolute = widget.getAbsoluteRect();
|
||||
|
||||
// Get frame buffer pointer to upper left of widget in framebuffer coordinates
|
||||
switch(output_format)
|
||||
{
|
||||
case Bitmap::RGB565:
|
||||
wbuf += (absolute.x + absolute.y * touchgfx::HAL::FRAME_BUFFER_WIDTH) * 2;
|
||||
break;
|
||||
case Bitmap::RGB888:
|
||||
wbuf += (absolute.x + absolute.y * touchgfx::HAL::FRAME_BUFFER_WIDTH) * 3;
|
||||
break;
|
||||
case Bitmap::ARGB8888:
|
||||
wbuf += (absolute.x + absolute.y * touchgfx::HAL::FRAME_BUFFER_WIDTH) * 4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Decode relevant part of the frame to the framebuffer
|
||||
mjpegDecoders[handle]->decodeFrame(invalidatedArea, wbuf, touchgfx::HAL::FRAME_BUFFER_WIDTH);
|
||||
// Release frame buffer
|
||||
touchgfx::HAL::getInstance()->unlockFrameBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
void addDecoder(MJPEGDecoder& decoder, uint32_t index)
|
||||
{
|
||||
assert(index < no_streams);
|
||||
mjpegDecoders[index] = &decoder;
|
||||
}
|
||||
|
||||
uint32_t getCurrentFrameNumber(const Handle handle)
|
||||
{
|
||||
assert(handle < no_streams);
|
||||
Stream& stream = streams[handle];
|
||||
|
||||
return stream.frameNumber;
|
||||
}
|
||||
|
||||
void getVideoInformation(const Handle handle, touchgfx::VideoInformation* data)
|
||||
{
|
||||
assert(handle < no_streams);
|
||||
mjpegDecoders[handle]->getVideoInfo(data);
|
||||
}
|
||||
|
||||
bool getIsPlaying(const Handle handle)
|
||||
{
|
||||
assert(handle < no_streams);
|
||||
Stream& stream = streams[handle];
|
||||
return stream.isPlaying;
|
||||
}
|
||||
|
||||
void setFrameRateCompensation(const bool allow)
|
||||
{
|
||||
allowSkipFrames = allow;
|
||||
}
|
||||
|
||||
private:
|
||||
class Stream
|
||||
{
|
||||
public:
|
||||
Stream()
|
||||
: frameCount(0), frameNumber(0), tickCount(0),
|
||||
frame_rate_video(0), frame_rate_ticks(0),
|
||||
seek_to_frame(0),
|
||||
isActive(false), isPlaying(false), isShowingOneFrame(false), repeat(true),
|
||||
doDecodeNextFrame(false)
|
||||
{
|
||||
}
|
||||
uint32_t frameCount; // Video frames decoded since play
|
||||
uint32_t frameNumber; // Video frame showed number
|
||||
uint32_t tickCount; // UI frames since play
|
||||
uint32_t frame_rate_video; // Ratio of frames wanted counter
|
||||
uint32_t frame_rate_ticks; // Ratio of frames wanted divider
|
||||
uint32_t seek_to_frame; // Requested next frame number
|
||||
uint32_t skip_frames; // Number of frames to skip to keep frame rate
|
||||
bool isActive;
|
||||
bool isPlaying;
|
||||
bool isShowingOneFrame;
|
||||
bool repeat;
|
||||
bool doDecodeNextFrame; // High if we should go to next frame in next tick
|
||||
};
|
||||
|
||||
MJPEGDecoder* mjpegDecoders[no_streams];
|
||||
Stream streams[no_streams];
|
||||
bool allowSkipFrames;
|
||||
|
||||
/**
|
||||
* Return true, if new video frame should be decoded for the next tick (keep video decode framerate low)
|
||||
*/
|
||||
bool decodeForNextTick(Stream& stream)
|
||||
{
|
||||
// Running in UI thread
|
||||
|
||||
// Compare tickCount/frameNumber to frame_rate_ticks/frame_rate_video
|
||||
if ((stream.tickCount * stream.frame_rate_video) > (stream.frame_rate_ticks * stream.frameCount))
|
||||
{
|
||||
if (allowSkipFrames)
|
||||
{
|
||||
stream.skip_frames = (stream.tickCount * stream.frame_rate_video - stream.frame_rate_ticks * stream.frameCount) / stream.frame_rate_ticks;
|
||||
if (stream.skip_frames > 0)
|
||||
{
|
||||
stream.skip_frames--;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Handle getFreeHandle()
|
||||
{
|
||||
for (uint32_t i = 0; i < no_streams; i++)
|
||||
{
|
||||
if (streams[i].isActive == false)
|
||||
{
|
||||
return static_cast<VideoController::Handle>(i);
|
||||
}
|
||||
}
|
||||
|
||||
assert(0 && "Unable to find free video stream handle!");
|
||||
return static_cast<VideoController::Handle>(0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // TOUCHGFX_DIRECTFRAMEBUFFERVIDEOCONTROLLER_HPP
|
||||
@ -0,0 +1,75 @@
|
||||
/*********************************************************************************/
|
||||
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||||
/*********************************************************************************/
|
||||
#ifndef TOUCHGFX_MJPEGDECODER_HPP
|
||||
#define TOUCHGFX_MJPEGDECODER_HPP
|
||||
|
||||
#include <touchgfx/hal/Types.hpp>
|
||||
#include <touchgfx/hal/VideoController.hpp>
|
||||
|
||||
class MJPEGDecoder
|
||||
{
|
||||
public:
|
||||
virtual ~MJPEGDecoder()
|
||||
{
|
||||
}
|
||||
|
||||
//Set video data for the decoder
|
||||
virtual void setVideoData(const uint8_t* movie, const uint32_t length) = 0;
|
||||
|
||||
//Set video data for the decoder
|
||||
virtual void setVideoData(touchgfx::VideoDataReader& reader) = 0;
|
||||
|
||||
/**
|
||||
* Check if MJPEGDecoder has a video.
|
||||
*
|
||||
* @return Returns true if the MJPEGDecoder has a video.
|
||||
*/
|
||||
virtual bool hasVideo() = 0;
|
||||
|
||||
//Increment position to next frame and decode and convert to RGB
|
||||
virtual bool decodeNextFrame(uint8_t* buffer, uint16_t width, uint16_t height, uint32_t stride) = 0;
|
||||
|
||||
//Increment position to next frame and decode. Used with decodeFrame.
|
||||
virtual bool gotoNextFrame() = 0;
|
||||
|
||||
//Decode part of the current frame, framebuffer is locked, area is drawn relative to frameBuffer
|
||||
virtual bool decodeFrame(const touchgfx::Rect& area, uint8_t* frameBuffer, uint32_t framebufferStride) = 0;
|
||||
|
||||
//Decode thumbnail, assumes buffer stride is width
|
||||
virtual bool decodeThumbnail(uint32_t frameno, uint8_t* buffer, uint16_t width, uint16_t height) = 0;
|
||||
|
||||
//Set current frame number
|
||||
virtual void gotoFrame(uint32_t frameno) = 0;
|
||||
|
||||
//Get current frame number
|
||||
virtual uint32_t getCurrentFrameNumber() const = 0;
|
||||
|
||||
//Get number of frames in video
|
||||
virtual uint32_t getNumberOfFrames() = 0;
|
||||
|
||||
//Read video information
|
||||
virtual void getVideoInfo(touchgfx::VideoInformation* data) = 0;
|
||||
|
||||
enum AVIErrors
|
||||
{
|
||||
AVI_NO_ERROR,
|
||||
AVI_NO_BUFFERS,
|
||||
AVI_NO_FILE,
|
||||
AVI_ERROR_NOT_RIFF,
|
||||
AVI_ERROR_AVI_HEADER_NOT_FOUND,
|
||||
AVI_ERROR_AVI_LIST_NOT_FOUND,
|
||||
AVI_ERROR_AVI_HDRL_NOT_FOUND,
|
||||
AVI_ERROR_AVI_AVIH_NOT_FOUND,
|
||||
AVI_ERROR_AVI_HEADER_TO_SHORT, //not full header provided
|
||||
AVI_ERROR_FILE_BUFFER_TO_SMALL,
|
||||
AVI_ERROR_MOVI_NOT_FOUND,
|
||||
AVI_ERROR_IDX1_NOT_FOUND,
|
||||
AVI_ERROR_FRAMENO_TO_HIGH,
|
||||
AVI_ERROR_EOF_REACHED
|
||||
};
|
||||
|
||||
AVIErrors virtual getLastError() = 0;
|
||||
};
|
||||
|
||||
#endif // TOUCHGFX_MJPEGDECODER_HPP
|
||||
@ -0,0 +1,73 @@
|
||||
/*********************************************************************************/
|
||||
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||||
/*********************************************************************************/
|
||||
#ifndef TOUCHGFX_SOFTWAREMJPEGDECODER_HPP
|
||||
#define TOUCHGFX_SOFTWAREMJPEGDECODER_HPP
|
||||
|
||||
#include <simulator/video/MJPEGDecoder.hpp>
|
||||
|
||||
class SoftwareMJPEGDecoder : public MJPEGDecoder
|
||||
{
|
||||
public:
|
||||
SoftwareMJPEGDecoder(uint8_t* linebuffer);
|
||||
|
||||
virtual void setVideoData(const uint8_t* movie, const uint32_t length);
|
||||
|
||||
virtual void setVideoData(touchgfx::VideoDataReader& reader);
|
||||
|
||||
virtual bool hasVideo();
|
||||
|
||||
virtual bool decodeNextFrame(uint8_t* frameBuffer, uint16_t width, uint16_t height, uint32_t framebuffer_width);
|
||||
|
||||
virtual bool gotoNextFrame();
|
||||
|
||||
virtual bool decodeFrame(const touchgfx::Rect& area, uint8_t* frameBuffer, uint32_t framebuffer_width);
|
||||
|
||||
virtual bool decodeThumbnail(uint32_t frameno, uint8_t* buffer, uint16_t width, uint16_t height);
|
||||
|
||||
virtual void gotoFrame(uint32_t frameno);
|
||||
|
||||
virtual uint32_t getCurrentFrameNumber() const
|
||||
{
|
||||
return frameNumber;
|
||||
}
|
||||
|
||||
virtual uint32_t getNumberOfFrames();
|
||||
|
||||
virtual void getVideoInfo(touchgfx::VideoInformation* data);
|
||||
|
||||
void setAVIFileBuffer(uint8_t* buffer, uint32_t size)
|
||||
{
|
||||
aviBuffer = buffer, aviBufferLength = size;
|
||||
}
|
||||
|
||||
AVIErrors getLastError()
|
||||
{
|
||||
return lastError;
|
||||
}
|
||||
|
||||
private:
|
||||
void readVideoHeader();
|
||||
void decodeMJPEGFrame(const uint8_t* const mjpgdata, const uint32_t length, uint8_t* buffer, uint16_t width, uint16_t height, uint32_t stride);
|
||||
int compare(const uint32_t offset, const char* str, uint32_t num);
|
||||
uint32_t getU32(const uint32_t offset);
|
||||
uint32_t getU16(const uint32_t offset);
|
||||
const uint8_t* readData(uint32_t offset, uint32_t length);
|
||||
|
||||
touchgfx::VideoInformation videoInfo;
|
||||
uint32_t frameNumber;
|
||||
uint32_t currentMovieOffset;
|
||||
uint32_t indexOffset;
|
||||
uint32_t firstFrameOffset;
|
||||
uint32_t lastFrameEnd;
|
||||
uint32_t movieLength;
|
||||
const uint8_t* movieData;
|
||||
touchgfx::VideoDataReader* reader;
|
||||
uint8_t* lineBuffer;
|
||||
uint8_t* aviBuffer;
|
||||
uint32_t aviBufferLength;
|
||||
uint32_t aviBufferStartOffset;
|
||||
AVIErrors lastError;
|
||||
};
|
||||
|
||||
#endif // TOUCHGFX_SOFTWAREMJPEGDECODER_HPP
|
||||
31
TouchGFX/generated/simulator/msvs/touchgfx.props
Normal file
31
TouchGFX/generated/simulator/msvs/touchgfx.props
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<LocalDebuggerEnvironment>PATH=$(TouchGFXReleasePath)\lib\sdl\win32</LocalDebuggerEnvironment>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ApplicationRoot)\gui\include;$(ApplicationRoot)\generated\images\include;$(ApplicationRoot)\generated\bitmaps\include;$(ApplicationRoot)\generated\fonts\include;$(ApplicationRoot)\generated\texts\include;$(ApplicationRoot)\generated\videos\include;$(ApplicationRoot)\generated\gui_generated\include;$(ApplicationRoot)\generated\simulator\include;$(TouchGFXReleasePath)\framework\common\include;$(TouchGFXReleasePath)\framework\mvp\include;$(TouchGFXReleasePath)\framework\include\platform\hal\simulator\sdl\vendor\win32;$(TouchGFXReleasePath)\framework\platform\hal\simulator\sdl\3rdparty\sdl\include\win32;$(TouchGFXReleasePath)\3rdparty\libjpeg\include;$(TouchGFXReleasePath)\framework\include</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>$(UseBPPOption)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>SIMULATOR;_ITERATOR_DEBUG_LEVEL=0</PreprocessorDefinitions>
|
||||
<DisableSpecificWarnings>4355</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Link>
|
||||
<AdditionalDependencies>$(TouchGFXReleasePath)\lib\sdl\win32\SDL.lib;$(TouchGFXReleasePath)\lib\sdl\win32\SDLmain.lib;$(TouchGFXReleasePath)\lib\sdl\win32\SDL_image.lib;$(TouchGFXReleasePath)\3rdparty\libjpeg\lib\win32\libjpeg-8.lib;$(TouchGFXReleasePath)\lib\win\msvs\libtouchgfx_$(PlatformToolset)_debug.lib;user32.lib;shell32.lib</AdditionalDependencies>
|
||||
<AdditionalOptions>/NODEFAULTLIB:msvcrt.lib</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Link>
|
||||
<AdditionalDependencies>$(TouchGFXReleasePath)\lib\sdl\win32\SDL.lib;$(TouchGFXReleasePath)\lib\sdl\win32\SDLmain.lib;$(TouchGFXReleasePath)\lib\sdl\win32\SDL_image.lib;$(TouchGFXReleasePath)\lib\win\msvs\libtouchgfx_$(PlatformToolset).lib;user32.lib;shell32.lib</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
</Project>
|
||||
86
TouchGFX/generated/simulator/msvs/touchgfx_prebuild.targets
Normal file
86
TouchGFX/generated/simulator/msvs/touchgfx_prebuild.targets
Normal file
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<AllGeneratedFolders Include="$(ApplicationRoot)\generated\fonts;$(ApplicationRoot)\generated\images;$(ApplicationRoot)\generated\texts;$(ApplicationRoot)\generated\videos" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ImageConvertExecutable Include="$(TouchGFXReleasePath)\framework\tools\imageconvert\build\msvs\ImageConvert.exe" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<UseBPPOption>/DUSE_BPP=$(UseBPP)</UseBPPOption>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(LCD)'!=''">
|
||||
<LCDOption>/D$(LCD)</LCDOption>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(LCD)'==''">
|
||||
<LCDOption/>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<touchgfx_env Condition="'$(TouchGFXEnvPath)'==''">$(TouchGFXReleasePath)\..\env</touchgfx_env>
|
||||
<touchgfx_env Condition="'$(TouchGFXEnvPath)'!=''">$(TouchGFXEnvPath)</touchgfx_env>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="GenerateBitmapDatabaseFiles" BeforeTargets="ClCompile">
|
||||
<Message Text="Converting images" />
|
||||
<Exec Command="echo Converting images" />
|
||||
<Exec Command=""%(ImageConvertExecutable.FullPath)" -r assets\images -w generated\images" WorkingDirectory="$(ApplicationRoot)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="GenerateTextsAndFontsFiles" BeforeTargets="ClCompile">
|
||||
<Message Text="Converting texts and fonts" />
|
||||
<Exec Command="echo Converting texts and fonts" />
|
||||
<Exec Command=""$(touchgfx_env)\MinGW\msys\1.0\Ruby30-x64\bin\ruby.exe" "$(TouchGFXReleasePath)\framework\tools\textconvert\main.rb" "$(ApplicationRoot)\assets\texts\texts.xml" "$(TouchGFXReleasePath)\framework\tools\fontconvert\build\win\fontconvert.out" "$(ApplicationRoot)\generated\fonts" "$(ApplicationRoot)\generated\texts" "$(ApplicationRoot)\assets\fonts" "$(ApplicationRoot)"" />
|
||||
</Target>
|
||||
|
||||
<Target Name="GenerateVideos" BeforeTargets="ClCompile">
|
||||
<Message Text="Converting videos" />
|
||||
<Exec Command="echo Converting videos" />
|
||||
<Exec Command=""$(touchgfx_env)\MinGW\msys\1.0\Ruby30-x64\bin\ruby.exe" "$(TouchGFXReleasePath)\framework\tools\videoconvert\videoconvert.rb" "$(ApplicationRoot)" assets\videos generated\videos" />
|
||||
</Target>
|
||||
|
||||
<Target Name="CompileAllGeneratedFiles" BeforeTargets="ClCompile">
|
||||
<ItemGroup>
|
||||
<AllGeneratedCompileFiles Include="$(ApplicationRoot)\generated\fonts\**\*.cpp;$(ApplicationRoot)\generated\images\**\*.cpp;$(ApplicationRoot)\generated\texts\**\*.cpp;$(ApplicationRoot)\generated\videos\**\*.cpp" />
|
||||
</ItemGroup>
|
||||
<Message Text="Creating compile items for all generated source files: @(AllGeneratedCompileFiles)" />
|
||||
<Exec Command="echo Creating compile items for all generated source files: @(AllGeneratedCompileFiles)" />
|
||||
<CreateItem Include="@(AllGeneratedCompileFiles)">
|
||||
<Output TaskParameter="Include" ItemName="ClCompile" />
|
||||
</CreateItem>
|
||||
</Target>
|
||||
|
||||
<Target Name="CleanupGeneratedFiles" AfterTargets="Clean">
|
||||
<Message Text="Clean-up generated files: @(AllGeneratedFolders)" />
|
||||
<Exec Command="echo Clean-up generated files: @(AllGeneratedFolders)" />
|
||||
<RemoveDir Directories="@(AllGeneratedFolders)" />
|
||||
<ItemGroup>
|
||||
<PostBuildFiles Include="$(OutDir)\*.dll" />
|
||||
<PostBuildFiles Include="$(OutDir)\*.bin" />
|
||||
<PostBuildFiles Include="$(OutDir)\*.png" />
|
||||
</ItemGroup>
|
||||
<Delete Files="@(PostBuildFiles)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="ClCompile">
|
||||
<ItemGroup>
|
||||
<OldVideoFiles Include="$(OutDir)\*.bin" />
|
||||
<NewFiles Include="$(ApplicationRoot)\generated\videos\bin\*.bin" />
|
||||
<NewFiles Include="$(TouchGFXReleasePath)\lib\sdl2\win32\SDL2.dll" />
|
||||
<NewFiles Include="$(TouchGFXReleasePath)\lib\sdl2\win32\SDL2_image.dll" />
|
||||
<NewFiles Include="$(TouchGFXReleasePath)\lib\sdl2\win32\libpng16-16.dll" />
|
||||
<NewFiles Include="$(TouchGFXReleasePath)\lib\sdl2\win32\zlib1.dll" />
|
||||
<NewFiles Include="$(TouchGFXReleasePath)\3rdparty\libjpeg\lib\win32\libjpeg-8.dll" />
|
||||
<NewFiles Include="$(ApplicationRoot)\simulator\landscape.png" />
|
||||
<NewFiles Include="$(ApplicationRoot)\simulator\portrait.png" />
|
||||
</ItemGroup>
|
||||
<Delete Files="@(OldVideoFiles)" />
|
||||
<Copy SourceFiles="@(NewFiles)"
|
||||
DestinationFolder="$(OutDir)"
|
||||
SkipUnchangedFiles="true"
|
||||
Condition="Exists('%(FullPath)')" />
|
||||
</Target>
|
||||
</Project>
|
||||
29
TouchGFX/generated/simulator/msvs/touchgfx_sdl2.props
Normal file
29
TouchGFX/generated/simulator/msvs/touchgfx_sdl2.props
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<LocalDebuggerEnvironment>PATH=$(TouchGFXReleasePath)\lib\sdl2\win32</LocalDebuggerEnvironment>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ApplicationRoot)\gui\include;$(ApplicationRoot)\generated\images\include;$(ApplicationRoot)\generated\bitmaps\include;$(ApplicationRoot)\generated\fonts\include;$(ApplicationRoot)\generated\texts\include;$(ApplicationRoot)\generated\videos\include;$(ApplicationRoot)\generated\gui_generated\include;$(ApplicationRoot)\generated\simulator\include;$(TouchGFXReleasePath)\framework\common\include;$(TouchGFXReleasePath)\framework\mvp\include;$(TouchGFXReleasePath)\framework\include\platform\hal\simulator\sdl2\vendor;$(TouchGFXReleasePath)\3rdparty\libjpeg\include;$(TouchGFXReleasePath)\framework\include</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>$(UseBPPOption)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>SIMULATOR;_ITERATOR_DEBUG_LEVEL=0</PreprocessorDefinitions>
|
||||
<DisableSpecificWarnings>4355</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Link>
|
||||
<AdditionalDependencies>$(TouchGFXReleasePath)\lib\sdl2\win32\SDL2.lib;$(TouchGFXReleasePath)\lib\sdl2\win32\SDL2_image.lib;$(TouchGFXReleasePath)\3rdparty\libjpeg\lib\win32\libjpeg-8.lib;$(TouchGFXReleasePath)\lib\win\msvs\libtouchgfx_$(PlatformToolset)_debug.lib;user32.lib;shell32.lib</AdditionalDependencies> <AdditionalOptions>/NODEFAULTLIB:msvcrt.lib</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Link>
|
||||
<AdditionalDependencies>$(TouchGFXReleasePath)\lib\sdl2\win32\SDL2.lib;$(TouchGFXReleasePath)\lib\sdl2\win32\SDL2_image.lib;$(TouchGFXReleasePath)\3rdparty\libjpeg\lib\win32\libjpeg-8.lib;$(TouchGFXReleasePath)\lib\win\msvs\libtouchgfx_$(PlatformToolset).lib;user32.lib;shell32.lib</AdditionalDependencies> </Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
</Project>
|
||||
29
TouchGFX/generated/simulator/src/mainBase.cpp
Normal file
29
TouchGFX/generated/simulator/src/mainBase.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
/*********************************************************************************/
|
||||
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||||
/*********************************************************************************/
|
||||
#include <simulator/mainBase.hpp>
|
||||
#include <platform/hal/simulator/sdl2/HALSDL2.hpp>
|
||||
#include <common/TouchGFXInit.hpp>
|
||||
#include <platform/driver/lcd/LCD16bpp.hpp>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define fopen_s(pFile, filename, mode) (((*(pFile)) = fopen((filename), (mode))) == NULL)
|
||||
#endif
|
||||
touchgfx::LCD16bpp lcd;
|
||||
|
||||
void setupSimulator(int argc, char** argv, touchgfx::HAL& hal)
|
||||
{
|
||||
// Simulate hardware running at 60Hz generating a vsync every 16.6667 ms
|
||||
static_cast<touchgfx::HALSDL2&>(hal).setVsyncInterval(16.6667f);
|
||||
static_cast<touchgfx::HALSDL2&>(hal).setWindowTitle("MyApplication");
|
||||
|
||||
// Initialize SDL
|
||||
bool sdl_init_result = static_cast<touchgfx::HALSDL2&>(hal).sdl_init(argc, argv);
|
||||
assert(sdl_init_result && "Error during SDL initialization");
|
||||
}
|
||||
|
||||
touchgfx::LCD& setupLCD()
|
||||
{
|
||||
return lcd;
|
||||
}
|
||||
548
TouchGFX/generated/simulator/src/video/SoftwareMJPEGDecoder.cpp
Normal file
548
TouchGFX/generated/simulator/src/video/SoftwareMJPEGDecoder.cpp
Normal file
@ -0,0 +1,548 @@
|
||||
/*********************************************************************************/
|
||||
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
|
||||
/*********************************************************************************/
|
||||
#include <jinclude.h>
|
||||
#include <jpeglib.h>
|
||||
#include <string.h>
|
||||
#include <simulator/video/SoftwareMJPEGDecoder.hpp>
|
||||
|
||||
#define VIDEO_DECODE_FORMAT 16
|
||||
|
||||
namespace
|
||||
{
|
||||
struct JPEG_RGB
|
||||
{
|
||||
uint8_t B;
|
||||
uint8_t G;
|
||||
uint8_t R;
|
||||
#if VIDEO_DECODE_FORMAT == 32
|
||||
uint8_t X;
|
||||
#endif
|
||||
};
|
||||
} // namespace
|
||||
|
||||
SoftwareMJPEGDecoder::SoftwareMJPEGDecoder(uint8_t* buffer)
|
||||
: frameNumber(0), currentMovieOffset(0), indexOffset(0), firstFrameOffset(0), lastFrameEnd(0), movieLength(0), movieData(0),
|
||||
reader(0), lineBuffer(buffer), aviBuffer(0), aviBufferLength(0), aviBufferStartOffset(0), lastError(AVI_NO_ERROR)
|
||||
{
|
||||
//clear video info
|
||||
videoInfo.ms_between_frames = 0;
|
||||
videoInfo.number_of_frames = 0;
|
||||
videoInfo.frame_width = 0;
|
||||
videoInfo.frame_height = 0;
|
||||
}
|
||||
|
||||
int SoftwareMJPEGDecoder::compare(const uint32_t offset, const char* str, uint32_t num)
|
||||
{
|
||||
const char* src;
|
||||
if (reader != 0)
|
||||
{
|
||||
// Assuming data is in buffer!
|
||||
src = reinterpret_cast<const char*>(aviBuffer + (offset - aviBufferStartOffset));
|
||||
}
|
||||
else
|
||||
{
|
||||
src = (const char*)movieData + offset;
|
||||
}
|
||||
return strncmp(src, str, num);
|
||||
}
|
||||
|
||||
inline uint32_t SoftwareMJPEGDecoder::getU32(const uint32_t offset)
|
||||
{
|
||||
if (reader != 0)
|
||||
{
|
||||
// Assuming data is in buffer!
|
||||
const uint32_t index = offset - aviBufferStartOffset;
|
||||
return aviBuffer[index + 0] | (aviBuffer[index + 1] << 8) | (aviBuffer[index + 2] << 16) | (aviBuffer[index + 3] << 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint8_t* const d = movieData + offset;
|
||||
return d[0] | (d[1] << 8) | (d[2] << 16) | (d[3] << 24);
|
||||
}
|
||||
}
|
||||
|
||||
inline uint32_t SoftwareMJPEGDecoder::getU16(const uint32_t offset)
|
||||
{
|
||||
if (reader != 0)
|
||||
{
|
||||
// Assuming data is in buffer!
|
||||
const uint32_t index = offset - aviBufferStartOffset;
|
||||
return aviBuffer[index + 0] | (aviBuffer[index + 1] << 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint8_t* const d = movieData + offset;
|
||||
return d[0] | (d[1] << 8);
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t* SoftwareMJPEGDecoder::readData(uint32_t offset, uint32_t length)
|
||||
{
|
||||
if (reader != 0)
|
||||
{
|
||||
if (length > aviBufferLength)
|
||||
{
|
||||
lastError = AVI_ERROR_FILE_BUFFER_TO_SMALL;
|
||||
assert(!"Buffer to small");
|
||||
}
|
||||
|
||||
reader->seek(offset);
|
||||
if (!reader->readData(aviBuffer, length))
|
||||
{
|
||||
lastError = AVI_ERROR_EOF_REACHED;
|
||||
}
|
||||
|
||||
aviBufferStartOffset = offset;
|
||||
return aviBuffer;
|
||||
}
|
||||
|
||||
return movieData + offset;
|
||||
}
|
||||
|
||||
bool SoftwareMJPEGDecoder::decodeNextFrame(uint8_t* buffer, uint16_t buffer_width, uint16_t buffer_height, uint32_t buffer_stride)
|
||||
{
|
||||
assert((frameNumber > 0) && "SoftwareMJPEGDecoder decoding without frame data!");
|
||||
|
||||
//find next frame and decode it
|
||||
readData(currentMovieOffset, 8);
|
||||
uint32_t streamNo = getU16(currentMovieOffset);
|
||||
uint32_t chunkType = getU16(currentMovieOffset + 2);
|
||||
uint32_t chunkSize = getU32(currentMovieOffset + 4);
|
||||
const uint16_t STREAM0 = 0x3030;
|
||||
const uint16_t TYPEDC = 0x6364;
|
||||
|
||||
bool isCurrentFrameLast;
|
||||
//play frame if we have it all
|
||||
if (currentMovieOffset + 8 + chunkSize < movieLength)
|
||||
{
|
||||
if (streamNo == STREAM0 && chunkType == TYPEDC && chunkSize > 0)
|
||||
{
|
||||
currentMovieOffset += 8;
|
||||
//decode frame
|
||||
const uint8_t* chunk = readData(currentMovieOffset, chunkSize);
|
||||
decodeMJPEGFrame(chunk, chunkSize, buffer, buffer_width, buffer_height, buffer_stride);
|
||||
frameNumber++;
|
||||
}
|
||||
|
||||
isCurrentFrameLast = false;
|
||||
|
||||
// Advance to next frame
|
||||
currentMovieOffset += chunkSize;
|
||||
if (chunkSize == 0) // Skip empty frame
|
||||
{
|
||||
currentMovieOffset += 8;
|
||||
}
|
||||
currentMovieOffset = (currentMovieOffset + 1) & 0xFFFFFFFE; //pad to next word
|
||||
|
||||
if (currentMovieOffset == lastFrameEnd)
|
||||
{
|
||||
frameNumber = 1;
|
||||
currentMovieOffset = firstFrameOffset; //start over
|
||||
isCurrentFrameLast = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
frameNumber = 1;
|
||||
currentMovieOffset = firstFrameOffset; //start over
|
||||
isCurrentFrameLast = true;
|
||||
}
|
||||
return !isCurrentFrameLast;
|
||||
}
|
||||
|
||||
bool SoftwareMJPEGDecoder::gotoNextFrame()
|
||||
{
|
||||
assert((frameNumber > 0) && "SoftwareMJPEGDecoder decoding without frame data!");
|
||||
|
||||
readData(currentMovieOffset, 8);
|
||||
uint32_t chunkSize = getU32(currentMovieOffset + 4);
|
||||
|
||||
//increment until next video frame
|
||||
while (currentMovieOffset + 8 + chunkSize < movieLength)
|
||||
{
|
||||
//increment one frame
|
||||
currentMovieOffset += chunkSize + 8;
|
||||
currentMovieOffset = (currentMovieOffset + 1) & 0xFFFFFFFE; //pad to next word
|
||||
frameNumber++;
|
||||
|
||||
//next chunk
|
||||
readData(currentMovieOffset, 8);
|
||||
//check it is a video frame
|
||||
uint32_t streamNo = getU16(currentMovieOffset);
|
||||
uint32_t chunkType = getU16(currentMovieOffset + 2);
|
||||
chunkSize = getU32(currentMovieOffset + 4);
|
||||
const uint16_t STREAM0 = 0x3030;
|
||||
const uint16_t TYPEDC = 0x6364;
|
||||
|
||||
if (streamNo == STREAM0 && chunkType == TYPEDC && chunkSize > 0)
|
||||
{
|
||||
// Found next frame
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//skip back to first frame
|
||||
frameNumber = 1;
|
||||
currentMovieOffset = firstFrameOffset; //start over
|
||||
return false;
|
||||
}
|
||||
|
||||
void SoftwareMJPEGDecoder::setVideoData(const uint8_t* movie, const uint32_t length)
|
||||
{
|
||||
movieData = movie;
|
||||
movieLength = length;
|
||||
reader = 0; //not using reader
|
||||
|
||||
readVideoHeader();
|
||||
}
|
||||
|
||||
void SoftwareMJPEGDecoder::setVideoData(touchgfx::VideoDataReader& reader)
|
||||
{
|
||||
this->reader = &reader;
|
||||
movieData = 0;
|
||||
movieLength = reader.getDataLength();
|
||||
|
||||
readVideoHeader();
|
||||
}
|
||||
|
||||
bool SoftwareMJPEGDecoder::hasVideo()
|
||||
{
|
||||
return (reader != 0) || (movieData != 0);
|
||||
}
|
||||
|
||||
void SoftwareMJPEGDecoder::readVideoHeader()
|
||||
{
|
||||
// Start from the start
|
||||
currentMovieOffset = 0;
|
||||
lastError = AVI_NO_ERROR;
|
||||
|
||||
// Make header available in buffer
|
||||
readData(0, 72);
|
||||
|
||||
// Decode the movie header to find first frame
|
||||
// Must be RIFF file
|
||||
if (compare(currentMovieOffset, "RIFF", 4))
|
||||
{
|
||||
lastError = AVI_ERROR_NOT_RIFF;
|
||||
assert(!"RIFF header not found");
|
||||
}
|
||||
|
||||
//skip fourcc and length
|
||||
currentMovieOffset += 8;
|
||||
if (compare(currentMovieOffset, "AVI ", 4))
|
||||
{
|
||||
lastError = AVI_ERROR_AVI_HEADER_NOT_FOUND;
|
||||
assert(!"AVI header not found");
|
||||
}
|
||||
|
||||
currentMovieOffset += 4;
|
||||
if (compare(currentMovieOffset, "LIST", 4))
|
||||
{
|
||||
lastError = AVI_ERROR_AVI_LIST_NOT_FOUND;
|
||||
assert(!"AVI LIST not found");
|
||||
}
|
||||
|
||||
//save AVI List info
|
||||
const uint32_t aviListSize = getU32(currentMovieOffset + 4);
|
||||
const uint32_t aviListOffset = currentMovieOffset;
|
||||
assert(aviListSize);
|
||||
|
||||
//look into header to find frame rate
|
||||
bool foundFrame = true;
|
||||
uint32_t offset = currentMovieOffset + 8;
|
||||
if (compare(offset, "hdrl", 4))
|
||||
{
|
||||
lastError = AVI_ERROR_AVI_HDRL_NOT_FOUND;
|
||||
foundFrame = false;
|
||||
}
|
||||
|
||||
offset += 4;
|
||||
if (compare(offset, "avih", 4))
|
||||
{
|
||||
lastError = AVI_ERROR_AVI_AVIH_NOT_FOUND;
|
||||
foundFrame = false;
|
||||
}
|
||||
|
||||
if (foundFrame)
|
||||
{
|
||||
offset += 8; //skip fourcc and cb in AVIMAINHEADER
|
||||
videoInfo.ms_between_frames = getU32(offset) / 1000;
|
||||
videoInfo.number_of_frames = getU32(offset + 16);
|
||||
videoInfo.frame_width = getU32(offset + 32);
|
||||
videoInfo.frame_height = getU32(offset + 36);
|
||||
}
|
||||
//skip rest of AVI header, start from end of AVI List
|
||||
|
||||
//look for list with 'movi' header
|
||||
uint32_t listOffset = aviListOffset + aviListSize + 8;
|
||||
readData(listOffset, 12);
|
||||
while (compare(listOffset + 8, "movi", 4) && (lastError == AVI_NO_ERROR) && listOffset < movieLength)
|
||||
{
|
||||
const uint32_t listSize = getU32(listOffset + 4) + 8;
|
||||
listOffset += listSize;
|
||||
readData(listOffset, 12);
|
||||
}
|
||||
|
||||
if (lastError != AVI_NO_ERROR)
|
||||
{
|
||||
lastError = AVI_ERROR_MOVI_NOT_FOUND;
|
||||
return;
|
||||
}
|
||||
|
||||
//save first frame and end of last frame
|
||||
currentMovieOffset = listOffset + 8 + 4; //skip LIST and 'movi'
|
||||
lastFrameEnd = listOffset + 8 + getU32(listOffset + 4);
|
||||
|
||||
//find idx
|
||||
const uint32_t listSize = getU32(listOffset + 4) + 8;
|
||||
listOffset += listSize;
|
||||
readData(listOffset, 4);
|
||||
if (!compare(listOffset, "idx1", 4))
|
||||
{
|
||||
indexOffset = listOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastError = AVI_ERROR_IDX1_NOT_FOUND;
|
||||
return;
|
||||
}
|
||||
|
||||
//start on first frame
|
||||
frameNumber = 1; //next frame number is 1
|
||||
firstFrameOffset = currentMovieOffset;
|
||||
}
|
||||
|
||||
#if VIDEO_DECODE_FORMAT == 16 || VIDEO_DECODE_FORMAT == 24 || VIDEO_DECODE_FORMAT == 32
|
||||
void SoftwareMJPEGDecoder::decodeMJPEGFrame(const uint8_t* const mjpgdata, const uint32_t length, uint8_t* outputBuffer, uint16_t bufferWidth, uint16_t bufferHeight, uint32_t bufferStride)
|
||||
{
|
||||
if (length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (outputBuffer && lineBuffer) //only decode if buffers are assigned.
|
||||
{
|
||||
/* This struct contains the JPEG decompression parameters */
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
/* This struct represents a JPEG error handler */
|
||||
struct jpeg_error_mgr jerr;
|
||||
|
||||
JSAMPROW lines[2] = { lineBuffer, 0 }; /* Output row buffer */
|
||||
|
||||
/* Step 1: allocate and initialize JPEG decompression object */
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
|
||||
/* Initialize the JPEG decompression object */
|
||||
jpeg_create_decompress(&cinfo);
|
||||
|
||||
//jpeg_stdio_src (&cinfo, file);
|
||||
jpeg_mem_src(&cinfo, const_cast<uint8_t*>(mjpgdata), length);
|
||||
|
||||
/* Step 3: read image parameters with jpeg_read_header() */
|
||||
jpeg_read_header(&cinfo, TRUE);
|
||||
|
||||
/* Step 4: set parameters for decompression */
|
||||
cinfo.dct_method = JDCT_FLOAT;
|
||||
|
||||
/* Step 5: start decompressor */
|
||||
jpeg_start_decompress(&cinfo);
|
||||
|
||||
//restrict to minimum of movie and output buffer size
|
||||
const uint32_t width = MIN(bufferWidth, cinfo.image_width);
|
||||
const uint32_t height = MIN(bufferHeight, cinfo.output_height);
|
||||
|
||||
#if VIDEO_DECODE_FORMAT == 16
|
||||
uint16_t* lineptr = reinterpret_cast<uint16_t*>(outputBuffer);
|
||||
#elif VIDEO_DECODE_FORMAT == 24
|
||||
uint8_t* lineptr = outputBuffer;
|
||||
#else
|
||||
uint32_t* lineptr = reinterpret_cast<uint32_t*>(outputBuffer);
|
||||
#endif
|
||||
while (cinfo.output_scanline < height)
|
||||
{
|
||||
(void)jpeg_read_scanlines(&cinfo, lines, 1);
|
||||
#if VIDEO_DECODE_FORMAT == 16
|
||||
JPEG_RGB* RGB_matrix = (JPEG_RGB*)lineBuffer;
|
||||
JPEG_RGB* const RGB_end = RGB_matrix + width;
|
||||
while (RGB_matrix < RGB_end)
|
||||
{
|
||||
const uint16_t pix = ((RGB_matrix->R & 0xF8) << 8) | ((RGB_matrix->G & 0xFC) << 3) | ((RGB_matrix->B & 0xF8) >> 3);
|
||||
*lineptr++ = pix;
|
||||
RGB_matrix++;
|
||||
}
|
||||
lineptr = (uint16_t*)((uint8_t*)lineptr + bufferStride - width * 2); //move to next line
|
||||
#elif VIDEO_DECODE_FORMAT == 24
|
||||
memcpy(lineptr, lineBuffer, width * 3);
|
||||
lineptr += bufferStride; //move to next line
|
||||
#else
|
||||
JPEG_RGB* RGB_matrix = (JPEG_RGB*)lineBuffer;
|
||||
JPEG_RGB* const RGB_end = RGB_matrix + width;
|
||||
while (RGB_matrix < RGB_end)
|
||||
{
|
||||
const uint32_t pix = (0xFF << 24) | (RGB_matrix->R << 16) | (RGB_matrix->G << 8) | (RGB_matrix->B);
|
||||
*lineptr++ = pix;
|
||||
RGB_matrix++;
|
||||
}
|
||||
lineptr = (uint32_t*)((uint8_t*)lineptr + bufferStride - width * 4); //move to next line
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SIMULATOR
|
||||
cinfo.output_scanline = cinfo.output_height;
|
||||
#endif
|
||||
/* Step 6: Finish decompression */
|
||||
jpeg_finish_decompress(&cinfo);
|
||||
|
||||
/* Step 7: Release JPEG decompression object */
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
}
|
||||
}
|
||||
|
||||
bool SoftwareMJPEGDecoder::decodeFrame(const touchgfx::Rect& area, uint8_t* frameBuffer, uint32_t framebuffer_width)
|
||||
{
|
||||
// Assuming that chunk is available and streamNo and chunkType is correct.
|
||||
// Check by gotoNextFrame
|
||||
|
||||
readData(currentMovieOffset, 8);
|
||||
const uint32_t length = getU32(currentMovieOffset + 4);
|
||||
|
||||
// Ensure whole frame is read
|
||||
const uint8_t* mjpgdata = readData(currentMovieOffset + 8, length);
|
||||
|
||||
assert(lineBuffer && "LineBuffer must be assigned prior to decoding directly to framebuffer");
|
||||
|
||||
/* This struct contains the JPEG decompression parameters */
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
/* This struct represents a JPEG error handler */
|
||||
struct jpeg_error_mgr jerr;
|
||||
|
||||
JSAMPROW lines[2] = { lineBuffer, 0 }; /* Output row buffer */
|
||||
|
||||
/* Step 1: allocate and initialize JPEG decompression object */
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
|
||||
/* Initialize the JPEG decompression object */
|
||||
jpeg_create_decompress(&cinfo);
|
||||
|
||||
//jpeg_stdio_src (&cinfo, file);
|
||||
jpeg_mem_src(&cinfo, const_cast<uint8_t*>(mjpgdata), length);
|
||||
|
||||
/* Step 3: read image parameters with jpeg_read_header() */
|
||||
jpeg_read_header(&cinfo, TRUE);
|
||||
|
||||
/* Step 4: set parameters for decompression */
|
||||
cinfo.dct_method = JDCT_FLOAT;
|
||||
|
||||
/* Step 5: start decompressor */
|
||||
jpeg_start_decompress(&cinfo);
|
||||
|
||||
//restrict to minimum of movie and output buffer size
|
||||
const uint32_t startY = area.y;
|
||||
|
||||
//scan down to startY
|
||||
while (cinfo.output_scanline < startY)
|
||||
{
|
||||
(void)jpeg_read_scanlines(&cinfo, lines, 1);
|
||||
}
|
||||
|
||||
const uint32_t startX = area.x;
|
||||
const uint32_t endX = MIN((uint32_t)area.right(), cinfo.image_width);
|
||||
|
||||
#if VIDEO_DECODE_FORMAT == 16
|
||||
uint16_t* lineptr = reinterpret_cast<uint16_t*>(frameBuffer);
|
||||
lineptr += framebuffer_width * startY;
|
||||
#elif VIDEO_DECODE_FORMAT == 24
|
||||
uint8_t* lineptr = frameBuffer;
|
||||
lineptr += framebuffer_width * 3 * startY;
|
||||
#else
|
||||
uint32_t* lineptr = reinterpret_cast<uint32_t*>(frameBuffer);
|
||||
lineptr += framebuffer_width * startY;
|
||||
#endif
|
||||
const uint32_t endY = MIN((uint32_t)area.bottom(), cinfo.output_height);
|
||||
|
||||
//scan relevant part
|
||||
while (cinfo.output_scanline < endY)
|
||||
{
|
||||
(void)jpeg_read_scanlines(&cinfo, lines, 1);
|
||||
#if VIDEO_DECODE_FORMAT == 16
|
||||
JPEG_RGB* RGB_matrix = (JPEG_RGB*)lineBuffer;
|
||||
//loop row RGB888->RGB565 for required line part
|
||||
for (uint32_t counter = startX; counter < endX; counter++)
|
||||
{
|
||||
const uint16_t pix = ((RGB_matrix[counter].R & 0xF8) << 8) | ((RGB_matrix[counter].G & 0xFC) << 3) | ((RGB_matrix[counter].B & 0xF8) >> 3);
|
||||
*(lineptr + counter) = pix;
|
||||
}
|
||||
lineptr += framebuffer_width; //move to next line
|
||||
#elif VIDEO_DECODE_FORMAT == 24
|
||||
memcpy(lineptr + startX * 3, lineBuffer + startX * 3, (endX - startX) * 3);
|
||||
lineptr += framebuffer_width * 3; //move to next line
|
||||
#else
|
||||
memcpy(lineptr + startX, lineBuffer + startX * 4, (endX - startX) * 4);
|
||||
lineptr += framebuffer_width; //move to next line
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SIMULATOR
|
||||
cinfo.output_scanline = cinfo.output_height;
|
||||
#endif
|
||||
|
||||
/* Step 6: Finish decompression */
|
||||
jpeg_finish_decompress(&cinfo);
|
||||
|
||||
/* Step 7: Release JPEG decompression object */
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
void SoftwareMJPEGDecoder::decodeMJPEGFrame(const uint8_t* const, const uint32_t, uint8_t*, uint16_t, uint16_t, uint32_t)
|
||||
{
|
||||
}
|
||||
bool SoftwareMJPEGDecoder::decodeFrame(const touchgfx::Rect&, uint8_t*, uint32_t)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif // VIDEO_DECODE_FORMAT == 16 || VIDEO_DECODE_FORMAT == 24 || VIDEO_DECODE_FORMAT == 32
|
||||
|
||||
bool SoftwareMJPEGDecoder::decodeThumbnail(uint32_t frameno, uint8_t* buffer, uint16_t width, uint16_t height)
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
void SoftwareMJPEGDecoder::gotoFrame(uint32_t frameNumber)
|
||||
{
|
||||
if (frameNumber == 0)
|
||||
{
|
||||
frameNumber = 1;
|
||||
}
|
||||
|
||||
if (frameNumber > getNumberOfFrames())
|
||||
{
|
||||
frameNumber = getNumberOfFrames();
|
||||
}
|
||||
|
||||
uint32_t offset = indexOffset + 8 + (frameNumber - 1) * 16;
|
||||
|
||||
readData(offset, 16);
|
||||
|
||||
currentMovieOffset = getU32(offset + 8) + firstFrameOffset - 4;
|
||||
this->frameNumber = frameNumber;
|
||||
}
|
||||
|
||||
uint32_t SoftwareMJPEGDecoder::getNumberOfFrames()
|
||||
{
|
||||
return videoInfo.number_of_frames;
|
||||
}
|
||||
|
||||
void SoftwareMJPEGDecoder::getVideoInfo(touchgfx::VideoInformation* data)
|
||||
{
|
||||
*data = videoInfo;
|
||||
// For unsupported decode formats, set video dimension to 0x0, to avoid drawing anything
|
||||
#if VIDEO_DECODE_FORMAT == 16 || VIDEO_DECODE_FORMAT == 24 || VIDEO_DECODE_FORMAT == 32
|
||||
#else
|
||||
data->frame_width = 0;
|
||||
data->frame_height = 0;
|
||||
#endif
|
||||
}
|
||||
BIN
TouchGFX/generated/simulator/touchgfx.ico
Normal file
BIN
TouchGFX/generated/simulator/touchgfx.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 375 KiB |
1
TouchGFX/generated/simulator/touchgfx.rc
Normal file
1
TouchGFX/generated/simulator/touchgfx.rc
Normal file
@ -0,0 +1 @@
|
||||
id ICON touchgfx.ico
|
||||
BIN
TouchGFX/generated/simulator/touchgfx.res
Normal file
BIN
TouchGFX/generated/simulator/touchgfx.res
Normal file
Binary file not shown.
1
TouchGFX/generated/texts/cache/LanguageCpp_Gb.cache
vendored
Normal file
1
TouchGFX/generated/texts/cache/LanguageCpp_Gb.cache
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"remap":"yes","language":"GB","language_index":0,"indices":[["0","T___SINGLEUSE_6GPV"]]}
|
||||
1
TouchGFX/generated/texts/cache/TextKeysAndLanguages.cache
vendored
Normal file
1
TouchGFX/generated/texts/cache/TextKeysAndLanguages.cache
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"languages":["GB"],"textids":["T___SINGLEUSE_6GPV"]}
|
||||
1
TouchGFX/generated/texts/cache/TextsCpp.cache
vendored
Normal file
1
TouchGFX/generated/texts/cache/TextsCpp.cache
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"remap":"yes","languages":["Gb"],"characters":[70,97,83,84,84,85,66,101,0]}
|
||||
1
TouchGFX/generated/texts/cache/TypedTextDatabaseCpp.cache
vendored
Normal file
1
TouchGFX/generated/texts/cache/TypedTextDatabaseCpp.cache
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"databases":{"DEFAULT":[[0,"LEFT","LTR"]]},"database_list":["DEFAULT"],"fonts":{"getFont_verdana_20_4bpp":0,"getFont_verdana_40_4bpp":1,"getFont_verdana_10_4bpp":2},"generate_font_format":"0"}
|
||||
0
TouchGFX/generated/texts/cache/compile_time.cache
vendored
Normal file
0
TouchGFX/generated/texts/cache/compile_time.cache
vendored
Normal file
1
TouchGFX/generated/texts/cache/options.cache
vendored
Normal file
1
TouchGFX/generated/texts/cache/options.cache
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"remap":"yes","autohint":"default","data_format":"A4","binary_translations":"no","binary_fonts":"no","font_format":"0","framebuffer_bpp":"BPP16"}
|
||||
@ -0,0 +1,19 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#ifndef TOUCHGFX_TEXTKEYSANDLANGUAGES_HPP
|
||||
#define TOUCHGFX_TEXTKEYSANDLANGUAGES_HPP
|
||||
|
||||
enum LANGUAGES
|
||||
{
|
||||
GB,
|
||||
NUMBER_OF_LANGUAGES
|
||||
};
|
||||
|
||||
enum TEXTS
|
||||
{
|
||||
T___SINGLEUSE_6GPV,
|
||||
NUMBER_OF_TEXT_KEYS
|
||||
};
|
||||
|
||||
#endif // TOUCHGFX_TEXTKEYSANDLANGUAGES_HPP
|
||||
21
TouchGFX/generated/texts/include/texts/TypedTextDatabase.hpp
Normal file
21
TouchGFX/generated/texts/include/texts/TypedTextDatabase.hpp
Normal file
@ -0,0 +1,21 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#ifndef TOUCHGFX_TYPEDTEXTDATABASE_HPP
|
||||
#define TOUCHGFX_TYPEDTEXTDATABASE_HPP
|
||||
|
||||
#include <touchgfx/hal/Types.hpp>
|
||||
#include <touchgfx/TypedText.hpp>
|
||||
|
||||
namespace TypedTextDatabase
|
||||
{
|
||||
class TypedTextData;
|
||||
const touchgfx::TypedText::TypedTextData* getInstance(touchgfx::LanguageId id);
|
||||
const touchgfx::TypedText::TypedTextData* getInstance();
|
||||
const touchgfx::Font** getFonts();
|
||||
const touchgfx::Font* setFont(touchgfx::FontId fontId, const touchgfx::Font*);
|
||||
void resetFont(touchgfx::FontId fontId);
|
||||
uint16_t getInstanceSize();
|
||||
} // namespace TypedTextDatabase
|
||||
|
||||
#endif // TOUCHGFX_TYPEDTEXTDATABASE_HPP
|
||||
14
TouchGFX/generated/texts/src/LanguageGb.cpp
Normal file
14
TouchGFX/generated/texts/src/LanguageGb.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <touchgfx/Unicode.hpp>
|
||||
|
||||
TEXT_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const uint32_t indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE;
|
||||
|
||||
// Remap all strings
|
||||
TEXT_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const uint32_t indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE = {
|
||||
0 // T___SINGLEUSE_6GPV: "FaSTTUBe"
|
||||
};
|
||||
125
TouchGFX/generated/texts/src/Texts.cpp
Normal file
125
TouchGFX/generated/texts/src/Texts.cpp
Normal file
@ -0,0 +1,125 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <touchgfx/TextProvider.hpp>
|
||||
#include <touchgfx/Texts.hpp>
|
||||
#include <touchgfx/TypedText.hpp>
|
||||
#include <touchgfx/Unicode.hpp>
|
||||
#include <touchgfx/hal/HAL.hpp>
|
||||
#include <touchgfx/lcd/LCD.hpp>
|
||||
#include <texts/TypedTextDatabase.hpp>
|
||||
|
||||
uint16_t touchgfx::Font::getStringWidth(const touchgfx::Unicode::UnicodeChar* text, ...) const
|
||||
{
|
||||
va_list pArg;
|
||||
va_start(pArg, text);
|
||||
uint16_t width = getStringWidthLTR(TEXT_DIRECTION_LTR, text, pArg);
|
||||
va_end(pArg);
|
||||
return width;
|
||||
}
|
||||
|
||||
uint16_t touchgfx::Font::getStringWidth(touchgfx::TextDirection textDirection, const touchgfx::Unicode::UnicodeChar* text, ...) const
|
||||
{
|
||||
va_list pArg;
|
||||
va_start(pArg, text);
|
||||
uint16_t width = getStringWidthLTR(textDirection, text, pArg);
|
||||
va_end(pArg);
|
||||
return width;
|
||||
}
|
||||
|
||||
touchgfx::Unicode::UnicodeChar touchgfx::TextProvider::getNextLigature(TextDirection direction)
|
||||
{
|
||||
if (fontGsubTable && nextCharacters.peekChar())
|
||||
{
|
||||
substituteGlyphs();
|
||||
if (nextCharacters.peekChar(1) == 0x093F) // Hindi I-matra
|
||||
{
|
||||
nextCharacters.replaceAt1(nextCharacters.peekChar());
|
||||
nextCharacters.replaceAt0(0x093F);
|
||||
}
|
||||
}
|
||||
return getNextChar();
|
||||
}
|
||||
|
||||
void touchgfx::TextProvider::initializeInternal()
|
||||
{
|
||||
fillInputBuffer();
|
||||
}
|
||||
|
||||
void touchgfx::LCD::drawString(touchgfx::Rect widgetArea, const touchgfx::Rect& invalidatedArea, const touchgfx::LCD::StringVisuals& stringVisuals, const touchgfx::Unicode::UnicodeChar* format, ...)
|
||||
{
|
||||
va_list pArg;
|
||||
va_start(pArg, format);
|
||||
drawStringLTR(widgetArea, invalidatedArea, stringVisuals, format, pArg);
|
||||
va_end(pArg);
|
||||
}
|
||||
|
||||
// Default TypedTextDatabase
|
||||
extern const touchgfx::TypedText::TypedTextData* const typedTextDatabaseArray[];
|
||||
|
||||
TEXT_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const touchgfx::Unicode::UnicodeChar texts_all_languages[] TEXT_LOCATION_FLASH_ATTRIBUTE = {
|
||||
0x46, 0x61, 0x53, 0x54, 0x54, 0x55, 0x42, 0x65, 0x0 // @0 "FaSTTUBe"
|
||||
};
|
||||
|
||||
TEXT_LOCATION_FLASH_PRAGMA
|
||||
KEEP extern const uint32_t indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE;
|
||||
|
||||
// Array holding dynamically installed languages
|
||||
struct TranslationHeader
|
||||
{
|
||||
uint32_t offset_to_texts;
|
||||
uint32_t offset_to_indices;
|
||||
uint32_t offset_to_typedtext;
|
||||
};
|
||||
static const TranslationHeader* languagesArray[1] = { 0 };
|
||||
|
||||
// Compiled and linked in languages
|
||||
static const uint32_t* const staticLanguageIndices[] = {
|
||||
indicesGb
|
||||
};
|
||||
|
||||
touchgfx::LanguageId touchgfx::Texts::currentLanguage = static_cast<touchgfx::LanguageId>(0);
|
||||
static const touchgfx::Unicode::UnicodeChar* currentLanguagePtr = 0;
|
||||
static const uint32_t* currentLanguageIndices = 0;
|
||||
|
||||
void touchgfx::Texts::setLanguage(touchgfx::LanguageId id)
|
||||
{
|
||||
const touchgfx::TypedText::TypedTextData* currentLanguageTypedText = 0;
|
||||
if (id < 1)
|
||||
{
|
||||
if (languagesArray[id] != 0)
|
||||
{
|
||||
// Dynamic translation is added
|
||||
const TranslationHeader* translation = languagesArray[id];
|
||||
currentLanguagePtr = (const touchgfx::Unicode::UnicodeChar*)(((const uint8_t*)translation) + translation->offset_to_texts);
|
||||
currentLanguageIndices = (const uint32_t*)(((const uint8_t*)translation) + translation->offset_to_indices);
|
||||
currentLanguageTypedText = (const touchgfx::TypedText::TypedTextData*)(((const uint8_t*)translation) + translation->offset_to_typedtext);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Compiled and linked in languages
|
||||
currentLanguagePtr = texts_all_languages;
|
||||
currentLanguageIndices = staticLanguageIndices[id];
|
||||
currentLanguageTypedText = typedTextDatabaseArray[id];
|
||||
}
|
||||
}
|
||||
|
||||
if (currentLanguageTypedText)
|
||||
{
|
||||
currentLanguage = id;
|
||||
touchgfx::TypedText::registerTypedTextDatabase(currentLanguageTypedText,
|
||||
TypedTextDatabase::getFonts(), TypedTextDatabase::getInstanceSize());
|
||||
}
|
||||
}
|
||||
|
||||
void touchgfx::Texts::setTranslation(touchgfx::LanguageId id, const void* translation)
|
||||
{
|
||||
languagesArray[id] = (const TranslationHeader*)translation;
|
||||
}
|
||||
|
||||
const touchgfx::Unicode::UnicodeChar* touchgfx::Texts::getText(TypedTextId id) const
|
||||
{
|
||||
return ¤tLanguagePtr[currentLanguageIndices[id]];
|
||||
}
|
||||
70
TouchGFX/generated/texts/src/TypedTextDatabase.cpp
Normal file
70
TouchGFX/generated/texts/src/TypedTextDatabase.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
/* DO NOT EDIT THIS FILE */
|
||||
/* This file is autogenerated by the text-database code generator */
|
||||
|
||||
#include <touchgfx/TypedText.hpp>
|
||||
#include <fonts/GeneratedFont.hpp>
|
||||
#include <texts/TypedTextDatabase.hpp>
|
||||
|
||||
extern touchgfx::GeneratedFont& getFont_verdana_20_4bpp();
|
||||
extern touchgfx::GeneratedFont& getFont_verdana_40_4bpp();
|
||||
extern touchgfx::GeneratedFont& getFont_verdana_10_4bpp();
|
||||
|
||||
const touchgfx::Font* touchgfx_fonts[] = {
|
||||
&(getFont_verdana_20_4bpp()),
|
||||
&(getFont_verdana_40_4bpp()),
|
||||
&(getFont_verdana_10_4bpp())
|
||||
};
|
||||
|
||||
extern const touchgfx::TypedText::TypedTextData typedText_database_DEFAULT[];
|
||||
extern const touchgfx::TypedText::TypedTextData* const typedTextDatabaseArray[];
|
||||
|
||||
TEXT_LOCATION_FLASH_PRAGMA
|
||||
const touchgfx::TypedText::TypedTextData typedText_database_DEFAULT[] TEXT_LOCATION_FLASH_ATTRIBUTE = {
|
||||
{ 0, touchgfx::LEFT, touchgfx::TEXT_DIRECTION_LTR }
|
||||
};
|
||||
|
||||
TEXT_LOCATION_FLASH_PRAGMA
|
||||
const touchgfx::TypedText::TypedTextData* const typedTextDatabaseArray[] TEXT_LOCATION_FLASH_ATTRIBUTE = {
|
||||
typedText_database_DEFAULT
|
||||
};
|
||||
|
||||
namespace TypedTextDatabase
|
||||
{
|
||||
const touchgfx::TypedText::TypedTextData* getInstance(touchgfx::LanguageId id)
|
||||
{
|
||||
return typedTextDatabaseArray[id];
|
||||
}
|
||||
|
||||
uint16_t getInstanceSize()
|
||||
{
|
||||
return sizeof(typedText_database_DEFAULT) / sizeof(touchgfx::TypedText::TypedTextData);
|
||||
}
|
||||
|
||||
const touchgfx::Font** getFonts()
|
||||
{
|
||||
return touchgfx_fonts;
|
||||
}
|
||||
|
||||
const touchgfx::Font* setFont(touchgfx::FontId fontId, const touchgfx::Font* font)
|
||||
{
|
||||
const touchgfx::Font* old = touchgfx_fonts[fontId];
|
||||
touchgfx_fonts[fontId] = font;
|
||||
return old;
|
||||
}
|
||||
|
||||
void resetFont(touchgfx::FontId fontId)
|
||||
{
|
||||
switch (fontId)
|
||||
{
|
||||
case 0:
|
||||
touchgfx_fonts[0] = &(getFont_verdana_20_4bpp());
|
||||
break;
|
||||
case 1:
|
||||
touchgfx_fonts[1] = &(getFont_verdana_40_4bpp());
|
||||
break;
|
||||
case 2:
|
||||
touchgfx_fonts[2] = &(getFont_verdana_10_4bpp());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // namespace TypedTextDatabase
|
||||
3
TouchGFX/generated/user.config
Normal file
3
TouchGFX/generated/user.config
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"touchgfx_installation_path" : "C:/TouchGFX/4.21.2"
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
// Generated by videoconvert. Please, do not edit!
|
||||
|
||||
#ifndef TOUCHGFX_VIDEODATABASE_HPP
|
||||
#define TOUCHGFX_VIDEODATABASE_HPP
|
||||
|
||||
#include <touchgfx/hal/Types.hpp>
|
||||
|
||||
#endif // TOUCHGFX_VIDEODATABASE_HPP
|
||||
Reference in New Issue
Block a user