AddTextSample
The AddTextSample function adds a single block of styled text to an existing media.
pascal ComponentResult AddTextSample (MediaHandler mh, Ptr text,
unsigned long size,
short fontNum,
short fontSize,
Style textFace,
RGBColor *textColor,
RGBColor *backColor,
short textJustification,
Rect *textBox,
long displayFlags,
TimeValue scrollDelay,
short hiliteStart,
short hiliteEnd,
RGBColor *rgbHiliteColor,
TimeValue duration,
TimeValue *sampleTime);
mh
- Specifies the media handler for the text media obtained by the
GetMediaHandler function.
text
- Contains a pointer to a block of text.
size
- Indicates the size of the text block (in bytes).
fontNum
- Indicates the number for the font in which to display the text.
fontSize
- Indicates the size of the font.
textFace
- Indicates the typeface or style of the text (that is, bold, italic, and so on).
textColor
- Contains a pointer to an RGB color structure specifying the color of the text.
backColor
- Contains a pointer to an RGB color structure specifying the text background color.
textJustification
- Indicates the justification of the text. The following constants are available:
teFlushDefault, teCenter, teFlushRight, or teFlushLeft. See Inside Macintosh: Text for details on these constants and on text alignment.
textBox
- Contains a pointer to the box within which the text is to be displayed. The box is relative to the track bounds.
displayFlags
- Contains the text display flags.
dfDontDisplay
- Does not display the specified sample.
dfDontAutoScale
-
Does not scale the text if the track bounds increase.
dfClipToTextBox
- Clips to just the text box. (This is useful if the text overlays the video.)
dfShrinkTextBoxToFit
-
Recalculates size of the textBox parameter to just fit the given text and stores this rectangle with the text data.
dfScrollIn
-
Scrolls the text in until the last of the text is in view. This flag is associated with the scrollDelay parameter.
dfScrollOut
- Scrolls text out until the last of the text is out of view. This flag is associated with the
scrollDelay parameter. If both dfScrollIn and dfScrollOut are set, the text is scrolled in, then out.
dfHorizScroll
- Scrolls a single line of text horizontally. If the
dfHorizScroll flag is not set, then the scrolling is vertical.
dfReverseScroll
- If set, scrolls vertically down, rather than up. If not set, horizontal scrolling proceeds toward the left rather than toward the right.
scrollDelay
-
Indicates the delay in scrolling associated with setting the dfScrollIn and dfScrollOut display flags. If the value of the scrollDelay parameter is greater than 0 and the dfScrollIn flag is set, the text pauses when it has scrolled all the way in for the amount of time specified by scrollDelay. If the dfScrollOut flag is set, the pause occurs first before the text scrolls out. If both these flags are set, the pause occurs at the midpoint between scrolling in and scrolling out.
hiliteStart
-
Specifies the beginning of the text to be highlited.
hiliteEnd
- Specifies the end of the text to be highlighted. If the
hiliteEnd parameter is greater than the hiliteStart parameter, then the text is highlighted from the selection specified by hiliteStart to hiliteEnd. To specify additional highlighting, you can use the AddHiliteSample function, described on page 2-279.
rgbHiliteColor
- Contains a pointer to the RGB color for highlighting. If this parameter is not
nil, then the specified color is used when highlighting the text indicated by the hiliteStart and hiliteEnd parameters. Otherwise, the default system highlighting is used.
duration
- Specifies how long the text sample should last. This duration is expressed in the media's time base.
sampleTime
-
Contains a pointer to a TimeValue structure. The actual media time at which the sample was added is returned here.
ERROR CODES
| invalidMedia | -2008 | This media is corrupted or invalid |
File Manager errors
Memory Manager errors