Graphics::GlyphObject Class Referenceabstract

A character glyph image. More...

#include <Object.h>

Inheritance diagram for Graphics::GlyphObject:
Collaboration diagram for Graphics::GlyphObject:

Public Types

using Bits = std::bitset< 64 >
 
using Options = TextOptions
 
using Metrics = GlyphMetrics
 
- Public Types inherited from Graphics::Object
enum class  Kind { XX }
 
using List = LinkedObjectListTemplate< Object >
 
using OwnedList = OwnedLinkedObjectListTemplate< Object >
 
- Public Types inherited from LinkedObjectTemplate< Object >
using Iterator = IteratorTemplate< Object, Object *, Object & >
 
using ConstIterator = IteratorTemplate< const Object, const Object *, const Object & >
 

Public Member Functions

 GlyphObject (const Metrics &metrics, const Options &options)
 
Kind kind () const
 
PixelFormat getPixelFormat () const override
 Get native pixel format. More...
 
size_t readPixels (const Location &loc, PixelFormat format, void *buffer, uint16_t width) const override
 Read pixels in requested format. More...
 
virtual Bits getBits (uint16_t row) const =0
 
virtual void readAlpha (void *buffer, Point origin, size_t stride) const =0
 Obtain glyph information as block of 8-bit alpha values. More...
 
const MetricsgetMetrics () const
 
- Public Member Functions inherited from Graphics::ImageObject
 ImageObject (Size size)
 
void write (MetaWriter &meta) const override
 
RenderercreateRenderer (const Location &location) const override
 Create a software renderer for this object. More...
 
Size getSize () const
 
uint16_t width () const
 
uint16_t height () const
 
virtual bool init ()=0
 Initialise the object, e.g. parse header content and obtain dimensions. More...
 
- Public Member Functions inherited from Graphics::ObjectTemplate< Object::Kind::Image >
Kind kind () const override
 
- Public Member Functions inherited from Graphics::Object
bool operator== (const Object &other) const
 
virtual String getTypeStr () const
 
- Public Member Functions inherited from LinkedObjectTemplate< Object >
Object * getNext () const
 
bool insertAfter (Object *object)
 
Iterator begin () const
 
Iterator end () const
 
Iterator cbegin () const
 
Iterator cend () const
 
- Public Member Functions inherited from LinkedObject
virtual ~LinkedObject ()
 
virtual LinkedObjectnext () const
 
bool insertAfter (LinkedObject *object)
 
bool operator== (const LinkedObject &other) const
 
bool operator!= (const LinkedObject &other) const
 

Protected Attributes

Metrics metrics
 
Options options
 
- Protected Attributes inherited from Graphics::ImageObject
Size imageSize {}
 

Detailed Description

A character glyph image.

Characters are accessed like regular images but there are some specialisations which may be necessary which this class exposes:

  • To support devices with custom renderers we require access to the raw monochrome bits
  • Images currently don't support transparency, although this could be enabled using a flag bits in the PackedColor format. The display driver or renderer would then need to interpret this flag and render accordingly. An alternative method is to nominate a transparent colour.

Member Typedef Documentation

◆ Bits

using Graphics::GlyphObject::Bits = std::bitset<64>

◆ Metrics

◆ Options

Constructor & Destructor Documentation

◆ GlyphObject()

Graphics::GlyphObject::GlyphObject ( const Metrics metrics,
const Options options 
)
inline

Member Function Documentation

◆ getBits()

virtual Bits Graphics::GlyphObject::getBits ( uint16_t  row) const
pure virtual

Implemented in Graphics::LcdGlyph.

◆ getMetrics()

const Metrics& Graphics::GlyphObject::getMetrics ( ) const
inline

◆ getPixelFormat()

PixelFormat Graphics::GlyphObject::getPixelFormat ( ) const
inlineoverridevirtual

Get native pixel format.

Return values
PixelFormatReturn None if ambivalent about format (e.g. calculated pixel data)

Implements Graphics::ImageObject.

◆ kind()

Kind Graphics::GlyphObject::kind ( ) const
inlinevirtual

Implements Graphics::Object.

◆ readAlpha()

virtual void Graphics::GlyphObject::readAlpha ( void *  buffer,
Point  origin,
size_t  stride 
) const
pure virtual

Obtain glyph information as block of 8-bit alpha values.

Parameters
buffer
originLocation of cursor within buffer
strideNumber of bytes per row in buffer

This method is called with a positive origin to accommodate negative x/y glyph offsets. Italic and script typefaces do this a lot!

Implemented in Graphics::LcdGlyph.

◆ readPixels()

size_t Graphics::GlyphObject::readPixels ( const Location loc,
PixelFormat  format,
void *  buffer,
uint16_t  width 
) const
overridevirtual

Read pixels in requested format.

Parameters
locStart position
formatRequired pixel format
bufferBuffer for pixels
widthNumber of pixels to read
Return values
size_tNumber of bytes written

Implements Graphics::ImageObject.

Member Data Documentation

◆ metrics

Metrics Graphics::GlyphObject::metrics
protected

◆ options

Options Graphics::GlyphObject::options
mutableprotected

The documentation for this class was generated from the following file: