AJA NTV2 SDK  17.1.3.1410
NTV2 SDK 17.1.3.1410
CNTV2CaptionRenderer Class Reference

#include <ntv2captionrenderer.h>

Public Member Functions

virtual bool Open (void)
 Opens me, and prepares me using my current pixel format and CC Font settings. More...
 
virtual bool Close (void)
 Closes me, releasing my resources. Once closed, I can no longer be used to render characters. More...
 
virtual bool IsOpen (void) const
 Answers true if I'm currently open. More...
 
virtual NTV2PixelFormat GetPixelFormat (void) const
 Returns the frame buffer format that I'm currently "open" for. More...
 
virtual UWord GetGlyphWidthInBytes (void) const
 
virtual UWord GetGlyphWidthInPixels (void) const
 
virtual UWord GetGlyphHeightInLines (void) const
 
virtual UWord GlyphDotHeightToRasterLines (const UWord inVHeightInGlyphDots) const
 Returns the equivalent number of horizontal raster pixels that correspond to the given number of glyph dots. More...
 
virtual UWord GlyphDotWidthToRasterPixels (const UWord inHWidthInGlyphDots) const
 Returns the equivalent number of horizontal raster pixels that correspond to the given number of glyph dots. More...
 
virtual bool GetCharacterRasterOrigin (const UWord in608CaptionRow, const UWord in608CaptionCol, UWord &outVertLineOffset, UWord &outHorzPixelOffset) const
 Returns the raster position of the top-left corner of a given CEA-608 caption row and column. More...
 
virtual const UByteGetPreloadedGlyphsRasterAddress (const NTV2Line21Attrs &inAttrs) const
 Returns a const pointer to the raster that contains the preloaded glyph renderings for the given attribute. More...
 
virtual bool GetGlyphsRaster (NTV2Buffer &outBuffer, const NTV2Line21Attrs &inAttrs) const
 Returns a copy of the glyphs bitmap raster pixel data for the given attribute. More...
 
virtual NTV2FormatDescriptor GetFormatDescriptor (void) const
 
virtual ULWord GetPreloadedGlyphsRasterRowBytes (void) const
 
virtual UWord GetPreloadedGlyphsRasterHeightInLines (void) const
 
virtual UWord GetPreloadedGlyphsRasterWidthInPixels (void) const
 
virtual ULWord GetTotalBytes (void) const
 
virtual ULWord GetNumActivePreloadedGlyphsRasters (void) const
 
virtual ULWordSequence GetActivePreloadedGlyphsRastersAttributes (void) const
 
virtual std::ostream & Print (std::ostream &inOutStream, const bool inIncludeActives=false) const
 Emits my human-readable representation into the given output stream. More...
 
virtual ~CNTV2CaptionRenderer ()
 My destructor. More...
 

Static Public Member Functions

static CNTV2CaptionRendererPtr GetRenderer (const NTV2FormatDesc &inFBDescriptor, const bool inAutoOpen=true)
 Returns the CNTV2CaptionRenderer instance using the given video frame buffer format descriptor, creating the cache if necessary. More...
 
static bool FlushGlyphCaches (void)
 Flushes all extant glyph caches. More...
 
static bool BurnChar (const UByte inCharCode, const NTV2Line21Attrs &inAttribs, NTV2Buffer &inFB, const NTV2FormatDesc &inFD, const UWord inXPos, const UWord inYPos)
 Blits the given 608/ASCII-ish character into a specified position in the given host buffer using the given attributes. More...
 
static bool BurnString (const std::string &inString, const NTV2Line21Attrs &inAttribs, NTV2Buffer &inFB, const NTV2FormatDesc &inFBDescriptor, const UWord inRowNum=15, const UWord inColumnNum=1)
 Blits the contents of the given UTF-8 encoded string into the given host buffer using the given display attributes and starting position, overwriting any existing "on-air" captions. More...
 
static bool BurnStringAtXY (const std::string &inString, const NTV2Line21Attrs &inAttribs, NTV2Buffer &inFB, const NTV2FormatDesc &inFBDescriptor, const UWord inXPos, const UWord inYPos)
 Blits the contents of the given UTF-8 encoded string into the given host buffer using the given display attributes and starting position. More...
 

