public final class WOWZTextManager extends java.lang.Object implements WOWZRenderAPI.VideoFrameRenderer
Modifier and Type | Class and Description |
---|---|
static class |
WOWZTextManager.Font |
Modifier and Type | Field and Description |
---|---|
static int |
SCALE_BASIS_BASE_SIZE
A basis for scaling the text as a factor of the original text size.
|
static int |
SCALE_BASIS_CURRENT_SIZE
A basis for scaling the text as a factor of the current scaled text size.
|
static int |
SCALE_BASIS_FRAME_HEIGHT
A basis for scaling the text as a factor of the video frame height.
|
static int |
SCALE_BASIS_FRAME_WIDTH
A basis for scaling the text as a factor of the video frame width.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all text objects.
|
WOWZText |
createTextObject(java.util.UUID fontId)
Creates an empty text object to be drawn using the font with the specified ID.
|
WOWZText |
createTextObject(java.util.UUID fontId,
java.lang.String text)
Creates a text object using the specified string to draw using the font with the specified ID.
|
WOWZText |
createTextObject(java.util.UUID fontId,
java.lang.String text,
float r,
float g,
float b)
Creates a text object using the specified font, text string, and color.
|
WOWZText |
createTextObject(java.util.UUID fontId,
java.lang.String text,
float r,
float g,
float b,
float a)
Creates a text object using the specified font, text string, and color.
|
WOWZText |
createTextObject(java.util.UUID fontId,
java.lang.String text,
WOWZColor color)
Creates a text object using the specified font, text string, and color.
|
WOWZTextManager.Font |
getFontById(java.util.UUID fontId)
Gets the font for the specified ID.
|
static WOWZTextManager |
getInstance()
Accesses the Wowza GoCoder SDK text manager.
|
void |
init(Context context)
Initializes the text manager and provides the application context.
|
boolean |
isTextVisible()
Indicates whether text object rendering is enabled.
|
boolean |
isWZVideoFrameRendererActive()
Checks whether the frame renderer is active.
|
java.util.UUID |
loadFont(java.lang.String file,
int size,
int padX,
int padY)
Loads the specified font file, creates a texture for the defined character range, and sets up all required values used by the
com.wowza.gocoder.sdk.api.devices.WZTextManager to render fonts. |
void |
onWZVideoFrameRendererDraw(WOWZGLES.EglEnv eglEnv,
WOWZSize frameSize,
int frameRotation)
Called to render a frame of video to the viewport for the current OpenGL ES context.
|
void |
onWZVideoFrameRendererInit(WOWZGLES.EglEnv eglEnv)
Called at the beginning of a rendering cycle.
|
void |
onWZVideoFrameRendererRelease(WOWZGLES.EglEnv eglEnv)
Called at the end of a rendering cycle.
|
void |
release()
Releases the resources used by the text manager.
|
void |
releaseTextObject(WOWZText textObject)
Removes the specified text object.
|
void |
setTextVisible(boolean textVisible)
Sets 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 WOWZTextManager getInstance()
public void init(Context context)
context
- The app context.public void release()
public java.util.UUID loadFont(java.lang.String file, int size, int padX, int padY)
com.wowza.gocoder.sdk.api.devices.WZTextManager
to render fonts.file
- The name of the font file (.ttf, .otf), in the Assets folder, to use.size
- The height, in pixels, of the font.padX
- The extra horizontal padding added to each character (x axis) to prevent overlapping.padY
- The extra vertical padding added to each character (y axis) to prevent overlapping.public WOWZTextManager.Font getFontById(java.util.UUID fontId)
fontId
- The font's ID value.public WOWZText createTextObject(java.util.UUID fontId)
fontId
- The ID for the font to use for this text object.public WOWZText createTextObject(java.util.UUID fontId, java.lang.String text)
fontId
- The ID for the font to use for this text object.text
- The text string to draw.public WOWZText createTextObject(java.util.UUID fontId, java.lang.String text, WOWZColor color)
fontId
- The ID for the font to use for this text object.text
- The text string to draw.color
- The text color.public WOWZText createTextObject(java.util.UUID fontId, java.lang.String text, float r, float g, float b, float a)
fontId
- The ID for the font to use for this text object.text
- The text string to draw.r
- 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 WOWZText createTextObject(java.util.UUID fontId, java.lang.String text, float r, float g, float b)
fontId
- The ID for the font to use for this text object.text
- The text string to draw.r
- 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(WOWZText textObject)
textObject
- The text object to remove.public void clear()
public void setTextVisible(boolean textVisible)
textVisible
- True if text objects should be rendered; false otherwise.public boolean isTextVisible()
public boolean isWZVideoFrameRendererActive()
WOWZRenderAPI.VideoFrameRenderer
WOWZRenderAPI.VideoFrameRenderer.onWZVideoFrameRendererDraw(WOWZGLES.EglEnv, WOWZSize, int)
will only be called on an active renderer.isWZVideoFrameRendererActive
in interface WOWZRenderAPI.VideoFrameRenderer
public void onWZVideoFrameRendererInit(WOWZGLES.EglEnv eglEnv)
WOWZRenderAPI.VideoFrameRenderer
onWZVideoFrameRendererInit
in interface WOWZRenderAPI.VideoFrameRenderer
eglEnv
- The current OpenGL ES environment, which may be a different EglEnv than the one supplied with
each call to WOWZRenderAPI.VideoFrameRenderer.onWZVideoFrameRendererDraw(WOWZGLES.EglEnv, WOWZSize, int)
. See for WOWZRenderAPI.VideoFrameRenderer.onWZVideoFrameRendererDraw(WOWZGLES.EglEnv, WOWZSize, int)
for details.public void onWZVideoFrameRendererDraw(WOWZGLES.EglEnv eglEnv, WOWZSize frameSize, int frameRotation)
WOWZRenderAPI.VideoFrameRenderer
WOWZRenderAPI.VideoFrameRenderer.onWZVideoFrameRendererInit(WOWZGLES.EglEnv)
and WOWZRenderAPI.VideoFrameRenderer.onWZVideoFrameRendererRelease(WOWZGLES.EglEnv eglEnv)
are shared contexts and can access the same EGL resources.onWZVideoFrameRendererDraw
in interface WOWZRenderAPI.VideoFrameRenderer
eglEnv
- The current OpenGL ES environment.frameSize
- The size of the video frame, in pixels.frameRotation
- The angle to apply when rendering, in degrees (usually 0).public void onWZVideoFrameRendererRelease(WOWZGLES.EglEnv eglEnv)
WOWZRenderAPI.VideoFrameRenderer
onWZVideoFrameRendererRelease
in interface WOWZRenderAPI.VideoFrameRenderer
eglEnv
- The current OpenGL ES environment.© 2016 - 2018 Wowza Media Systems, LLC. All rights reserved. Terms | Privacy | Trademarks | Legal