# Class Media360View

java.lang.Object
com.codename1.ui.Component
com.codename1.ui.Container
com.codename1.vr.Media360View

All Implemented Interfaces:
  `Animation, Editable, StyleListener, Iterable<Component>`

public class Media360View extends Container

A 360 degree panorama viewer: renders an equirectangular image onto the inside of a sphere with drag-to-look navigation and optional gyroscope look. Works everywhere `Display#isGpuSupported()` is true; on platforms without a GPU backend it degrades to the standard "3D not supported" placeholder without crashing.

Mono mode fills the component; `#setStereo(boolean)` renders the same viewpoint side by side for cardboard-style viewers. Photo spheres are captured from a single point, so stereo intentionally uses a zero eye separation - there is no parallax information in the image to reproduce.

360 video is not supported directly because the platform has no path from media frames to GPU textures yet; `#setTextureSource(TextureSource)` is the extension point for dynamic content.

    Media360View pano = new Media360View();
    pano.setImage(EncodedImage.create("/panorama.jpg"));
    form.add(BorderLayout.CENTER, pano);

- ## Field Summary

  ### Fields inherited from class Component

  `BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Media360View()`
  Creates an empty viewer; supply content with `#setImage(Image)` or `#setTextureSource(TextureSource)`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `deinitialize()`
  Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy.
  `float`
  `getPitch()`
  The vertical look angle in degrees, clamped so the view cannot flip over the poles; positive looks up.
  `RenderView`
  `getRenderView()`
  The underlying render view, exposed for advanced integration.
  `float`
  `getYaw()`
  The horizontal look angle in degrees; positive turns right.
  `protected void`
  `initComponent()`
  Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state
  `boolean`
  `isHeadTrackingEnabled()`
  True when gyroscope look-around is enabled.
  `boolean`
  `isStereo()`
  True when rendering side-by-side stereo.
  `boolean`
  `isSupported()`
  True when the current platform provides a 3D backend.
  `protected boolean`
  `mouseWheel(WheelEvent ev)`
  The wheel looks around, the way dragging does.
  `void`
  `pointerDragged(int x, int y)`
  If this Component is focused, the pointer dragged event will call this method
  `void`
  `pointerPressed(int x, int y)`
  If this Component is focused, the pointer pressed event will call this method
  `void`
  `pointerReleased(int x, int y)`
  If this Component is focused, the pointer released event will call this method
  `void`
  `reset()`
  Resets the view to look straight ahead and recenters the gyroscope.
  `void`
  `setHeadTrackingEnabled(boolean enabled)`
  Enables gyroscope look-around, composed with drag navigation.
  `void`
  `setImage(Image image)`
  Shows an equirectangular panorama image (the format produced by 360 cameras and phone panorama modes: longitude maps to X, latitude to Y).
  `void`
  `setPitch(float pitchDegrees)`
  Sets the vertical look angle in degrees.
  `void`
  `setStereo(boolean stereo)`
  Switches between a full-viewport mono view (the default) and side-by-side stereo for cardboard-style viewers.
  `void`
  `setTextureSource(TextureSource source)`
  Installs a dynamic texture source, replacing any static image.
  `void`
  `setYaw(float yawDegrees)`
  Sets the horizontal look angle in degrees.

  ### Methods inherited from class Container

  `add, add, add, add, add, add, addAll, addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, calcPreferredSize, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, getSideGap, getUIManager, initLaf, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isScrollableX, isScrollableY, isSelectableInteraction, isSurface, iterator, iterator, keyPressed, keyReleased, layoutContainer, morph, morphAndWait, paint, paintComponentBackground, paintGlass, paramString, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager, updateTabIndices`

  ### Methods inherited from class Component

  `accessibilityChanged, accessibilityChanged, addContextMenuListener, addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addMouseWheelListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, addStylusListener, animate, announceForAccessibility, bindProperty, blocksSideSwipe, calcScrollSize, consumesRawTextInput, contains, containsOrOwns, createStyleAnimation, deinitializeCustomStyle, deregisterFromAnimation, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAccessibilityNode, getAccessibilityText, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSemantics, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getTopLevelContainer, getUIID, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isHScrollThumbGrabbed, isHScrollThumbHover, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollVisible, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, isVScrollThumbGrabbed, isVScrollThumbHover, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, onSetFocusable, paintBackground, paintBackgrounds, paintBorder, paintBorderBackground, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, registerForAnimation, remove, removeContextMenuListener, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removeMouseWheelListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, removeStylusListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, rotation, scrollRectToVisible, scrollRectToVisible, setAccessibilityText, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setHorizontalScrollBounds, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setPropertyValue, setPullToRefresh, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUIIDFinal, setUnselectedStyle, setVerticalScrollBounds, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface Iterable

  `forEach`

- ## Constructor Details

  - ### Media360View

    public Media360View()
    Creates an empty viewer; supply content with `#setImage(Image)` or `#setTextureSource(TextureSource)`.