Detailed Description

Definition at line 31 of file ntv2captionrenderer.h.

Constructor & Destructor Documentation

◆ ~CNTV2CaptionRenderer()

virtual CNTV2CaptionRenderer::~CNTV2CaptionRenderer ( )
virtual

My destructor.

Member Function Documentation

◆ BurnChar()

static bool CNTV2CaptionRenderer::BurnChar ( const UByte  inCharCode,
const NTV2Line21Attrs inAttribs,
NTV2Buffer inFB,
const NTV2FormatDesc inFD,
const UWord  inXPos,
const UWord  inYPos 
)
static

Blits the given 608/ASCII-ish character into a specified position in the given host buffer using the given attributes.

Parameters
[in]inCharCodeSpecifies the character code to be blitted.
[in]inAttribsSpecifies the desired display attributes (FG color, BG color, italics, etc.).
inFBSpecifies the host frame buffer to be blitted into.
[in]inFDDescribes the host frame buffer raster and pixel format.
[in]inXPosSpecifies the horizontal raster offset to the left edge of the character to be blitted, in pixels.
[in]inYPosSpecifies the vertical raster offset to the top edge of the character to be blitted, in lines.
Returns
True if successful; otherwise false.

◆ BurnString()

static bool CNTV2CaptionRenderer::BurnString ( const std::string &  inString,
const NTV2Line21Attrs inAttribs,
NTV2Buffer inFB,
const NTV2FormatDesc inFBDescriptor,
const UWord  inRowNum = 15,
const UWord  inColumnNum = 1 
)
static

Blits the contents of the given UTF-8 encoded string into the given host buffer using the given display attributes and starting position, overwriting any existing "on-air" captions.

Parameters
[in]inStringSpecifies the UTF-8 encoded string to be blitted into the video buffer. Unicode codepoints that aren't supported by the caption font in use will be rendered as a "full block".
[in]inAttribsSpecifies the display attributes of the rendered characters.
inFBSpecifies the host frame buffer to be blitted into.
[in]inFBDescriptorDescribes the host frame buffer raster and pixel format.
[in]inRowNumSpecifies the row number at which character rendering will begin. The value will be clamped such that it is between 1 and 15 (inclusive). Defaults to 15, the bottom-most row position.
[in]inColumnNumSpecifies the column number at which character rendering will begin. The value will be clamped such that it is between 1 and 32 (inclusive). Defaults to 1, the left-most column position.
Returns
True if successful; otherwise False.
Note
Wrapping and scrolling is not performed. If the string's length exceeds the rightmost screen column, the rightmost character position will continue to be overwritten until the last character from the string remains there.

◆ BurnStringAtXY()

static bool CNTV2CaptionRenderer::BurnStringAtXY ( const std::string &  inString,
const NTV2Line21Attrs inAttribs,
NTV2Buffer inFB,
const NTV2FormatDesc inFBDescriptor,
const UWord  inXPos,
const UWord  inYPos 
)
static

Blits the contents of the given UTF-8 encoded string into the given host buffer using the given display attributes and starting position.

Parameters
[in]inStringSpecifies the UTF-8 encoded string to be blitted into the host buffer. Unicode codepoints that aren't supported by the caption font in use will be rendered as a "full block".
[in]inAttribsSpecifies the display attributes of the rendered characters.
inFBSpecifies the host frame buffer to be blitted into.
[in]inFBDescriptorDescribes the host frame buffer raster and pixel format.
[in]inXPosSpecifies the horizontal pixel offset at which character blitting will begin.
[in]inYPosSpecifies the vertical pixel offset at which character blitting will begin.
Returns
True if successful; otherwise False.
Note
Wrapping and scrolling is not performed. Anything past the raster's right-hand and/or bottom edge(s) will be clipped.

◆ Close()

virtual bool CNTV2CaptionRenderer::Close ( void  )
virtual

Closes me, releasing my resources. Once closed, I can no longer be used to render characters.

