Vuo  1.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Typedefs | Functions | Variables
VuoImageText.cc File Reference

Description

VuoImageText implementation.

Classes

class  VuoFontClass
 A wrapper for VuoFont, so it can be used as a std::map key. More...
 

Typedefs

typedef std::pair< std::string,
std::pair< VuoFontClass,
double > > 
VuoImageTextCacheDescriptor
 Text, font, and backingScaleFactor.
 
typedef std::pair< VuoImage,
double > 
VuoImageTextCacheEntry
 An image and the last time it was used.
 
typedef std::map
< VuoImageTextCacheDescriptor,
VuoImageTextCacheEntry
VuoImageTextCacheType
 A pool of images.
 

Functions

bool operator< (const VuoFontClass &a, const VuoFontClass &b)
 Returns true if a is less than b.
 
static void VuoImageTextCache_cleanup (void *blah)
 Purges expired images from the cache.
 
static void VuoImageTextCache_init (void)
 Initializes the cache.
 
static void VuoImageTextCache_fini (void)
 Destroys the cache.
 
static CFArrayRef VuoImageText_createCTLines (VuoText text, VuoFont font, float backingScaleFactor, CTFontRef *ctFont, CGColorRef *cgColor, CGColorSpaceRef *colorspace, unsigned int *width, unsigned int *height, double *lineHeight, CGRect *bounds, CGRect **lineBounds)
 Formats the specified text for rendering using font and backingScaleFactor.
 
VuoRectangle VuoImage_getTextRectangle (VuoText text, VuoFont font)
 Returns a rectangle (in points) that fully encloses the specified text when rendered with the specified font.
 
VuoImage VuoImage_makeText (VuoText text, VuoFont font, float backingScaleFactor)
 Creates an image containing the specified text.
 

Variables

static VuoImageTextCacheTypeVuoImageTextCache
 A pool of images.
 
static dispatch_semaphore_t VuoImageTextCache_semaphore
 Serializes access to VuoImageTextCache.
 
static dispatch_semaphore_t VuoImageTextCache_canceledAndCompleted
 Signals when the last VuoImageTextCache cleanup has completed.
 
static dispatch_source_t VuoImageTextCache_timer
 Periodically cleans up VuoImageTextCache.
 
static double VuoImageTextCache_timeout = 1.0
 Seconds an image can remain in the cache unused, before it gets purged.
 

Typedef Documentation

typedef std::pair<std::string, std::pair<VuoFontClass,double> > VuoImageTextCacheDescriptor

Text, font, and backingScaleFactor.

typedef std::pair<VuoImage,double> VuoImageTextCacheEntry

An image and the last time it was used.

A pool of images.

Function Documentation

bool operator< ( const VuoFontClass a,
const VuoFontClass b 
)

Returns true if a is less than b.

VuoRectangle VuoImage_getTextRectangle ( VuoText  text,
VuoFont  font 
)

Returns a rectangle (in points) that fully encloses the specified text when rendered with the specified font.

Depending on the font's design (e.g., if the font is monospace), the rectangle may be larger than the actual glyphs.

VuoImage VuoImage_makeText ( VuoText  text,
VuoFont  font,
float  backingScaleFactor 
)

Creates an image containing the specified text.

static CFArrayRef VuoImageText_createCTLines ( VuoText  text,
VuoFont  font,
float  backingScaleFactor,
CTFontRef *  ctFont,
CGColorRef *  cgColor,
CGColorSpaceRef *  colorspace,
unsigned int *  width,
unsigned int *  height,
double *  lineHeight,
CGRect *  bounds,
CGRect **  lineBounds 
)
static

Formats the specified text for rendering using font and backingScaleFactor.

static void VuoImageTextCache_cleanup ( void *  blah)
static

Purges expired images from the cache.

static void VuoImageTextCache_fini ( void  )
static

Destroys the cache.

static void VuoImageTextCache_init ( void  )
static

Initializes the cache.

Variable Documentation

VuoImageTextCacheType* VuoImageTextCache
static

A pool of images.

dispatch_semaphore_t VuoImageTextCache_canceledAndCompleted
static

Signals when the last VuoImageTextCache cleanup has completed.

dispatch_semaphore_t VuoImageTextCache_semaphore
static

Serializes access to VuoImageTextCache.

double VuoImageTextCache_timeout = 1.0
static

Seconds an image can remain in the cache unused, before it gets purged.

dispatch_source_t VuoImageTextCache_timer
static

Periodically cleans up VuoImageTextCache.