public final class WZTextManager extends Object implements WZRenderAPI.VideoFrameRenderer
Modifier and Type | Class and Description |
---|---|
static class |
WZTextManager.Font |
Modifier and Type | Field and Description |
---|---|
static int |
SCALE_BASIS_BASE_SIZE
scale the text as a factor of the original text size
|
static int |
SCALE_BASIS_CURRENT_SIZE
scale the text as a factor of the current, scaled text size
|
static int |
SCALE_BASIS_FRAME_HEIGHT
scale the text as a factor of the video frame height.
|
static int |
SCALE_BASIS_FRAME_WIDTH
scale the text as a factor of the video frame width.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all text objects
|
WZText |
createTextObject(UUID fontId)
Create a new, empty text object to be drawn using the font with the specified id
|
WZText |
createTextObject(UUID fontId,
String text)
Create a new text object using the specified string to be drawn using the font with the specified id
|
WZText |
createTextObject(UUID fontId,
String text,
float r,
float g,
float b)
Create a new text object using the specified font, text string, and color
|
WZText |
createTextObject(UUID fontId,
String text,
float r,
float g,
float b,
float a)
Create a new text object using the specified font, text string, and color
|
WZText |
createTextObject(UUID fontId,
String text,
WZColor color)
Create a new text object using the specified font, text string, and color
|
WZTextManager.Font |
getFontById(UUID fontId)
Returns the font for the specified id
|
static WZTextManager |
getInstance()
Use this method to access the GoCoder SDK Text Manager
|
void |
init(Context context)
Initialize the text manager by providing the application context.
|
boolean |
isTextVisible()
Indicates if text object rendering is enabled or not
|
boolean |
isWZVideoFrameRendererActive()
Indicates if the frame renderer is active or not
WZRenderAPI.VideoFrameRenderer.onWZVideoFrameRendererDraw(WZGLES.EglEnv, WZSize, int) will only be called on an active renderer |
UUID |
loadFont(String file,
int size,
int padX,
int padY)
This will load the specified font file, create a texture for the defined
character range, and setup all required values used to render with it.
|
void |
onWZVideoFrameRendererDraw(WZGLES.EglEnv eglEnv,
WZSize frameSize,
int frameRotation)
Called to render a frame of video to the viewport for the current OpenGL ES context
Note that eglEnv may differ at each call.
|
void |
onWZVideoFrameRendererInit(WZGLES.EglEnv eglEnv)
Called at the beginning of a rendering cycle
|
void |
onWZVideoFrameRendererRelease(WZGLES.EglEnv eglEnv)
Called at the end of a rendering cycle
|
void |
release()
Release the resources used by the text manager
|
void |
releaseTextObject(WZText textObject)
Remove the specified text object
|
void |
setTextVisible(boolean textVisible)
Set the visibility of all text objects
|
public static final int SCALE_BASIS_FRAME_WIDTH
public static final int SCALE_BASIS_FRAME_HEIGHT
public static final int SCALE_BASIS_BASE_SIZE
public static final int SCALE_BASIS_CURRENT_SIZE
public static WZTextManager getInstance()
public void init(Context context)
context
- The app contextpublic void release()
public UUID loadFont(String file, int size, int padX, int padY)
file
- Filename of the font (.ttf, .otf) to use. In 'Assets' folder.size
- Requested pixel size of font (height)padX
- Extra padding per character (X Axis); to prevent overlapping characters.padY
- Extra padding per character (Y Axis); to prevent overlapping characters.public WZTextManager.Font getFontById(UUID fontId)
fontId
- The id for the font to returnpublic WZText createTextObject(UUID fontId)
fontId
- The id for the font to be used for this text objectpublic WZText createTextObject(UUID fontId, String text)
fontId
- The id for the font to be used for this text objecttext
- The text string to drawpublic WZText createTextObject(UUID fontId, String text, WZColor color)
fontId
- The id for the font to be used for this text objecttext
- The text string to drawcolor
- The text colorpublic WZText createTextObject(UUID fontId, String text, float r, float g, float b, float a)
fontId
- The id for the font to be used for this text objecttext
- The text string to drawr
- The red component of the text color (0.0 - 1.0)g
- The green component of the text color (0.0 - 1.0)b
- The blue component of the text color (0.0 - 1.0)a
- The alpha component of the text color (0.0 - 1.0)public WZText createTextObject(UUID fontId, String text, float r, float g, float b)
fontId
- The id for the font to be used for this text objecttext
- The text string to drawr
- The red component of the text color (0.0 - 1.0)g
- The green component of the text color (0.0 - 1.0)b
- The blue component of the text color (0.0 - 1.0)public void releaseTextObject(WZText textObject)
textObject
- A text object to removepublic void clear()
public void setTextVisible(boolean textVisible)
textVisible
- true if text objects should be rendered, false otherwisepublic boolean isTextVisible()
public boolean isWZVideoFrameRendererActive()
WZRenderAPI.VideoFrameRenderer
WZRenderAPI.VideoFrameRenderer.onWZVideoFrameRendererDraw(WZGLES.EglEnv, WZSize, int)
will only be called on an active rendererisWZVideoFrameRendererActive
in interface WZRenderAPI.VideoFrameRenderer
public void onWZVideoFrameRendererInit(WZGLES.EglEnv eglEnv)
WZRenderAPI.VideoFrameRenderer
onWZVideoFrameRendererInit
in interface WZRenderAPI.VideoFrameRenderer
eglEnv
- The current OpenGL ES environment. Note that this may be a different EglEnv than the one supplied with
each call to WZRenderAPI.VideoFrameRenderer.onWZVideoFrameRendererDraw(WZGLES.EglEnv, WZSize, int)
. See for WZRenderAPI.VideoFrameRenderer.onWZVideoFrameRendererDraw(WZGLES.EglEnv, WZSize, int)
for details.public void onWZVideoFrameRendererDraw(WZGLES.EglEnv eglEnv, WZSize frameSize, int frameRotation)
WZRenderAPI.VideoFrameRenderer
WZRenderAPI.VideoFrameRenderer.onWZVideoFrameRendererInit(WZGLES.EglEnv)
and WZRenderAPI.VideoFrameRenderer.onWZVideoFrameRendererRelease(WZGLES.EglEnv eglEnv)
are shared contexts and can access the same EGL resources.onWZVideoFrameRendererDraw
in interface WZRenderAPI.VideoFrameRenderer
eglEnv
- The current OpenGL ES environment. Note that this may be a different EglEnv than the one supplied withframeSize
- size of the video frame (pixels)frameRotation
- frameRotation angle to apply when rendering (degrees, usually 0)public void onWZVideoFrameRendererRelease(WZGLES.EglEnv eglEnv)
WZRenderAPI.VideoFrameRenderer
onWZVideoFrameRendererRelease
in interface WZRenderAPI.VideoFrameRenderer
eglEnv
- The current OpenGL ES environment.© 2016 Wowza Media Systems, LLC. All rights reserved. Terms | Privacy | Trademarks | Legal