Returns
True if successful; otherwise false.
Note
It is not an error to call this function when I'm already closed.

◆ FlushGlyphCaches()

static bool CNTV2CaptionRenderer::FlushGlyphCaches ( void  )
static

Flushes all extant glyph caches.

◆ GetActivePreloadedGlyphsRastersAttributes()

virtual ULWordSequence CNTV2CaptionRenderer::GetActivePreloadedGlyphsRastersAttributes ( void  ) const
virtual
Returns
A list of NTV2Line21Attributes of each of my active, pre-loaded glyph renderings.

◆ GetCharacterRasterOrigin()

virtual bool CNTV2CaptionRenderer::GetCharacterRasterOrigin ( const UWord  in608CaptionRow,
const UWord  in608CaptionCol,
UWord outVertLineOffset,
UWord outHorzPixelOffset 
) const
virtual

Returns the raster position of the top-left corner of a given CEA-608 caption row and column.

Parameters
[in]in608CaptionRowSpecifies the CEA-608 caption row, which must be between 1 and 15.
[in]in608CaptionColSpecifies the CEA-608 caption column, which must be between 1 and 32.
[out]outVertLineOffsetReceives the raster line offset from the top raster edge that corresponds to the top edge of the given caption row. Receives zero if the function fails.
[out]outHorzPixelOffsetReceives the raster pixel offset from the left raster edge that corresponds to the left edge of the given caption column. Receives zero if the function fails.
Returns
True if successful; otherwise false.

◆ GetFormatDescriptor()

virtual NTV2FormatDescriptor CNTV2CaptionRenderer::GetFormatDescriptor ( void  ) const
virtual
Returns
A format descriptor of the glyphs bitmap raster.

◆ GetGlyphHeightInLines()

virtual UWord CNTV2CaptionRenderer::GetGlyphHeightInLines ( void  ) const
inlinevirtual
Returns
The height, in lines, of any of my rendered glyphs.

Definition at line 157 of file ntv2captionrenderer.h.

◆ GetGlyphsRaster()

virtual bool CNTV2CaptionRenderer::GetGlyphsRaster ( NTV2Buffer outBuffer,
const NTV2Line21Attrs inAttrs 
) const
virtual

Returns a copy of the glyphs bitmap raster pixel data for the given attribute.

Parameters
[out]outBufferReceives the copy of the glyphs bitmap raster pixel data.
[in]inAttrsSpecifies the desired character display attributes.
Returns
True if successful; otherwise false upon failure.

◆ GetGlyphWidthInBytes()

virtual UWord CNTV2CaptionRenderer::GetGlyphWidthInBytes ( void  ) const
inlinevirtual
Returns
The width of my rendered glyphs as a byte count.

Definition at line 147 of file ntv2captionrenderer.h.

◆ GetGlyphWidthInPixels()

virtual UWord CNTV2CaptionRenderer::GetGlyphWidthInPixels ( void  ) const
inlinevirtual
Returns
The width, in pixels, of any of my rendered glyphs.

Definition at line 152 of file ntv2captionrenderer.h.

◆ GetNumActivePreloadedGlyphsRasters()

virtual ULWord CNTV2CaptionRenderer::GetNumActivePreloadedGlyphsRasters ( void  ) const
inlinevirtual
Returns
The number of active, pre-loaded glyph renderings.

Definition at line 231 of file ntv2captionrenderer.h.

◆ GetPixelFormat()

virtual NTV2PixelFormat CNTV2CaptionRenderer::GetPixelFormat ( void  ) const
inlinevirtual

Returns the frame buffer format that I'm currently "open" for.

Returns
The frame buffer format that I'm currently "open" for.

Definition at line 142 of file ntv2captionrenderer.h.

◆ GetPreloadedGlyphsRasterAddress()

virtual const UByte* CNTV2CaptionRenderer::GetPreloadedGlyphsRasterAddress ( const NTV2Line21Attrs inAttrs) const
virtual

Returns a const pointer to the raster that contains the preloaded glyph renderings for the given attribute.

