int error = RenderText(APTR handle, STRPTR str, int count, int encoding,
struct hwRenderTextCtrl *pt, struct hwMatrix2D *m, struct
hwTextLayout *tl, struct hwTagList *tags);
str using the font passed in handle.
Note that str is not null-terminated. Instead, the string's length in bytes is
passed in the count parameter. The encoding parameter specifies the character
encoding of the string. This will be either HWOS_ENCODING_UTF8 or HWOS_ENCODING_ISO8859_1.
If the plugin hasn't set the HWFONTFLAGS_LAYOUT flag for the font in its LoadFont()
implementation, the string passed in str will never contain any line breaks. Handling line
breaks is only necessary if your plugin has requested to do its own layouting by setting the
HWFONTFLAGS_LAYOUT flag in LoadFont().
The drawing target is passed to RenderText() in the pt parameter. This is a
pointer to a struct hwRenderTextCtrl describing a drawing target.
struct hwRenderTextCtrl looks like this:
struct hwRenderTextCtrl
{
int X; [in]
int Y; [in]
int Width; [in]
int Height; [in]
APTR RGBData; [in]
int RGBModulo; [in]
UBYTE *AlphaData; [in]
int AlphaModulo; [in]
UBYTE *MaskData; [in]
int MaskModulo; [in]
UBYTE *CLUTData; [in]
int CLUTModulo; [in]
int PixelFormat; [in]
int BytesPerPixel; [in]
};
|
Here is a description of the individual structure members:
X:
Y:
Width:
Height:
RGBData:PixelFormat member. Please note that
even if PixelFormat specifies a 32-bit format with alpha channel, you must never draw
any alpha channel pixels to RGBData because Hollywood always stores the alpha channel
separately in order to be compatible with 15-bit and 16-bit screenmodes. See Bitmap information for details.
You always need to draw the alpha channel pixels to the buffer passed in AlphaData
instead.
RGBModulo:RGBData is non-NULL, this will contain the number of pixels in a single row in
the RGBData buffer. This can be more than returned in Width because Hollywood might
choose to allocate some padding bytes for optimized blitting. Note that the value
returned in RGBModulo is specified in pixels, not in bytes.
AlphaData:
RGBData and the alpha channel pixels to the buffer passed in
AlphaData.
AlphaData.
In all other cases AlphaData will be NULL.
AlphaModulo:AlphaData is non-NULL, this member will be set to the number of pixels stored in
one row of the AlphaData array. This can be more than what is returned in the Width
member because Hollywood might use padding bytes for optimized blitting.
MaskData:MaskData will be set to a buffer you need to draw to. Otherwise it is set to
NULL. The data you write to this buffer is interpreted as a monochrome bitmap where
set bits indicate visible pixels and cleared bits indicate invisible pixels. The bits
are stored from left to right in chunks of one byte, i.e. the most significant bit of
the first byte describes the state of the first pixel.
MaskModulo:MaskData is non-NULL, this member will be set to the number of bytes that is
used for one row of mask data. Note that this value is specified in bytes and often
contains some padding.
CLUTData:NULL. Note that pixels will always be stored as 8 bits per pixel,
even if the font palette's depth is less than 8.
CLUTModulo:CLUTData is non-NULL, this will be set to the number of pixels per row. This can
be more than what is returned in the Width member because Hollywood might use padding
bytes for optimized blitting.
PixelFormat:RGBData member. See Pixel format information for details.
BytesPerPixel:RGBData array.
The m parameter may be set to a pointer to a 2D transformation matrix that should
be applied to the text before drawing. If can also be NULL which means the identity
matrix should be used. Note that m will only ever be set if the font is a vector
font and if the plugin has requested to do its own layouting by setting the
HWFONTFLAGS_LAYOUT flag in LoadFont().
The tl parameter contains a pointer to a struct hwTextLayout. This
structure contains detailed information about the text layout. Most of the
structure members are only initialized for fonts that have requested to do
their own layouting by setting the HWFONTFLAGS_LAYOUT flag in LoadFont().
The only structure members that are supported for fonts that haven't set
HWFONTFLAGS_LAYOUT are CharSpacing and Style but the only style flag that
can be set for fonts that haven't set HWFONTFLAGS_LAYOUT is HWFONTSTYLE_ANTIALIAS.
struct hwTextLayout looks like this:
struct hwTextLayout
{
ULONG Color; [in]
ULONG Style; [in]
int Align; [in]
int WrapWidth; [in]
int LineSpacing; [in]
int CharSpacing; [in]
int Indent; [in]
int AdvanceX; [out]
int AdvanceY; [out]
int *Tabs; [in]
int TabCount; [in]
};
|
Here is a description of the individual structure members:
Color:
Style:
HWFONTSTYLE_ANTIALIAS:
HWFONTSTYLE_BOLD:
HWFONTSTYLE_ITALIC:
HWFONTSTYLE_UNDERLINED:
Align:
HWTEXTALIGN_LEFT:
HWTEXTALIGN_RIGHT:
HWTEXTALIGN_CENTER:
HWTEXTALIGN_JUSTIFIED:
WrapWidth:
LineSpacing:
CharSpacing:
Indent:
AdvanceX:
AdvanceY:
Tabs:Tabs array is indicated by the TabCount member (see below).
Note that this can also be NULL.
TabCount:Tab member (see above).
struct hwRenderTextCtrl containing information about the drawing targetNULLstruct hwTextLayout that contains layout informationNULL