Vuo
1.2.4
|
VuoImageText implementation.
Classes | |
class | VuoFontClass |
A wrapper for VuoFont, so it can be used as a std::map key. More... | |
Macros | |
#define | ScreenToGL(x) (((x * backingScaleFactor) / screenWidthInPixels) * 2.) |
Shortcut macro for converting to GL coordinates in VuoImageTextData_convertToVuoCoordinates function. | |
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 . | |
VuoImageTextData | VuoImageTextData_make () |
Initialize a new instance of VuoImageTextData. | |
void | VuoImageTextData_free (void *data) |
Free a VuoImageTextData pointer and it's contents. | |
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, bool includeTrailingWhiteSpace, CTFontRef *ctFont, CGColorRef *cgColor, CGColorSpaceRef *colorspace, VuoImageTextData textImageData) |
Formats the specified text for rendering using font and backingScaleFactor . | |
VuoRectangle | VuoImage_getTextRectangle (VuoText text, VuoFont font, bool includeTrailingWhiteSpace) |
Returns a rectangle (in points) that fully encloses the specified text when rendered with the specified font . | |
VuoImageTextData | VuoImage_getTextImageData (VuoText text, VuoFont font, bool includeTrailingWhiteSpace) |
Returns a struct containing all information necessary to calculate text and character size and placement when rendered. | |
VuoPoint2d | VuoImageText_getTextSize (VuoText text, VuoFont font, VuoPoint2d windowSize, VuoReal backingScaleFactor, bool includeTrailingWhiteSpace) |
Outputs the size in Vuo coordinates of a real-size text layer. | |
void | VuoImageTextData_convertToVuoCoordinates (VuoImageTextData textData, VuoReal screenWidthInPixels, VuoReal backingScaleFactor) |
Convert VuoImageTextData from pixel coordinates to Vuo coordinates in place. | |
VuoPoint2d | VuoImageTextData_getOriginForLineIndex (VuoImageTextData textData, unsigned int lineIndex) |
Get the origin point of a line of text. | |
VuoPoint2d | VuoImageTextData_getPositionForCharIndex (VuoImageTextData textData, unsigned int charIndex) |
Get the starting point for a character index (bottom left corner). | |
int | VuoImageTextData_getNearestCharToPoint (VuoImageTextData textData, VuoPoint2d point) |
Return the character index nearest to point (0 indexed). | |
VuoImage | VuoImage_makeText (VuoText text, VuoFont font, float backingScaleFactor) |
Creates an image containing the specified text. | |
Variables | |
static VuoImageTextCacheType * | VuoImageTextCache |
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. | |
#define ScreenToGL | ( | x | ) | (((x * backingScaleFactor) / screenWidthInPixels) * 2.) |
Shortcut macro for converting to GL coordinates in VuoImageTextData_convertToVuoCoordinates function.
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.
bool operator< | ( | const VuoFontClass & | a, |
const VuoFontClass & | b | ||
) |
Returns true if a
is less than b
.
VuoImageTextData VuoImage_getTextImageData | ( | VuoText | text, |
VuoFont | font, | ||
bool | includeTrailingWhiteSpace | ||
) |
Returns a struct containing all information necessary to calculate text and character size and placement when rendered.
If text is null or empty, null is returned.
VuoRectangle VuoImage_getTextRectangle | ( | VuoText | text, |
VuoFont | font, | ||
bool | includeTrailingWhiteSpace | ||
) |
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.
Creates an image containing the specified text.
|
static |
Formats the specified text
for rendering using font
and backingScaleFactor
.
VuoPoint2d VuoImageText_getTextSize | ( | VuoText | text, |
VuoFont | font, | ||
VuoPoint2d | windowSize, | ||
VuoReal | backingScaleFactor, | ||
bool | includeTrailingWhiteSpace | ||
) |
Outputs the size in Vuo coordinates of a real-size text layer.
windowSize is in points.
|
static |
Purges expired images from the cache.
|
static |
Destroys the cache.
|
static |
Initializes the cache.
void VuoImageTextData_convertToVuoCoordinates | ( | VuoImageTextData | textData, |
VuoReal | screenWidthInPixels, | ||
VuoReal | backingScaleFactor | ||
) |
Convert VuoImageTextData from pixel coordinates to Vuo coordinates in place.
void VuoImageTextData_free | ( | void * | data | ) |
Free a VuoImageTextData pointer and it's contents.
int VuoImageTextData_getNearestCharToPoint | ( | VuoImageTextData | textData, |
VuoPoint2d | point | ||
) |
Return the character index nearest to point (0 indexed).
VuoPoint2d VuoImageTextData_getOriginForLineIndex | ( | VuoImageTextData | textData, |
unsigned int | lineIndex | ||
) |
Get the origin point of a line of text.
VuoPoint2d VuoImageTextData_getPositionForCharIndex | ( | VuoImageTextData | textData, |
unsigned int | charIndex | ||
) |
Get the starting point for a character index (bottom left corner).
VuoImageTextData VuoImageTextData_make | ( | ) |
Initialize a new instance of VuoImageTextData.
|
static |
A pool of images.
|
static |
Signals when the last VuoImageTextCache cleanup has completed.
|
static |
Serializes access to VuoImageTextCache.
|
static |
Seconds an image can remain in the cache unused, before it gets purged.
|
static |
Periodically cleans up VuoImageTextCache.