Parameters
[in]inAttrsSpecifies the desired display attributes.
Returns
A valid, non-NULL const pointer to the specified glyph family's raster image; or NULL if failed.
Note
This can be a time-consuming function call, as it causes all CCFont glyphs to be rendered with the given attributes for my current pixel format and frame dimensions.

◆ GetPreloadedGlyphsRasterHeightInLines()

virtual UWord CNTV2CaptionRenderer::GetPreloadedGlyphsRasterHeightInLines ( void  ) const
inlinevirtual
Returns
The height, in lines, of the raster that contains the preloaded glyph renderings.

Definition at line 216 of file ntv2captionrenderer.h.

◆ GetPreloadedGlyphsRasterRowBytes()

virtual ULWord CNTV2CaptionRenderer::GetPreloadedGlyphsRasterRowBytes ( void  ) const
inlinevirtual
Returns
The number of bytes per row in the raster that contains the preloaded glyph renderings.

Definition at line 211 of file ntv2captionrenderer.h.

◆ GetPreloadedGlyphsRasterWidthInPixels()

virtual UWord CNTV2CaptionRenderer::GetPreloadedGlyphsRasterWidthInPixels ( void  ) const
inlinevirtual
Returns
The width, in pixels, of the raster that contains the preloaded glyph renderings.

Definition at line 221 of file ntv2captionrenderer.h.

◆ GetRenderer()

static CNTV2CaptionRendererPtr CNTV2CaptionRenderer::GetRenderer ( const NTV2FormatDesc inFBDescriptor,
const bool  inAutoOpen = true 
)
static

Returns the CNTV2CaptionRenderer instance using the given video frame buffer format descriptor, creating the cache if necessary.

Parameters
[in]inFBDescriptorDescribes the video frame buffer.
[in]inAutoOpenIf true, and the cache needed to be created, it's automatically opened.
Returns
The cache instance.

◆ GetTotalBytes()

virtual ULWord CNTV2CaptionRenderer::GetTotalBytes ( void  ) const
inlinevirtual
Returns
The total memory consumed by my preloaded glyph renderings, in bytes.

Definition at line 226 of file ntv2captionrenderer.h.

◆ GlyphDotHeightToRasterLines()

virtual UWord CNTV2CaptionRenderer::GlyphDotHeightToRasterLines ( const UWord  inVHeightInGlyphDots) const
inlinevirtual

Returns the equivalent number of horizontal raster pixels that correspond to the given number of glyph dots.

Parameters
[in]inVHeightInGlyphDotsSpecifies the height to be scaled, in glyph dots.
Returns
The number of horizontal raster pixels that are equivalent to the given number of glyph dots.

Definition at line 164 of file ntv2captionrenderer.h.

◆ GlyphDotWidthToRasterPixels()

virtual UWord CNTV2CaptionRenderer::GlyphDotWidthToRasterPixels ( const UWord  inHWidthInGlyphDots) const
inlinevirtual

Returns the equivalent number of horizontal raster pixels that correspond to the given number of glyph dots.

Parameters
[in]inHWidthInGlyphDotsSpecifies the width to be scaled, in glyph dots.
Returns
The number of horizontal raster pixels that are equivalent to the given number of glyph dots.

Definition at line 171 of file ntv2captionrenderer.h.

◆ IsOpen()

virtual bool CNTV2CaptionRenderer::IsOpen ( void  ) const
inlinevirtual

Answers true if I'm currently open.

Returns
True if I'm currently open and able to render characters; otherwise false.

Definition at line 136 of file ntv2captionrenderer.h.

◆ Open()

virtual bool CNTV2CaptionRenderer::Open ( void  )
virtual

Opens me, and prepares me using my current pixel format and CC Font settings.

Returns
True if successful; otherwise false.
Note
Calling this when I'm already open will close and re-open me with the new format.

◆ Print()

virtual std::ostream& CNTV2CaptionRenderer::Print ( std::ostream &  inOutStream,
const bool  inIncludeActives = false 
) const
virtual

Emits my human-readable representation into the given output stream.

Parameters
[in]inOutStreamThe output stream that is to receive my human-readable representation.
Returns
The output stream that was used.

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