VuoImageText interface.
Definition in file VuoImageText.h.
Go to the source code of this file.
Typedefs | |
typedef struct _VuoImageTextData * | VuoImageTextData |
Placement info about text when rendered to an image. More... | |
Functions | |
VuoImageTextData | VuoImageTextData_make () |
Initialize a new instance of VuoImageTextData. More... | |
void | VuoImageTextData_free (void *data) |
Free a VuoImageTextData pointer and it's contents. More... | |
void | VuoImageTextData_convertToVuoCoordinates (VuoImageTextData textData, VuoReal screenWidthInPixels, VuoReal backingScaleFactor) |
Convert VuoImageTextData from pixel coordinates to Vuo coordinates in place. More... | |
VuoPoint2d | VuoImageTextData_getPositionForLineIndex (VuoImageTextData textData, unsigned int lineIndex) |
Get the origin point of a line of text (bottom left point of first character billboard in line). More... | |
VuoPoint2d | VuoImageTextData_getPositionForCharIndex (VuoImageTextData textData, unsigned int charIndex, unsigned int *lineIndex) |
Get the starting point for a character index (bottom left corner). More... | |
int | VuoImageTextData_getNearestCharToPoint (VuoImageTextData textData, VuoPoint2d point) |
Return the character index (0 indexed) nearest to point, where point is relative to the pivot point of a text layer. More... | |
VuoRectangle * | VuoImageTextData_getRectsForHighlight (VuoImageTextData textData, unsigned int selectionStartIndex, unsigned int selectionLength, unsigned int *lineCount) |
Given a start index and length of selected characters return an array of VuoRectangles encompassing the selection. More... | |
VuoRectangle | VuoImageTextData_layoutRowAtIndex (VuoImageTextData textData, unsigned int index, unsigned int *charactersRemaining) |
Get a rect that contains a row of text starting at index. More... | |
unsigned int | VuoImageTextData_getCharIndexForLine (VuoImageTextData textData, unsigned int lineIndex) |
Get the index of the first character at line index. More... | |
VuoReal | VuoImageText_getLineHeight (VuoFont font, VuoReal screenWidthInPixels, VuoReal backingScaleFactor) |
Get the line height of a font in Vuo coordinates. More... | |
VuoReal | VuoImageText_getVerticalScale (VuoReal screenWidth, VuoReal screenBackingScaleFactor) |
Get the vertical scaling used for text. More... | |
VuoImageTextData | VuoImage_getTextImageData (VuoText text, VuoFont font, VuoReal backingScaleFactor, VuoReal verticalScale, VuoReal rotation, bool includeTrailingWhiteSpace) |
Returns a struct containing all information necessary to calculate text and character size and placement when rendered. More... | |
VuoRectangle | VuoImage_getTextRectangle (VuoText text, VuoFont font, VuoReal backingScaleFactor, VuoReal verticalScale, VuoReal rotation, float wrapWidth, bool includeTrailingWhiteSpace) |
Returns a rectangle (in points) that fully encloses the specified text when rendered with the specified font . More... | |
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. More... | |
VuoImage | VuoImage_makeText (VuoText text, VuoFont font, float backingScaleFactor, float verticalScale, float rotation, float wrapWidth, VuoPoint2d *outCorners) |
Creates an image containing the specified text. More... | |
typedef struct _VuoImageTextData * VuoImageTextData |
Placement info about text when rendered to an image.
transformedBounds
, transformedCorners
, lineWidthsExcludingTrailingWhitespace
, lineXOrigins
, billboardAnchor
. VuoImageTextData VuoImage_getTextImageData | ( | VuoText | text, |
VuoFont | font, | ||
VuoReal | backingScaleFactor, | ||
VuoReal | verticalScale, | ||
VuoReal | rotation, | ||
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.
backingScaleFactor
, verticalScale
, rotation
arguments. Definition at line 426 of file VuoImageText.cc.
VuoRectangle VuoImage_getTextRectangle | ( | VuoText | text, |
VuoFont | font, | ||
VuoReal | backingScaleFactor, | ||
VuoReal | verticalScale, | ||
VuoReal | rotation, | ||
float | wrapWidth, | ||
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.
backingScaleFactor
, verticalScale
, rotation
, wrapWidth
arguments. Definition at line 405 of file VuoImageText.cc.
VuoImage VuoImage_makeText | ( | VuoText | text, |
VuoFont | font, | ||
float | backingScaleFactor, | ||
float | verticalScale, | ||
float | rotation, | ||
float | wrapWidth, | ||
VuoPoint2d * | outCorners | ||
) |
Creates an image containing the specified text.
If outCorners
is not null, this function fills it with the text's 4 transformed bounds in pixels relative to the top-left of the image.
verticalScale
, rotation
, wrapwidth
, outCorners
arguments. Definition at line 752 of file VuoImageText.cc.
VuoReal VuoImageText_getLineHeight | ( | VuoFont | font, |
VuoReal | screenWidthInPixels, | ||
VuoReal | backingScaleFactor | ||
) |
Get the line height of a font in Vuo coordinates.
Useful in cases where no text data is available (ie, you should prefer using textData->lineHeight where available).
Definition at line 471 of file VuoImageText.cc.
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.
Definition at line 449 of file VuoImageText.cc.
Get the vertical scaling used for text.
Definition at line 223 of file VuoImageText.cc.
void VuoImageTextData_convertToVuoCoordinates | ( | VuoImageTextData | textData, |
VuoReal | screenWidthInPixels, | ||
VuoReal | backingScaleFactor | ||
) |
Convert VuoImageTextData from pixel coordinates to Vuo coordinates in place.
Definition at line 497 of file VuoImageText.cc.
void VuoImageTextData_free | ( | void * | data | ) |
Free a VuoImageTextData pointer and it's contents.
Definition at line 102 of file VuoImageText.cc.
unsigned int VuoImageTextData_getCharIndexForLine | ( | VuoImageTextData | textData, |
unsigned int | lineIndex | ||
) |
Get the index of the first character at line index.
Definition at line 661 of file VuoImageText.cc.
int VuoImageTextData_getNearestCharToPoint | ( | VuoImageTextData | textData, |
VuoPoint2d | point | ||
) |
Return the character index (0 indexed) nearest to point, where point is relative to the pivot point of a text layer.
Definition at line 687 of file VuoImageText.cc.
VuoPoint2d VuoImageTextData_getPositionForCharIndex | ( | VuoImageTextData | textData, |
unsigned int | charIndex, | ||
unsigned int * | lineIndex | ||
) |
Get the starting point for a character index (bottom left corner).
Definition at line 589 of file VuoImageText.cc.
VuoPoint2d VuoImageTextData_getPositionForLineIndex | ( | VuoImageTextData | textData, |
unsigned int | lineIndex | ||
) |
Get the origin point of a line of text (bottom left point of first character billboard in line).
Definition at line 532 of file VuoImageText.cc.
VuoRectangle* VuoImageTextData_getRectsForHighlight | ( | VuoImageTextData | textData, |
unsigned int | selectionStartIndex, | ||
unsigned int | selectionLength, | ||
unsigned int * | lineCount | ||
) |
Given a start index and length of selected characters return an array of VuoRectangles encompassing the selection.
Definition at line 612 of file VuoImageText.cc.
VuoRectangle VuoImageTextData_layoutRowAtIndex | ( | VuoImageTextData | textData, |
unsigned int | index, | ||
unsigned int * | charactersRemaining | ||
) |
Get a rect that contains a row of text starting at index.
The number of characters from index to line end is stored in length.
Definition at line 674 of file VuoImageText.cc.
VuoImageTextData VuoImageTextData_make | ( | ) |
Initialize a new instance of VuoImageTextData.
Definition at line 87 of file VuoImageText.cc.