- ## Method Details

  - ### isSupported

    public boolean isSupported()
    True when the current platform provides a 3D backend.

  - ### setImage

    public void setImage(Image image)

    Shows an equirectangular panorama image (the format produced by 360 cameras and phone panorama modes: longitude maps to X, latitude to Y). Replaces any previous image or texture source.

    ###### Parameters

    - `image`: the panorama to display

  - ### setTextureSource

    public void setTextureSource(TextureSource source)

    Installs a dynamic texture source, replacing any static image. The extension point for procedural or (future) video content.

    ###### Parameters

    - `source`: the source, or null to remove it

  - ### setStereo

    public void setStereo(boolean stereo)
    Switches between a full-viewport mono view (the default) and side-by-side stereo for cardboard-style viewers.

  - ### isStereo

    public boolean isStereo()
    True when rendering side-by-side stereo.

  - ### setHeadTrackingEnabled

    public void setHeadTrackingEnabled(boolean enabled)
    Enables gyroscope look-around, composed with drag navigation. When the device has no motion sensors this quietly stays drag-only.

  - ### isHeadTrackingEnabled

    public boolean isHeadTrackingEnabled()
    True when gyroscope look-around is enabled.

  - ### getYaw

    public float getYaw()
    The horizontal look angle in degrees; positive turns right.

  - ### setYaw

    public void setYaw(float yawDegrees)
    Sets the horizontal look angle in degrees.

  - ### getPitch

    public float getPitch()
    The vertical look angle in degrees, clamped so the view cannot flip over the poles; positive looks up.

  - ### setPitch

    public void setPitch(float pitchDegrees)
    Sets the vertical look angle in degrees. Clamped to stay off the poles.

  - ### reset

    public void reset()
    Resets the view to look straight ahead and recenters the gyroscope.

  - ### getRenderView

    public RenderView getRenderView()
    The underlying render view, exposed for advanced integration.

  - ### initComponent

    protected void initComponent()
    Description copied from class: `Component`
    Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state
    Overrides:
      `initComponent` in class `Component`

  - ### deinitialize

    protected void deinitialize()
    Description copied from class: `Component`
    Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy. This allows the component to deregister animators and cleanup after itself. This method is the opposite of the initComponent() method.
    Overrides:
      `deinitialize` in class `Component`

  - ### pointerPressed

    public void pointerPressed(int x, int y)
    Description copied from class: `Container`

    If this Component is focused, the pointer pressed event will call this method

    ###### Parameters

    - `x`: the pointer x coordinate

    - `y`: the pointer y coordinate

    Overrides:
      `pointerPressed` in class `Container`

  - ### pointerDragged

    public void pointerDragged(int x, int y)
    Description copied from class: `Component`

    If this Component is focused, the pointer dragged event will call this method

    ###### Parameters

    - `x`: the pointer x coordinate

    - `y`: the pointer y coordinate

    Overrides:
      `pointerDragged` in class `Component`

  - ### pointerReleased

    public void pointerReleased(int x, int y)
    Description copied from class: `Component`

    If this Component is focused, the pointer released event will call this method

    ###### Parameters

    - `x`: the pointer x coordinate

    - `y`: the pointer y coordinate

    Overrides:
      `pointerReleased` in class `Component`

  - ### mouseWheel

    protected boolean mouseWheel(WheelEvent ev)
    The wheel looks around, the way dragging does. This used to come for free: the desktop ports turned a wheel into synthetic drag events, so a panorama followed the trackpad without knowing the wheel existed. Those synthetic events are gone -- they pressed and released on whatever was under the cursor -- so the gesture is handled here directly, at the scale and in the directions the drag above uses.
    Overrides:
      `mouseWheel` in class `Component`