public class WZBitmap extends Object implements WZRenderAPI.VideoFrameRenderer
WZBitmap
class can be used to display a bitmap as an overlay on a WZCameraView
by registering an instance as a frame listener using WZCameraView.registerFrameListener(WZRenderAPI.VideoFrameListener)
Modifier and Type | Field and Description |
---|---|
static int |
BOTTOM
A position specifier for use as the second argument to
setPosition(int, int) to
align the bitmap along the bottom of the display. |
static int |
CENTER
A position specifier for use with
setPosition(int, int) to
center the bitmap within the device display. |
static int |
CURRENT_SIZE
A scale specifier for use as the second argument to
setScale(float, int) to
scale the bitmap as a factor of the current display size |
static int |
FRAME_HEIGHT
A scale specifier for use as the second argument to
setScale(float, int) to
scale the bitmap as a factor of the video frame height. |
static int |
FRAME_WIDTH
A scale specifier for use as the second argument to
setScale(float, int) to
scale the bitmap as a factor of the video frame width. |
static int |
LEFT
A position specifier for use as the first argument to
setPosition(int, int) to
align the bitmap along the left hand side of the display. |
static int |
ORIGINAL_SIZE
A scale specifier for use as the second argument to
setScale(float, int) to
scale the bitmap as a factor of the source bitmap size |
static int |
RIGHT
A position specifier for use as the first argument to
setPosition(int, int) to
align the bitmap along the right hand side of the display. |
static int |
SURFACE_HEIGHT
Deprecated.
use
FRAME_HEIGHT instead |
static int |
SURFACE_WIDTH
Deprecated.
use
FRAME_WIDTH instead |
static int |
TOP
A position specifier for use as the second argument to
setPosition(int, int) to
align the bitmap along the top of the display. |
Constructor and Description |
---|
WZBitmap()
Default constructor
|
WZBitmap(Bitmap bitmap)
Create a bitmap renderer instance using the specified Bitmap
|
Modifier and Type | Method and Description |
---|---|
WZSize |
getDisplaySize()
Returns the current display size of the bitmap being rendered (i.e.
|
WZPoint |
getPosition()
Returns the current position, in display pixels
|
int |
getRotationAngle()
Returns the current rotation angle, in degrees
|
float |
getScale()
Returns the current scale factor
|
int |
getScaleBasis()
Returns the current method used for applying the scale factor
|
WZSize |
getSourceSize()
Returns the original size of the bitmap being rendered
|
boolean |
isVisible()
Indicates if the bitmap is being rendered (i.e.
|
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 |
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 |
setBitmap(Bitmap bitmap) |
void |
setHeight(int height)
Set the display height of the bitmap, The width will be adjusted to preserve the aspect ratio and the scale factor will be reset to 1.0.
|
void |
setPosition(int xpos,
int ypos)
Set the bitmap's display position
|
void |
setPosition(WZPoint position)
Set the bitmap's display position
|
void |
setRotation(int angle)
Set the display rotation angle of the bitmap
|
void |
setScale(float scale)
Set the display scale factor for the bitmap based on it's original size
|
void |
setScale(float scale,
int scaleBasis)
Set the display scale factor and scaling basis for the bitmap
|
void |
setVisible(boolean isVisible)
Set a flag indicating whether the bitmap should be rendered (i.e.
|
void |
setWidth(int width)
Set the display width of the bitmap.
|
public static final int CENTER
setPosition(int, int)
to
center the bitmap within the device display.public static final int LEFT
setPosition(int, int)
to
align the bitmap along the left hand side of the display.public static final int RIGHT
setPosition(int, int)
to
align the bitmap along the right hand side of the display.public static final int TOP
setPosition(int, int)
to
align the bitmap along the top of the display.public static final int BOTTOM
setPosition(int, int)
to
align the bitmap along the bottom of the display.public static final int FRAME_WIDTH
setScale(float, int)
to
scale the bitmap as a factor of the video frame width.public static final int FRAME_HEIGHT
setScale(float, int)
to
scale the bitmap as a factor of the video frame height.public static final int SURFACE_WIDTH
FRAME_WIDTH
insteadpublic static final int SURFACE_HEIGHT
FRAME_HEIGHT
insteadpublic static final int ORIGINAL_SIZE
setScale(float, int)
to
scale the bitmap as a factor of the source bitmap sizepublic static final int CURRENT_SIZE
setScale(float, int)
to
scale the bitmap as a factor of the current display sizepublic WZBitmap()
public WZBitmap(Bitmap bitmap)
bitmap
- the bitmap to renderpublic void setBitmap(Bitmap bitmap)
public WZSize getSourceSize()
public WZSize getDisplaySize()
public int getScaleBasis()
FRAME_WIDTH
, FRAME_HEIGHT
, ORIGINAL_SIZE
(default), or CURRENT_SIZE
public float getScale()
public WZPoint getPosition()
public int getRotationAngle()
public void setWidth(int width)
width
- The display width, in device pixelspublic void setHeight(int height)
height
- The display height, in device pixelspublic void setScale(float scale)
scale
- The scale factorpublic void setScale(float scale, int scaleBasis)
scale
- The scale factorscaleBasis
- One of FRAME_WIDTH
, FRAME_HEIGHT
, ORIGINAL_SIZE
, or CURRENT_SIZE
public void setPosition(WZPoint position)
position
- The display position, in display pixelspublic void setPosition(int xpos, int ypos)
xpos
- The x position, in display pixelsypos
- The y position, in display pixelspublic void setRotation(int angle)
angle
- The display rotation angle, in degrees (0-360)public void setVisible(boolean isVisible)
isVisible
- true if the bitmap should be rendered, false otherwisepublic boolean isVisible()
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