Class InterlacedSurfaceView
- java.lang.Object
-
- android.view.View
-
- android.view.SurfaceView
-
- com.leia.sdk.views.InterlacedSurfaceView
-
- All Implemented Interfaces:
Drawable.Callback
,AccessibilityEventSource
,KeyEvent.Callback
,SurfaceHolder.Callback
,SurfaceHolder.Callback2
,InterlacedView
public class InterlacedSurfaceView extends SurfaceView implements InterlacedView
InterlacedSurfaceView interlacesInputViewsAsset
for Leia Display.Moving and Resizing an InterlacedSurfaceView
Since interlacing depends on the precise location on the screen of the image, we need to keep the InterlacedSurfaceView up-to-date with its position and size. Currently, the rendering of InterlacedSurfaceView and its presentation on the screen is asynchronous. So animating position and size generally not supported.Scaling animations
There is no way to support them at the moment. Avoid them at all costs.Usually, there are scaling animations on over-scroll. They can be entirely disabled by calling
View.setOverScrollMode(int)
withView.OVER_SCROLL_NEVER
.Move animations
Currently, move animations can be supported by forcing a view to move over a predefined pixels grid, i.e. move it with a non-unit step. We call this grid the interlace pattern grid. The grid step depends on the display. For the 9V display, X-step is 3px, and Y-step is 9px. This behavior is disabled by default because InterlacedSurfaceView can be rendered at any location on the screen. There are problems only when location is constantly changing. There are currently two ways to align a view to the grid: manual and automatic. The automatic approach covers most of the use cases. The known use-cases where the automatic approach is enough -androidx.recyclerview.widget.RecyclerView
,androidx.viewpager2.widget.ViewPager2
, andcom.google.android.material.appbar.AppBarLayout
. The manual approach requires the user to callupdatePosition(boolean, boolean)
when the view is moved. The manual approach is the only known way to handleScrollView
andHorizontalScrollView
.To activate the automatic grid alignment either call
setAutoAlign(boolean, boolean)
or addautoAlignX
or/andautoAlignY
attributes to the XML. If your view is expected to be moving horizontally, it should be aligned over the X-axis. And the same applies to vertical movement and the Y-axis.Manual position update with a
ScrollView
can be done this way:interlacedSurfaceView.setManualPositionUpdate(true); // Not necessary but preferably to specify your intentions explicitly verticalScrollView.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> { interlacedSurfaceView.updatePosition(false, true); });
Transparency
InterlacedSurfaceView supports transparency. It should be explicitly enabled on initialization. This can be done in two ways: either specifysupportsTransparency=true
attribute or useInterlacedSurfaceView(Context, boolean, boolean)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
InterlacedSurfaceView.DebugGuiCloseListener
-
Nested classes/interfaces inherited from class android.view.View
View.AccessibilityDelegate, View.BaseSavedState, View.DragShadowBuilder, View.MeasureSpec, View.OnApplyWindowInsetsListener, View.OnAttachStateChangeListener, View.OnCapturedPointerListener, View.OnClickListener, View.OnContextClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnHoverListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnScrollChangeListener, View.OnSystemUiVisibilityChangeListener, View.OnTouchListener, View.OnUnhandledKeyEventListener
-
Nested classes/interfaces inherited from interface com.leia.sdk.views.InterlacedView
InterlacedView.Common
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEBUG_CHECK_GL_ERROR
Check glError() after every GL call and throw an exception if glError indicates that an error has occurred.static int
DEBUG_LOG_GL_CALLS
Log GL calls to the system log at "verbose" level with tag "LeiaGLSurfaceView".static int
RENDERMODE_CONTINUOUSLY
The renderer is called continuously to re-render the scene.static int
RENDERMODE_WHEN_DIRTY
The renderer only renders when the surface is created, or whenrequestRender()
is called.-
Fields inherited from class android.view.View
ACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR, AUTOFILL_HINT_CREDIT_CARD_NUMBER, AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE, AUTOFILL_HINT_EMAIL_ADDRESS, AUTOFILL_HINT_NAME, AUTOFILL_HINT_PASSWORD, AUTOFILL_HINT_PHONE, AUTOFILL_HINT_POSTAL_ADDRESS, AUTOFILL_HINT_POSTAL_CODE, AUTOFILL_HINT_USERNAME, AUTOFILL_TYPE_DATE, AUTOFILL_TYPE_LIST, AUTOFILL_TYPE_NONE, AUTOFILL_TYPE_TEXT, AUTOFILL_TYPE_TOGGLE, DRAG_FLAG_ACCESSIBILITY_ACTION, DRAG_FLAG_GLOBAL, DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION, DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION, DRAG_FLAG_GLOBAL_URI_READ, DRAG_FLAG_GLOBAL_URI_WRITE, DRAG_FLAG_OPAQUE, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLE, FOCUSABLE_AUTO, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, IMPORTANT_FOR_AUTOFILL_AUTO, IMPORTANT_FOR_AUTOFILL_NO, IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS, IMPORTANT_FOR_AUTOFILL_YES, IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS, IMPORTANT_FOR_CONTENT_CAPTURE_AUTO, IMPORTANT_FOR_CONTENT_CAPTURE_NO, IMPORTANT_FOR_CONTENT_CAPTURE_NO_EXCLUDE_DESCENDANTS, IMPORTANT_FOR_CONTENT_CAPTURE_YES, IMPORTANT_FOR_CONTENT_CAPTURE_YES_EXCLUDE_DESCENDANTS, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, NOT_FOCUSABLE, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_CAPTURE_HINT_AUTO, SCROLL_CAPTURE_HINT_EXCLUDE, SCROLL_CAPTURE_HINT_EXCLUDE_DESCENDANTS, SCROLL_CAPTURE_HINT_INCLUDE, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z
-
-
Constructor Summary
Constructors Constructor Description InterlacedSurfaceView(Context context)
Standard View constructor.InterlacedSurfaceView(Context context, boolean protectedSurface, boolean supportsTransparency)
Standard View constructor.InterlacedSurfaceView(Context context, AttributeSet attrs)
Standard View constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
clearAllInterlacers()
protected void
finalize()
float
getActCoef()
InterlacedSurfaceViewConfigAccessor
getConfig()
Get config accessor that holds a lock to the config.int
getDebugFlags()
Get the current value of the debug flags.InputViewsAsset
getInputViewsAsset()
boolean
getPreserveEGLContextOnPause()
float
getReconvergenceAmount()
Deprecated.ReconvergenceZoomType
getReconvergenceZoomType()
Deprecated.float[]
getRectMatrix()
Get the rect matrixint
getRenderMode()
Get the current rendering mode.Matrix
getScaleTypeMatrix()
Get the scale type matrixZonePlateState
getZonePlateInitialState(int viewportWidth, int viewportHeight)
Get zonePlate initiale state.ZonePlateResults
getZonePlateResults()
Get zonePlate results.boolean
isAGSL()
Is the view drawn by an AGSL RuntimeShader?protected void
onAttachedToWindow()
This method is used as part of the View class and is not normally called or subclassed by clients of LeiaGLSurfaceView.protected void
onDetachedFromWindow()
void
onPause()
Pause the rendering thread, optionally tearing down the EGL context depending upon the value ofsetPreserveEGLContextOnPause(boolean)
.void
onResume()
Resumes the rendering thread, re-creating the OpenGL context if necessary.boolean
onTouchEvent(MotionEvent event)
InterlacedSurfaceView captures all MotionEvents when the debug gui is visible.void
queueEvent(Runnable r)
Queue a runnable to be run on the GL rendering thread.void
releaseInputViewsAsset()
void
requestRender()
Request that the renderer render a frame.void
setAlpha(float alpha)
Deprecated.void
setAutoAlign(boolean x, boolean y)
Configures InterlacedSurfaceView to automatically align to work around move animation limitations.void
setCameraAngles(boolean isLeft, float thetaXFpc, float thetaYFpc, float thetaZFpc)
void
setCameraRectificationParameters(boolean isFront, float deltaThetaX, float deltaThetaY, float deltaThetaZ, float calibrationTargetDistanceMm)
void
setDebugFlags(int debugFlags)
Set the debug flags to a new value.void
setDebugGuiCloseListener(InterlacedSurfaceView.DebugGuiCloseListener listener)
void
setEGLConfigChooser(boolean needDepth)
Install a config chooser which will choose a config as close to 16-bit RGB as possible, with or without an optional depth buffer as close to 16-bits as possible.void
setEGLConfigChooser(int redSize, int greenSize, int blueSize, int alphaSize, int depthSize, int stencilSize)
Install a config chooser which will choose a config with at least the specified depthSize and stencilSize, and exactly the specified redSize, greenSize, blueSize and alphaSize.void
setEGLConfigChooser(com.leia.sdk.views.LeiaGLSurfaceView.EGLConfigChooser configChooser)
Install a custom EGLConfigChooser.void
setEGLContextClientVersion(int version)
Inform the default EGLContextFactory and default EGLConfigChooser which EGLContext client version to pick.void
setEGLContextFactory(com.leia.sdk.views.LeiaGLSurfaceView.EGLContextFactory factory)
Install a custom EGLContextFactory.void
setEGLWindowSurfaceFactory(com.leia.sdk.views.LeiaGLSurfaceView.EGLWindowSurfaceFactory factory)
Install a custom EGLWindowSurfaceFactory.void
setFrameRate(float fps)
void
setFrameRate(long period, TimeUnit unit)
void
setGLWrapper(com.leia.sdk.views.LeiaGLSurfaceView.GLWrapper glWrapper)
Set the glWrapper.void
setHorizontalViewsLayout()
Deprecated.void
setIsGuiVisible(boolean isGuiVisible)
void
setManualPositionUpdate(boolean manualPositionUpdate)
Configures whether InterlacedSurfaceView should rely on the user to keep its position synchronized.void
setPreserveEGLContextOnPause(boolean preserveOnPause)
Control whether the EGL context is preserved when the LeiaGLSurfaceView is paused and resumed.void
setReconvergenceAmount(float reconvergenceAmount)
Deprecated.void
setReconvergenceAmount(float reconvergenceAmount, ReconvergenceZoomType zoomType)
Deprecated.void
setRenderer(com.leia.sdk.views.LeiaGLSurfaceView.Renderer renderer)
Set the renderer associated with this view.void
setRenderMode(int renderMode)
Set the rendering mode.void
setScaleType(ScaleType scaleType)
Deprecated.void
setSingleViewMode(boolean singleView)
Deprecated.void
setSingleViewModeListener(InterlacerSingleViewModeListener listener)
Set InterlacerSingleViewModeListener.void
setSourceSize(int x, int y)
Deprecated.void
setSupportCirclePhase(float phase)
Set zonePlate parameter.void
setVerticalViewsLayout()
Deprecated.void
setViewAsset(InputViewsAsset newViews)
InterlacedSurfaceView takes ownership over InputViewsAsset.void
surfaceChanged(SurfaceHolder holder, int format, int w, int h)
This method is part of the SurfaceHolder.Callback interface, and is not normally called or subclassed by clients of LeiaGLSurfaceView.void
surfaceCreated(SurfaceHolder holder)
This method is part of the SurfaceHolder.Callback interface, and is not normally called or subclassed by clients of LeiaGLSurfaceView.void
surfaceDestroyed(SurfaceHolder holder)
This method is part of the SurfaceHolder.Callback interface, and is not normally called or subclassed by clients of LeiaGLSurfaceView.void
surfaceRedrawNeeded(SurfaceHolder holder)
Deprecated.void
surfaceRedrawNeededAsync(SurfaceHolder holder, Runnable finishDrawing)
This method is part of the SurfaceHolder.Callback2 interface, and is not normally called or subclassed by clients of LeiaGLSurfaceView.void
toggleGui()
Deprecated.void
toggleGuiVisibility()
Deprecated.void
updatePosition(boolean alignX, boolean alignY)
Notify InterlacedSurfaceView that its position has been changed.boolean
writeZonePlateResultsToInterlacer(float slant, float pitch, float phc, float dOverN, float n)
Write zoneplate results to interlacer-
Methods inherited from class android.view.SurfaceView
dispatchDraw, draw, gatherTransparentRegion, getHolder, getHostToken, getImportantForAccessibility, getSurfaceControl, onFocusChanged, onMeasure, onWindowVisibilityChanged, setChildSurfacePackage, setClipBounds, setSecure, setVisibility, setZOrderMediaOverlay, setZOrderOnTop
-
Methods inherited from class android.view.View
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addFocusables, addKeyboardNavigationClusters, addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, addTouchables, animate, announceForAccessibility, autofill, autofill, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, clearFocus, clearViewTranslationCallback, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchGenericFocusedEvent, dispatchGenericMotionEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerCaptureChanged, dispatchPopulateAccessibilityEvent, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableHotspotChanged, drawableStateChanged, findFocus, findOnBackInvokedDispatcher, findViewById, findViewsWithText, findViewWithTag, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, generateDisplayHash, generateViewId, getAccessibilityClassName, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverlay, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocus, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasTransientState, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, jumpDrawablesToCurrentState, keyboardNavigationClusterSearch, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateDrawableState, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDisplayHint, onDragEvent, onDraw, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onLayout, onOverScrolled, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onResolvePointerIcon, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onScrollCaptureSearch, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreDefaultFocus, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAnimation, setAnimationMatrix, setAutofillHints, setAutofillId, setAutoHandwritingEnabled, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipToOutline, setContentCaptureSession, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setWillNotCacheDrawing, setWillNotDraw, setWindowInsetsAnimationCallback, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, updateDragShadow, verifyDrawable, willNotCacheDrawing, willNotDraw
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.leia.sdk.views.InterlacedView
getContext, getHeight, getMeasuredHeight, getMeasuredWidth, getParent, getWidth
-
-
-
-
Field Detail
-
RENDERMODE_WHEN_DIRTY
public static final int RENDERMODE_WHEN_DIRTY
The renderer only renders when the surface is created, or whenrequestRender()
is called.
-
RENDERMODE_CONTINUOUSLY
public static final int RENDERMODE_CONTINUOUSLY
The renderer is called continuously to re-render the scene.- See Also:
getRenderMode()
,setRenderMode(int)
, Constant Field Values
-
DEBUG_CHECK_GL_ERROR
public static final int DEBUG_CHECK_GL_ERROR
Check glError() after every GL call and throw an exception if glError indicates that an error has occurred. This can be used to help track down which OpenGL ES call is causing an error.- See Also:
getDebugFlags()
,setDebugFlags(int)
, Constant Field Values
-
DEBUG_LOG_GL_CALLS
public static final int DEBUG_LOG_GL_CALLS
Log GL calls to the system log at "verbose" level with tag "LeiaGLSurfaceView".- See Also:
getDebugFlags()
,setDebugFlags(int)
, Constant Field Values
-
-
Constructor Detail
-
InterlacedSurfaceView
public InterlacedSurfaceView(Context context)
Standard View constructor. In order to render something, you must callsetViewAsset(InputViewsAsset)
to specify the content.
-
InterlacedSurfaceView
public InterlacedSurfaceView(Context context, boolean protectedSurface, boolean supportsTransparency)
Standard View constructor. In order to render something, you must callsetViewAsset(InputViewsAsset)
to specify the content.- Parameters:
protectedSurface
- seeInterlacedRenderer.EGL_PROTECTED_CONTENT_EXT
supportsTransparency
- control transparency support
-
InterlacedSurfaceView
public InterlacedSurfaceView(Context context, AttributeSet attrs)
Standard View constructor. In order to render something, you must callsetViewAsset(InputViewsAsset)
to specify the content. Supported attributes:- protectedSurface - see
InterlacedRenderer.EGL_PROTECTED_CONTENT_EXT
. - supportsTransparency - see
InterlacedSurfaceView(Context, boolean, boolean)
. - autoAlignX and autoAlignY - see
setAutoAlign(boolean, boolean)
.
- protectedSurface - see
-
-
Method Detail
-
setRenderMode
public void setRenderMode(int renderMode)
Set the rendering mode. When renderMode is RENDERMODE_CONTINUOUSLY, the renderer is called repeatedly to re-render the scene. When renderMode is RENDERMODE_WHEN_DIRTY, the renderer only rendered when the surface is created, or whenrequestRender()
is called. Defaults to RENDERMODE_CONTINUOUSLY.Using RENDERMODE_WHEN_DIRTY can improve battery life and overall system performance by allowing the GPU and CPU to idle when the view does not need to be updated.
This method can only be called after
setRenderer(Renderer)
- Parameters:
renderMode
- one of the RENDERMODE_X constants- See Also:
RENDERMODE_CONTINUOUSLY
,RENDERMODE_WHEN_DIRTY
-
setFrameRate
public void setFrameRate(long period, TimeUnit unit)
-
setFrameRate
public void setFrameRate(float fps)
-
setViewAsset
public void setViewAsset(InputViewsAsset newViews)
InterlacedSurfaceView takes ownership over InputViewsAsset. InputViewsAsset is released when a new InputViewsAsset is set or viareleaseInputViewsAsset()
.- Specified by:
setViewAsset
in interfaceInterlacedView
-
getInputViewsAsset
public InputViewsAsset getInputViewsAsset()
-
releaseInputViewsAsset
public void releaseInputViewsAsset()
-
setSingleViewModeListener
public void setSingleViewModeListener(InterlacerSingleViewModeListener listener)
Set InterlacerSingleViewModeListener.- Specified by:
setSingleViewModeListener
in interfaceInterlacedView
-
setDebugGuiCloseListener
public void setDebugGuiCloseListener(InterlacedSurfaceView.DebugGuiCloseListener listener)
-
setIsGuiVisible
public void setIsGuiVisible(boolean isGuiVisible)
- Specified by:
setIsGuiVisible
in interfaceInterlacedView
-
onTouchEvent
public boolean onTouchEvent(MotionEvent event)
InterlacedSurfaceView captures all MotionEvents when the debug gui is visible.- Overrides:
onTouchEvent
in classView
- See Also:
InterlacedSurfaceViewConfigAccessor.setIsGuiVisible(boolean)
-
surfaceCreated
public void surfaceCreated(SurfaceHolder holder)
This method is part of the SurfaceHolder.Callback interface, and is not normally called or subclassed by clients of LeiaGLSurfaceView.- Specified by:
surfaceCreated
in interfaceSurfaceHolder.Callback
-
surfaceDestroyed
public void surfaceDestroyed(SurfaceHolder holder)
This method is part of the SurfaceHolder.Callback interface, and is not normally called or subclassed by clients of LeiaGLSurfaceView.- Specified by:
surfaceDestroyed
in interfaceSurfaceHolder.Callback
-
setAutoAlign
public void setAutoAlign(boolean x, boolean y)
Configures InterlacedSurfaceView to automatically align to work around move animation limitations. Set both arguments to false to disable any alignment (default).- Specified by:
setAutoAlign
in interfaceInterlacedView
- Parameters:
x
- align in the X-axisy
- align in the Y-axis
-
setManualPositionUpdate
public void setManualPositionUpdate(boolean manualPositionUpdate)
Configures whether InterlacedSurfaceView should rely on the user to keep its position synchronized.- See Also:
updatePosition(boolean, boolean)
-
updatePosition
public void updatePosition(boolean alignX, boolean alignY)
Notify InterlacedSurfaceView that its position has been changed. Optionally, allows to align the view to work around move animation limitations.
-
getConfig
public InterlacedSurfaceViewConfigAccessor getConfig()
Get config accessor that holds a lock to the config. It must be closed after use viaInterlacedSurfaceViewConfigAccessor.close()
.- Specified by:
getConfig
in interfaceInterlacedView
-
toggleGui
@Deprecated public void toggleGui()
Deprecated.
-
toggleGuiVisibility
@Deprecated public void toggleGuiVisibility()
Deprecated.
-
setSourceSize
@Deprecated public void setSourceSize(int x, int y)
Deprecated.
-
setHorizontalViewsLayout
@Deprecated public void setHorizontalViewsLayout()
Deprecated.
-
setVerticalViewsLayout
@Deprecated public void setVerticalViewsLayout()
Deprecated.
-
getReconvergenceZoomType
@Deprecated public ReconvergenceZoomType getReconvergenceZoomType()
Deprecated.
-
getReconvergenceAmount
@Deprecated public float getReconvergenceAmount()
Deprecated.
-
setReconvergenceAmount
@Deprecated public void setReconvergenceAmount(float reconvergenceAmount)
Deprecated.
-
setReconvergenceAmount
@Deprecated public void setReconvergenceAmount(float reconvergenceAmount, ReconvergenceZoomType zoomType)
Deprecated.
-
setScaleType
@Deprecated public void setScaleType(ScaleType scaleType)
Deprecated.
-
setSingleViewMode
@Deprecated public void setSingleViewMode(boolean singleView)
Deprecated.
-
setAlpha
@Deprecated public void setAlpha(float alpha)
Deprecated.- Overrides:
setAlpha
in classSurfaceView
-
getRectMatrix
public float[] getRectMatrix()
Get the rect matrix- Specified by:
getRectMatrix
in interfaceInterlacedView
- Returns:
- the rect matrix if available or an identity matrix
-
getZonePlateInitialState
public ZonePlateState getZonePlateInitialState(int viewportWidth, int viewportHeight)
Get zonePlate initiale state.- Specified by:
getZonePlateInitialState
in interfaceInterlacedView
-
getZonePlateResults
public ZonePlateResults getZonePlateResults()
Get zonePlate results.
-
setSupportCirclePhase
public void setSupportCirclePhase(float phase)
Set zonePlate parameter.
-
writeZonePlateResultsToInterlacer
public boolean writeZonePlateResultsToInterlacer(float slant, float pitch, float phc, float dOverN, float n)
Write zoneplate results to interlacer
-
setCameraRectificationParameters
public void setCameraRectificationParameters(boolean isFront, float deltaThetaX, float deltaThetaY, float deltaThetaZ, float calibrationTargetDistanceMm)
-
setCameraAngles
public void setCameraAngles(boolean isLeft, float thetaXFpc, float thetaYFpc, float thetaZFpc)
-
getActCoef
public float getActCoef()
-
getScaleTypeMatrix
public Matrix getScaleTypeMatrix()
Get the scale type matrix- Specified by:
getScaleTypeMatrix
in interfaceInterlacedView
- Returns:
- the scale type matrix if available or an identity matrix
-
isAGSL
public boolean isAGSL()
Description copied from interface:InterlacedView
Is the view drawn by an AGSL RuntimeShader?- Specified by:
isAGSL
in interfaceInterlacedView
- Returns:
- true if view is drawn with AGSL
-
clearAllInterlacers
public static void clearAllInterlacers()
-
finalize
protected void finalize() throws Throwable
-
setGLWrapper
public void setGLWrapper(com.leia.sdk.views.LeiaGLSurfaceView.GLWrapper glWrapper)
Set the glWrapper. If the glWrapper is not null, itsLeiaGLSurfaceView.GLWrapper.wrap(GL)
method is called whenever a surface is created. A GLWrapper can be used to wrap the GL object that's passed to the renderer. Wrapping a GL object enables examining and modifying the behavior of the GL calls made by the renderer.Wrapping is typically used for debugging purposes.
The default value is null.
- Parameters:
glWrapper
- the new GLWrapper
-
setDebugFlags
public void setDebugFlags(int debugFlags)
Set the debug flags to a new value. The value is constructed by OR-together zero or more of the DEBUG_CHECK_* constants. The debug flags take effect whenever a surface is created. The default value is zero.- Parameters:
debugFlags
- the new debug flags- See Also:
DEBUG_CHECK_GL_ERROR
,DEBUG_LOG_GL_CALLS
-
getDebugFlags
public int getDebugFlags()
Get the current value of the debug flags.- Returns:
- the current value of the debug flags.
-
setPreserveEGLContextOnPause
public void setPreserveEGLContextOnPause(boolean preserveOnPause)
Control whether the EGL context is preserved when the LeiaGLSurfaceView is paused and resumed.If set to true, then the EGL context may be preserved when the LeiaGLSurfaceView is paused.
Prior to API level 11, whether the EGL context is actually preserved or not depends upon whether the Android device can support an arbitrary number of EGL contexts or not. Devices that can only support a limited number of EGL contexts must release the EGL context in order to allow multiple applications to share the GPU.
If set to false, the EGL context will be released when the LeiaGLSurfaceView is paused, and recreated when the LeiaGLSurfaceView is resumed.
The default is false.
- Parameters:
preserveOnPause
- preserve the EGL context when paused
-
getPreserveEGLContextOnPause
public boolean getPreserveEGLContextOnPause()
- Returns:
- true if the EGL context will be preserved when paused
-
setRenderer
public void setRenderer(com.leia.sdk.views.LeiaGLSurfaceView.Renderer renderer)
Set the renderer associated with this view. Also starts the thread that will call the renderer, which in turn causes the rendering to start.This method should be called once and only once in the life-cycle of a LeiaGLSurfaceView.
The following LeiaGLSurfaceView methods can only be called before setRenderer is called:
setEGLConfigChooser(boolean)
setEGLConfigChooser(EGLConfigChooser)
setEGLConfigChooser(int, int, int, int, int, int)
The following LeiaGLSurfaceView methods can only be called after setRenderer is called:
- Parameters:
renderer
- the renderer to use to perform OpenGL drawing.
-
setEGLContextFactory
public void setEGLContextFactory(com.leia.sdk.views.LeiaGLSurfaceView.EGLContextFactory factory)
Install a custom EGLContextFactory.If this method is called, it must be called before
setRenderer(Renderer)
is called.If this method is not called, then by default a context will be created with no shared context and with a null attribute list.
-
setEGLWindowSurfaceFactory
public void setEGLWindowSurfaceFactory(com.leia.sdk.views.LeiaGLSurfaceView.EGLWindowSurfaceFactory factory)
Install a custom EGLWindowSurfaceFactory.If this method is called, it must be called before
setRenderer(Renderer)
is called.If this method is not called, then by default a window surface will be created with a null attribute list.
-
setEGLConfigChooser
public void setEGLConfigChooser(com.leia.sdk.views.LeiaGLSurfaceView.EGLConfigChooser configChooser)
Install a custom EGLConfigChooser.If this method is called, it must be called before
setRenderer(Renderer)
is called.If no setEGLConfigChooser method is called, then by default the view will choose an EGLConfig that is compatible with the current android.view.Surface, with a depth buffer depth of at least 16 bits.
- Parameters:
configChooser
-
-
setEGLConfigChooser
public void setEGLConfigChooser(boolean needDepth)
Install a config chooser which will choose a config as close to 16-bit RGB as possible, with or without an optional depth buffer as close to 16-bits as possible.If this method is called, it must be called before
setRenderer(Renderer)
is called.If no setEGLConfigChooser method is called, then by default the view will choose an RGB_888 surface with a depth buffer depth of at least 16 bits.
- Parameters:
needDepth
-
-
setEGLConfigChooser
public void setEGLConfigChooser(int redSize, int greenSize, int blueSize, int alphaSize, int depthSize, int stencilSize)
Install a config chooser which will choose a config with at least the specified depthSize and stencilSize, and exactly the specified redSize, greenSize, blueSize and alphaSize.If this method is called, it must be called before
setRenderer(Renderer)
is called.If no setEGLConfigChooser method is called, then by default the view will choose an RGB_888 surface with a depth buffer depth of at least 16 bits.
-
setEGLContextClientVersion
public void setEGLContextClientVersion(int version)
Inform the default EGLContextFactory and default EGLConfigChooser which EGLContext client version to pick.Use this method to create an OpenGL ES 2.0-compatible context. Example:
public MyView(Context context) { super(context); setEGLContextClientVersion(2); // Pick an OpenGL ES 2.0 context. setRenderer(new MyRenderer()); }
Note: Activities which require OpenGL ES 2.0 should indicate this by setting @lt;uses-feature android:glEsVersion="0x00020000" /> in the activity's AndroidManifest.xml file.
If this method is called, it must be called before
setRenderer(Renderer)
is called.This method only affects the behavior of the default EGLContexFactory and the default EGLConfigChooser. If
setEGLContextFactory(EGLContextFactory)
has been called, then the supplied EGLContextFactory is responsible for creating an OpenGL ES 2.0-compatible context. IfsetEGLConfigChooser(EGLConfigChooser)
has been called, then the supplied EGLConfigChooser is responsible for choosing an OpenGL ES 2.0-compatible config.- Parameters:
version
- The EGLContext client version to choose. Use 2 for OpenGL ES 2.0
-
getRenderMode
public int getRenderMode()
Get the current rendering mode. May be called from any thread. Must not be called before a renderer has been set.- Returns:
- the current rendering mode.
- See Also:
RENDERMODE_CONTINUOUSLY
,RENDERMODE_WHEN_DIRTY
-
requestRender
public void requestRender()
Request that the renderer render a frame. This method is typically used when the render mode has been set toRENDERMODE_WHEN_DIRTY
, so that frames are only rendered on demand. May be called from any thread. Must not be called before a renderer has been set.
-
surfaceChanged
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h)
This method is part of the SurfaceHolder.Callback interface, and is not normally called or subclassed by clients of LeiaGLSurfaceView.- Specified by:
surfaceChanged
in interfaceSurfaceHolder.Callback
-
surfaceRedrawNeededAsync
public void surfaceRedrawNeededAsync(SurfaceHolder holder, Runnable finishDrawing)
This method is part of the SurfaceHolder.Callback2 interface, and is not normally called or subclassed by clients of LeiaGLSurfaceView.- Specified by:
surfaceRedrawNeededAsync
in interfaceSurfaceHolder.Callback2
-
surfaceRedrawNeeded
@Deprecated public void surfaceRedrawNeeded(SurfaceHolder holder)
Deprecated.This method is part of the SurfaceHolder.Callback2 interface, and is not normally called or subclassed by clients of LeiaGLSurfaceView.- Specified by:
surfaceRedrawNeeded
in interfaceSurfaceHolder.Callback2
-
onPause
public void onPause()
Pause the rendering thread, optionally tearing down the EGL context depending upon the value ofsetPreserveEGLContextOnPause(boolean)
. This method should be called when it is no longer desirable for the LeiaGLSurfaceView to continue rendering, such as in response toActivity.onStop
. Must not be called before a renderer has been set.
-
onResume
public void onResume()
Resumes the rendering thread, re-creating the OpenGL context if necessary. It is the counterpart toonPause()
. This method should typically be called inActivity.onStart
. Must not be called before a renderer has been set.
-
queueEvent
public void queueEvent(Runnable r)
Queue a runnable to be run on the GL rendering thread. This can be used to communicate with the Renderer on the rendering thread. Must not be called before a renderer has been set.- Parameters:
r
- the runnable to be run on the GL rendering thread.
-
onAttachedToWindow
protected void onAttachedToWindow()
This method is used as part of the View class and is not normally called or subclassed by clients of LeiaGLSurfaceView.- Overrides:
onAttachedToWindow
in classSurfaceView
-
onDetachedFromWindow
protected void onDetachedFromWindow()
- Overrides:
onDetachedFromWindow
in classSurfaceView
-
-