public class StickerGlLayer extends GlLayer implements RenderToCanvasLayerI, EventListenerInterface<ImageStickerLayerSettings.Event>
Modifier and Type | Field and Description |
---|---|
static float |
BORDER_THICKNESS |
static int |
CACHE_THRESHOLD |
static int |
EDGE_COLOR |
static float |
EDGE_HEIGHT |
static float |
EDGE_THICKNESS |
static float |
EDGE_WIDTH |
static int |
LINE_COLOR |
static float |
LINE_HEIGHT_OFFSET |
static float |
LINE_WIDTH_OFFSET |
static float[] |
OUTSIDE_COLOR_RGBA |
static float |
SNAP_RANGE_IN_DP |
static float[] |
SORTED_SNAP_POINTS |
static float |
TOUCH_OFFSET |
stage, transformationGlSafe, transformationUiSafe
isAttached, showState, uiDensity, willDrawUi
Constructor and Description |
---|
StickerGlLayer(StateHandler stateHandler,
ImageStickerLayerSettings settings) |
Modifier and Type | Method and Description |
---|---|
boolean |
doRespondOnClick(TransformedMotionEvent event) |
void |
drawStickerSlice(android.graphics.Canvas canvas,
android.graphics.RectF region,
android.graphics.RectF fullRange) |
android.graphics.Rect |
getResultRect(android.graphics.Rect fullImageRegion,
float subSample) |
MultiRect |
getStickerDestinationRect(ImageStickerLayerSettings.ScaleContext scaleContext) |
RectEdge |
getTouchedEdge(float[] pos) |
void |
glSetup() |
protected boolean |
isInBitmap(TransformedMotionEvent event) |
boolean |
isRelativeToCrop() |
protected void |
loadBitmapCache() |
protected void |
loadBitmapCache(long pixelSize) |
boolean |
needFullImageRegion() |
void |
onActivated() |
protected void |
onAttachedToUI(StateHandler stateHandler) |
void |
onDeactivated() |
protected void |
onDetachedFromUI(StateHandler stateHandler) |
protected void |
onDrawLayer() |
void |
onDrawUI(android.graphics.Canvas canvas) |
void |
onMotionEvent(TransformedMotionEvent event) |
void |
onStateChangeEvent(ImageStickerLayerSettings.Event event) |
protected void |
refresh() |
void |
render() |
void |
renderToCanvas(android.graphics.Canvas canvas,
android.graphics.Rect fullImageRegion,
android.graphics.Rect destRegion,
Transformation transformation) |
protected void |
setImageDimensions() |
void |
setImageRect(android.graphics.Rect rect) |
void |
setStickerMatrix(Transformation stickerMatrix,
ImageStickerLayerSettings.ScaleContext scaleContext) |
glDrawLayer
getResources, setTransformation
getStateHandler, isEnabled, onAttached, onDetached, onSizeChanged, postInvalidateUi, setWillDrawUi
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onAttached, onDetached, onSizeChanged, setTransformation
public static final float[] OUTSIDE_COLOR_RGBA
public static int LINE_COLOR
public static int EDGE_COLOR
public static int CACHE_THRESHOLD
public static float EDGE_THICKNESS
public static float BORDER_THICKNESS
public static float EDGE_WIDTH
public static float EDGE_HEIGHT
public static float LINE_WIDTH_OFFSET
public static float LINE_HEIGHT_OFFSET
public static float TOUCH_OFFSET
public static float SNAP_RANGE_IN_DP
public static float[] SORTED_SNAP_POINTS
public StickerGlLayer(StateHandler stateHandler, ImageStickerLayerSettings settings)
@MainThread public void onActivated()
onActivated
in interface LayerI
onActivated
in class GlLayer
@MainThread public void onDeactivated()
onDeactivated
in interface LayerI
onDeactivated
in class GlLayer
@AnyThread protected void setImageDimensions()
@MainThread public void onDrawUI(android.graphics.Canvas canvas)
onDrawUI
in interface UIOverlayDrawer
onDrawUI
in class LayerBase
@NonNull @AnyThread public MultiRect getStickerDestinationRect(ImageStickerLayerSettings.ScaleContext scaleContext)
@NonNull @AnyThread public void setStickerMatrix(Transformation stickerMatrix, ImageStickerLayerSettings.ScaleContext scaleContext)
protected void onAttachedToUI(StateHandler stateHandler)
onAttachedToUI
in class LayerBase
protected void onDetachedFromUI(StateHandler stateHandler)
onDetachedFromUI
in class LayerBase
@MainThread public void onMotionEvent(@NonNull TransformedMotionEvent event)
onMotionEvent
in interface LayerI
onMotionEvent
in class GlLayerBase
public boolean doRespondOnClick(@NonNull TransformedMotionEvent event)
doRespondOnClick
in interface LayerI
doRespondOnClick
in class GlLayerBase
public boolean isRelativeToCrop()
isRelativeToCrop
in interface LayerI
protected boolean isInBitmap(@NonNull TransformedMotionEvent event)
public void glSetup()
glSetup
in class GlLayerBase
protected void onDrawLayer()
onDrawLayer
in class GlLayer
public void render()
render
in class GlLayerBase
@MainThread public RectEdge getTouchedEdge(float[] pos)
public void setImageRect(@NonNull android.graphics.Rect rect)
setImageRect
in interface LayerI
@AnyThread protected void loadBitmapCache()
@AnyThread protected void loadBitmapCache(long pixelSize)
@WorkerThread public void renderToCanvas(android.graphics.Canvas canvas, android.graphics.Rect fullImageRegion, android.graphics.Rect destRegion, Transformation transformation)
renderToCanvas
in interface RenderToCanvasLayerI
public android.graphics.Rect getResultRect(android.graphics.Rect fullImageRegion, float subSample)
getResultRect
in interface ProcessableLayerI
getResultRect
in interface RenderToCanvasLayerI
public boolean needFullImageRegion()
needFullImageRegion
in interface ProcessableLayerI
needFullImageRegion
in interface RenderToCanvasLayerI
@WorkerThread public void drawStickerSlice(android.graphics.Canvas canvas, android.graphics.RectF region, android.graphics.RectF fullRange)
public void onStateChangeEvent(ImageStickerLayerSettings.Event event)
onStateChangeEvent
in interface EventListenerInterface<ImageStickerLayerSettings.Event>
@MainThread protected void refresh()