You.i Engine
CYIImageView Class Reference

Detailed Description

A simple view which downloads and renders images.

Overview

SetImage may be provided with a locally-sourced or pre-downloaded image in the form of a CYIAssetTextureBase, or using a CYIUrl indicating a remote resource from which to download and display the image. If downloading the image success is indicated by the emission of ImageAssigned, and failure by ImageAssignmentFailed. When a valid image is available and ready for display it will be displayed according to the SCALE_MODE specified in SetScaleMode or via the "scale-mode" property in the view template. By default the scale mode is SCALE_FILL, meaning that the image will retain its aspect ratio and resize such that it entirely fills the CYIImageView with the excess being cropped.

The initial state of the ImageNode will serve as a placeholder until the first image is applied to it, and again if Reset is called.

When using CYIImageView in a layout it will need to support being re-sized, this usually means that a layout must be applied on the CYIImageView as well in order to make sure that the ImageNode and its decorations are laid out gracefully in response to size changes. For instance, the ImageNode should be marked as a 'background' so that it re-sizes along with the image view enabling the CYIImageView's scaling options to take effect. Note that marking the ImageNode as a background limits the types of animations that can be applied to it, for more information refer to the Animation section.

Note
Image views implement their own scaling logic. As a result, using alignment options with a CYILayout is not supported in image views. The image will always be center-aligned in the CYIImageView.

Animation

CYIImageView can be in one of four visual states and has a series of (optional) timelines representing transitions between those states. These are illustrated below:

ImageViewStates.png

If the view has the "ImageSet" timeline, representing a transition out of the "Placeholder" state and into the "Image" state, then it will begin in the "Placeholder" state; otherwise it will begin in the "Image" state.

Placeholder and Placeholder Failure States

The "Placeholder" state is the initial state of the view if the view contains the "ImageSet" timeline.

The timelines: "ImageSet," "ImageSetFailure," and "ImageSetRecovery" represent the possible transitions in these states.

The "Placeholder" state represents the initial state of the view template, as it appears immediately after CYISceneView::BuildFromTemplate. If an image download fails while the view is in this state, it will transition to the "Placeholder Failure" state using the "ImageSetFailure" timeline. If no "ImageSetFailure" timeline is specified the error will not be represented visually but the ImageAssignmentFailed signal will still be emitted.

If an image is successfully set while the view is in the "Placeholder" state, it will transition to the "Image" state using the "ImageSet" timeline.

If the view is in the "Placeholder Failure" state when the image is set it will transition to the "Image" state using the "ImageSetRecovery" timeline if present, or the "ImageSetFailure" timeline in reverse if present, or finally the "ImageSet" timeline.

If the view is in the "Placeholder Failure" state, subsequent failures will not be visually represented but will still cause the emission of ImageAssignmentFailed.

Once an image has been set on the view successfully the only way to return to these states is via CYIImageView::Reset.

Image and Failure States

Once an image has been set on the view, or if there is no "ImageSet" timeline present, the view is be in the "Image" state.

The timelines: "ImageSwapFailure," "ImageSwapRecovery," and "ImageSwap" represent the possible transitions in these states.

The "Image" state represents the state of the view after CYISceneView::BuildFromTemplate and completion of the "ImageSet" timeline, if present. If an image download fails while the view is in this state, it will transition to the "Failure" state using the "ImageSwapFailure" timeline. If no "ImageSwapFailure" timeline is specified the error will not be represented visually but the ImageAssignmentFailed signal will still be emitted.

If an image is successfully set while the view is in the "Image" state, it will play the "ImageSwap" timeline and remain in the "Image" state. The "ImageSwap" timeline should animate the ImageNode as the incoming image, e.g. fading it in or sliding it into position. If a more complex image swapping animation is required, the optional node 'ImageNode-Outgoing' can be used to represent the image being replaced.

If the view is in the "Failure" state when the image is set it will transition to the "Image" state using the "ImageSwapRecovery" timeline if present, or the "ImageSwapFailure" timeline in reverse if present, or finally the "ImageSwap" timeline.

If the view is in the "Failure" state, subsequent failures will not be visually represented but will still cause the emission of ImageAssignmentFailed.

Important Animation Considerations

If using CYIImageView in a layout it's desirable to ensure proper sizing and placement of sub-components by applying a layout to the CYIImageView itself. Usually, 'ImageNode' is marked as a background in these cases, which prohibits the use of position and anchor point animations as they'll be overwritten immediately by layout.

If animating items into and out of the view's bounds it may be desirable to enable clipping on CYIImageView via CYISceneNode::SetClippingOn or the "clip" property of the view template.

View Template Specification

Type Labels Property Description
Node ImageNode Required The node that will be used to render the image. When using the 'ImageSwap' timeline, represents the incoming image. See Animation for more details.
Node ImageNode-Outgoing Optional When using the 'ImageSwap' timeline, represents the outgoing image. See Animation for more details.
Marker ImageSet Optional Played when switching from the default image (as it appears in the view template, or after calling Reset()). See Animation for more details.
Marker ImageSetFailure Optional Played when switching from the default image (as it appears in the view template, or after calling Reset())image fails. See Animation for more details.
Marker ImageSetRecovery Optional Played when recovering from a placeholder to image transition failure. See Animation for more details.
Marker ImageSwap Optional Played when swapping between images, except when switching from the default image (as it appears in the view template, or after calling Reset()) image. See Animation for more details.
Marker ImageSwapFailure Optional Played when swapping between images fails. See Animation for more details.
Marker ImageSwapRecovery Optional Played when recovering from an image swapping failure. See Animation for more details.
Comment mipmapping Optional Values can be true or false. By default, the value is false.
Comment scale-mode Optional The scaling mode which will be applied to the image node. Valid values are stretch, fill, fill-with-overflow, fit, actual-size, and actual-size-with-overflow. Defaults to fit.
See also
SCALE_MODE
Comment repeat-mode Optional The repeat mode which will be applied when the image is smaller than the 'ImageNode' size. Valid values are none, tile, mirror, clamp. The default value is 'none'.
See also
REPEAT_MODE

#include <view/YiImageView.h>

Inheritance diagram for CYIImageView:

Public Types

enum  SCALE_MODE {
  SCALE_STRETCH = 0,
  SCALE_FILL,
  SCALE_FILL_WITH_OVERFLOW,
  SCALE_FIT,
  SCALE_ACTUAL_SIZE,
  SCALE_ACTUAL_SIZE_WITH_OVERFLOW
}
 
enum  REPEAT_MODE {
  REPEAT_NONE,
  REPEAT_TILE,
  REPEAT_MIRROR,
  REPEAT_CLAMP_TO_EDGE
}
 
- Public Types inherited from CYISceneView
enum  ASSET_REQUIREMENT_TYPE {
  REQUIRES_NODE,
  REQUIRES_TIMELINE
}
 
enum  TIMELINE_GET_MODE {
  GET_DEFAULT,
  GET_TIMELINE,
  GET_TIMELINE_GROUP,
  GET_COMPONENT_OF_TIMELINE_GROUP
}
 
- Public Types inherited from CYISceneNode
enum  DirtyFlag {
  DirtyClean = 0x0000,
  DirtySceneGraph = 0x0001,
  DirtyVisibility = 0x0002,
  DirtyOpacity = 0x0004,
  DirtyLocalTransform = 0x0008,
  DirtyWorldTransform = 0x0010,
  DirtyUniform = 0x0020,
  DirtyWorldBoundingBox = 0x0040,
  DirtyMesh = 0x0080,
  DirtyWorldSurfaceScale = 0x0100,
  DirtyWorldScale = 0x0200,
  DirtyLocalBoundingBox = 0x0400,
  DirtyEverything = (DirtySceneGraph | DirtyVisibility | DirtyOpacity | DirtyLocalTransform | DirtyWorldTransform | DirtyUniform | DirtyWorldBoundingBox | DirtyWorldSurfaceScale | DirtyWorldScale | DirtyLocalBoundingBox)
}
 
enum  LayoutDirtyFlag {
  LayoutClean,
  LayoutChildDirty,
  LayoutDirty
}
 
enum  LayoutConfigFetchMode {
  LAYOUT_CONFIG_DO_NOT_LAZY_INSTANTIATE = 0,
  LAYOUT_CONFIG_LAZY_INSTANTIATE
}
 
enum  MeasureMode {
  MEASURE_UNSPECIFIED,
  MEASURE_UP_TO,
  MEASURE_EXACTLY
}
 
enum  FETCH_TYPE {
  FETCH_OPTIONAL = 0,
  FETCH_MANDATORY
}
 
typedef std::reverse_iterator< IteratorReverseIterator
 
- Public Types inherited from CYIEventTarget
enum  EVENT_PHASE {
  BUBBLE,
  CAPTURE
}
 

Public Member Functions

 CYIImageView ()
 
virtual ~CYIImageView ()
 
virtual bool Init () override
 
void SetScaleMode (SCALE_MODE eScaleMode)
 
SCALE_MODE GetScaleMode () const
 
void SetRepeatMode (REPEAT_MODE eRepeatMode)
 
REPEAT_MODE GetRepeatMode () const
 
void SetMipmappingEnabled (bool bEnable)
 
bool IsMipmappingEnabled () const
 
void SetImage (const std::shared_ptr< CYIAssetTextureBase > &pTexture)
 
void SetImage (const CYIUrl &url)
 
virtual void Reset () override
 
void SetOverlayTextColor (const CYIColor &color)
 
void SetOverlayTextSize (const uint32_t &nFontSize)
 
void SetOverlayTextFontID (const ssize_t &nFontID)
 
void SetOverlayText (const CYIString &text)
 
virtual void OnImageHasChanged ()
 
CYISceneNodeGetImageNode () const
 
void SetImageUrl (const CYIUrl &url)
 
const CYIUrlGetImageUrl () const
 
virtual void Measure (const MeasureSpec &widthSpec, const MeasureSpec &heightSpec, const MeasureSpec &depthSpec) override
 
virtual void ApplyMeasurements () override
 
- Public Member Functions inherited from CYISceneView
 CYISceneView ()
 
virtual ~CYISceneView ()
 
bool BuildFromTemplate (CYISceneManager *pSceneManager, const std::shared_ptr< CYIAssetViewTemplate > &pAssetViewTemplate, CYISceneManager::MISSING_CLASS_HANDLING_MODE eMissingHandlingMode=CYISceneManager::ABORT)
 
bool IsInitialized () const
 
void SetClippingAreaNode (CYISceneNode *pClippingNode)
 
virtual bool GetProperty (const CYIString &propertyName, CYIString *pValue) const override
 
void EnableDefaultHitZone ()
 
bool IsResponsiveLayoutEnabled () const
 
void EnableResponsiveLayout ()
 
void DisableResponsiveLayout ()
 
void AddAnchor (YI_ANCHOR_TYPE anchorType)
 
YI_ANCHOR_DATA GetAnchor (YI_ANCHOR_TYPE anchorType) const
 
virtual const CYISceneView::AssetRequirementGetAssetRequirements (uint32_t *pRequirementCount)
 
CYIAbstractTimelineGetInTimeline () const
 
CYIAbstractTimelineGetOutTimeline () const
 
CYIAbstractTimelineGetFocusInTimeline () const
 
CYIAbstractTimelineGetFocusOutTimeline () const
 
virtual bool HandlesFocusInDescendants () const
 
virtual bool RequestFocus (CYIFocus::FOCUS_DIRECTION eDirection=CYIFocus::FOCUS_FORWARD, CYIFocus::FOCUS_ROOT_RULE eFocusRootRule=CYIFocus::FOCUS_ROOT_DESCENDANTS_UPDATE_CONTEXT, const CYIAABB &previousFocusRect=CYIAABB(), const CYIFocusSearchOptions &options=CYIFocusSearchOptions())
 
bool HasFocus () const
 
void SetFocusable (bool bFocusable)
 
bool IsFocusable () const
 
bool CanBeFocused () const
 
void SetNextFocus (CYISceneView *pView, CYIFocus::FOCUS_DIRECTION eDirection)
 
CYISceneViewGetNextFocus (CYIFocus::FOCUS_DIRECTION eDirection) const
 
void SetInitiallyFocusedView (CYISceneView *pView)
 
CYISceneViewGetInitiallyFocusedView () const
 
CYISceneViewFindNextFocus (CYIFocus::FOCUS_DIRECTION eDirection, const CYIFocusSearchOptions &options=CYIFocusSearchOptions()) const
 
CYISceneViewFindNextFocus (CYIFocus::FOCUS_DIRECTION eDirection, CYIAABB &screenSpaceFocusRegion, const CYIFocusSearchOptions &options=CYIFocusSearchOptions()) const
 
virtual CYISceneViewFindNextFocusInDescendants (const CYISceneView *pCurrentFocusView, CYIFocus::FOCUS_DIRECTION eDirection, CYIAABB &screenSpaceFocusRegion, const CYIFocusSearchOptions &options=CYIFocusSearchOptions()) const
 
const CYISceneNodeGetFocusRoot () const
 
CYISceneViewGetFocusHandler () const
 
virtual void OnFocusGained ()
 
virtual void FocusGained ()
 
virtual void OnFocusLost ()
 
virtual void FocusLost ()
 
const std::shared_ptr< CYIAssetViewTemplate > & GetViewTemplate () const
 
const std::vector< CYIString > & GetChildTemplateNames ()
 
virtual CYIAbstractTimelineGetTimeline (const CYIString &rMarkerName, TIMELINE_GET_MODE eMode=GET_DEFAULT)
 
CYIAbstractTimelineGetTimeline (CYIMarkerData::MARKER_ID eID, TIMELINE_GET_MODE eMode=GET_DEFAULT)
 
std::map< CYIString, CYITimeline * > GetTimelines () const
 
bool FindTimeline (CYIAbstractTimeline *&pTimeline, const CYIString &markerName, FETCH_TYPE eType, const CYIString &tag="", TIMELINE_GET_MODE eMode=GET_DEFAULT)
 
CYITimelineGroupGetTimelineGroup (const CYIString &markerName)
 
std::unique_ptr< CYITimelineGroupBuildTimelineGroup (const CYIString &markerName)
 
void BuildAnchorList ()
 
void SetLayout (std::unique_ptr< CYILayout > pLayout)
 
const CYILayoutGetLayout () const
 
CYILayoutGetLayout ()
 
virtual void BuildDrawList (std::vector< IYIRenderer::Command > &children, CYIAbstractCameraSceneNode *pCameraToDrawWith=nullptr) override
 
- Public Member Functions inherited from CYISceneNode
 CYISceneNode ()
 
virtual ~CYISceneNode ()
 
void ForceDirty ()
 
void ClearDirtyFlag ()
 
void SetDirtyFlag (DirtyFlag eDirtyFlag)
 
DirtyFlag GetDirtyFlag () const
 
DirtyFlag GetPreviousDirtyFlag () const
 
const CYIStringGetName () const
 
CYIString GetUniqueName () const
 
void SetSceneManager (CYISceneManager *pSceneManager)
 
void SetName (const CYIString &name)
 
int32_t GetID () const
 
void SetID (int32_t nID)
 
uint64_t GetUniqueID () const
 
bool AddChild (std::unique_ptr< CYISceneNode > pSceneNode)
 
bool AddChild (std::unique_ptr< CYISceneNode >, int32_t nIndex)
 
bool InsertChildAfter (CYISceneNode *pRefNode, std::unique_ptr< CYISceneNode > pSceneNode)
 
std::unique_ptr< CYISceneNodeRemoveChild (CYISceneNode *pSceneNode)
 
bool ReorderChild (uint32_t uFromIndex, uint32_t uToIndex)
 
CYISceneNodeGetParent () const
 
bool ChangeParent (CYISceneNode *pParent)
 
CYISceneNodeGetDrawParent () const
 
bool IsAncestorOf (const CYISceneNode *pNode) const
 
CYISceneManagerGetSceneManager () const
 
uint32_t GetChildCount () const
 
uint32_t GetChildCountRecursive () const
 
CYISceneNodeGetChild (uint32_t nIndex) const
 
Iterator begin (Iterator::ITERATION_MODE eMode=Iterator::IMMEDIATE_CHILDREN) const
 
Iterator end (Iterator::ITERATION_MODE eMode=Iterator::IMMEDIATE_CHILDREN) const
 
ReverseIterator rbegin (Iterator::ITERATION_MODE eMode=Iterator::IMMEDIATE_CHILDREN) const
 
ReverseIterator rend (Iterator::ITERATION_MODE eMode=Iterator::IMMEDIATE_CHILDREN) const
 
CYISceneNodeGetChild (const CYIString &sName) const
 
uint32_t GetDrawChildCount () const
 
CYISceneNodeGetDrawChild (uint32_t uIndex) const
 
CYISceneNodeGetDrawChildByID (int32_t nID) const
 
template<class YI_SCENE_NODE_SUBCLASS >
YI_SCENE_NODE_SUBCLASS * GetChild (uint32_t uTargetMatchedNodeCount=1) const
 
template<class YI_SCENE_NODE_SUBCLASS >
std::list< YI_SCENE_NODE_SUBCLASS * > GetChildren () const
 
int32_t GetIndexOfChild (const CYISceneNode *pSceneNode) const
 
void Show ()
 
void Hide ()
 
void SetVisibility (bool bVisible)
 
void SetOpacity (float fOpacity)
 
float GetCompositeOpacity () const
 
float GetLocalOpacity () const
 
bool IsVisible () const
 
bool IsTrulyVisible () const
 
CYISceneNodeGetNode (const CYIString &name)
 
CYISceneNodeGetNode (const CYIString &name, const CYIRuntimeTypeInfo &enforceClassType)
 
CYISceneNodeGetNode (const CYIRuntimeTypeInfo &enforceClassType)
 
CYISceneNodeGetNodeAfterTarget (const CYIRuntimeTypeInfo &enforceClassType, CYISceneNode *pStartAfterTarget)
 
template<class YI_SCENE_NODE_SUBCLASS >
YI_SCENE_NODE_SUBCLASS * GetNode (const CYIString &name)
 
CYISceneNodeGetNode (const int32_t nID)
 
CYISceneNodeGetNode (const int32_t nID, const CYIRuntimeTypeInfo &enforceClassType)
 
template<class YI_SCENE_NODE_SUBCLASS >
bool FindNode (YI_SCENE_NODE_SUBCLASS *&pNode, const CYIString &nodeName, FETCH_TYPE eType, const CYIString &tag)
 
std::list< CYISceneNode * > GetNodes (const CYIString &name)
 
std::list< CYISceneNode * > GetNodes (int32_t nID)
 
std::list< CYISceneNode * > GetNodes (const CYIRuntimeTypeInfo &enforceClassType)
 
template<class YI_SCENE_NODE_SUBCLASS >
const YI_SCENE_NODE_SUBCLASS * GetNode (uint32_t uTargetMatchedNodeCount=1) const
 
template<class YI_SCENE_NODE_SUBCLASS >
YI_SCENE_NODE_SUBCLASS * GetNode (uint32_t uTargetMatchedNodeCount=1)
 
void SetMesh (const std::shared_ptr< CYIMesh > &pMesh)
 
void SetMaterial (const std::shared_ptr< CYIMaterial > &pMaterial, uint32_t nIndex=0)
 
void AddEffect (const std::shared_ptr< CYIEffect > &pEffect)
 
void RemoveEffect (const std::shared_ptr< CYIEffect > &pEffect)
 
uint32_t GetEffectCount () const
 
std::shared_ptr< CYIEffectGetEffect (uint32_t uIndex) const
 
void ConnectEffectsToTimelines (const CYITimelineTrack *pTrack)
 
void AddMask (std::unique_ptr< CYIMask > pMask)
 
std::unique_ptr< CYIMaskRemoveMask (const CYIMask *pMask)
 
uint32_t GetMaskCount () const
 
const CYIMaskGetMask (uint32_t uIndex) const
 
CYIMaskGetMask (uint32_t uIndex)
 
const std::shared_ptr< CYIMesh > & GetMesh () const
 
uint32_t GetMaterialCount () const
 
const std::shared_ptr< CYIMaterialGetMaterial (uint32_t nIndex=0) const
 
const std::shared_ptr< IYIUniformBufferObject > & GetShaderUniforms () const
 
void SetMeshTransform (const glm::mat4 &rTransform)
 
void DestroyChildren ()
 
const glm::mat4 & GetLocalTransform () const
 
const glm::mat4 & GetEffectTransform () const
 
const glm::mat4 & GetWorldTransform () const
 
bool Intersects (const CYISceneNode *pNode) const
 
void SetRenderTarget (const std::shared_ptr< CYIRenderTarget > &pRenderTarget)
 
const std::shared_ptr< CYIRenderTargetGetRenderTarget () const
 
const CYIAABBGetWorldAABB () const
 
const CYIAABBGetLocalAABB () const
 
void SetAnchorPoint (const glm::vec3 &ref)
 
void SetAnchorPoint (float fX, float fY, float fZ)
 
void SetAnchorPointX (float fX)
 
void SetAnchorPointY (float fY)
 
void SetAnchorPointZ (float fZ)
 
void SetPosition (const glm::vec3 &ref)
 
void SetPosition (float fX, float fY, float fZ)
 
void SetPositionX (float fX)
 
void SetPositionY (float fY)
 
void SetPositionZ (float fZ)
 
void SetRotation (const glm::vec3 &fEulerDegrees)
 
void SetRotation (float fPitchDegrees, float fYawDegrees, float fRollDegrees)
 
void SetRotationX (float fPitchDegrees)
 
void SetRotationY (float fYawDegrees)
 
void SetRotationZ (float fRollDegrees)
 
void SetOrientation (float fPitchDegrees, float fYawDegrees, float fRollDegrees)
 
void SetOrientation (const glm::quat &orient)
 
void SetScale (const glm::vec3 &fScaleFactors)
 
void SetScale (float fFactorX, float fFactorY, float fFactorZ)
 
void SetScaleX (float fFactor)
 
void SetScaleY (float fFactor)
 
void SetScaleZ (float fFactor)
 
const glm::vec3 & GetPosition () const
 
const glm::vec3 & GetScale () const
 
const glm::vec3 & GetWorldScale () const
 
const glm::vec3 & GetWorldSurfaceScale () const
 
const glm::vec3 & GetRotation () const
 
const glm::quat & GetOrientation () const
 
const glm::vec3 & GetAnchorPoint () const
 
virtual void SetSize (const glm::vec3 &vSize, bool bDirtyLayout=true)
 
const glm::vec3 & GetSize () const
 
const glm::vec3 & GetInitialSize () const
 
void SetMeasuredSize (const glm::vec3 &vMeasuredSize)
 
const glm::vec3 & GetMeasuredSize () const
 
void SetInternalCustomTimelineValue (uint32_t nTrackID, const CYIVariant &value)
 
virtual void SetCustomTimelineValue (uint32_t nTrackID, const CYIVariant &value)
 
void SetClippingOn ()
 
void SetClippingOff ()
 
bool GetClipping () const
 
void SetClippingBox (const CYIAABB &rWorldBox)
 
const CYIAABBGetClippingBox () const
 
void StartPropertyAnimation (YI_NODE_PROPERTY_TYPE ePropType, float fFrom, float fTo, uint32_t nDurMs, CYITimeInterpolator *pTimeInterpolator=nullptr, bool bDirtyLayout=true)
 
void StopPropertyAnimation (YI_NODE_PROPERTY_TYPE ePropType)
 
void UpdateLocalSpaceCollision (CYIActionEvent *pActionEvent)
 
virtual bool BroadcastEvent (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent)
 
void UpdateEventForLocalSpace (CYIActionEvent *pActionEvent, glm::vec3 &rayOrigin, glm::vec3 &rayNonOriginPoint) const
 
bool IsBoundingBoxHit (const CYIRay &rWorldSpaceRay) const
 
bool IsMeshHit (const CYIRay &rWorldSpaceRay) const
 
void DumpTree () const
 
void StartCaptureKeyboardEvents ()
 
void StopCaptureKeyboardEvents ()
 
void StartCaptureTrackpadEvents ()
 
void StopCaptureTrackpadEvents ()
 
void StartCapturePointerEvents (uint8_t uPointerID)
 
void StopCapturePointerEvents (uint8_t uPointerID)
 
bool DrawBehindChildren (CYISceneNode *pSceneNode)
 
bool DrawInFrontOfChildren (CYISceneNode *pSceneNode)
 
bool DrawBehind (CYISceneNode *pSceneNode)
 
bool DrawInFront (CYISceneNode *pSceneNode)
 
bool IsFocusRoot () const
 
void SetIsFocusRoot (bool bIsFocusRoot)
 
virtual void OnFocusGainedInDescendants ()
 
virtual void FocusGainedInDescendants ()
 
virtual void OnFocusLostInDescendants ()
 
virtual void FocusLostInDescendants ()
 
virtual void OnFocusChangedInDescendants ()
 
virtual void FocusChangedInDescendants ()
 
virtual bool ContainsFocusableDescendant (const CYIFocusSearchOptions &options=CYIFocusSearchOptions()) const
 
void ShowPointerDebugNode (CYIActionEvent *pActionEvent)
 
void SetUseLocalTransformAndAlpha (bool bUse)
 
virtual const std::map< CYIString, CYIString > & GetProperties () const override
 
void SetProperty (const CYIString &rPropertyName, const CYIString &rPropertyValue)
 
const std::shared_ptr< CYISceneNodeProxy > & GetSceneNodeProxy () const
 
void SetLayoutConfig (std::unique_ptr< CYILayoutConfig > pLayoutConfig)
 
const CYILayoutConfigGetLayoutConfig (LayoutConfigFetchMode eFetchMode=LAYOUT_CONFIG_LAZY_INSTANTIATE) const
 
CYILayoutConfigGetLayoutConfig (LayoutConfigFetchMode eFetchMode=LAYOUT_CONFIG_LAZY_INSTANTIATE)
 
void SetLayoutState (std::unique_ptr< CYILayoutState > pLayoutState)
 
const CYILayoutStateGetLayoutState () const
 
CYILayoutStateGetLayoutState ()
 
void RequestLayout ()
 
LayoutDirtyFlag GetLayoutDirtyFlag () const
 
virtual void SetLayoutDirtyFlag (LayoutDirtyFlag eFlag)
 
CYIAbstractCameraSceneNodeFindActiveCamera () const
 
template<typename T >
bool CanCastTo () const
 
- Public Member Functions inherited from CYIEventTarget
 CYIEventTarget ()
 
virtual ~CYIEventTarget ()
 
bool AddEventListener (YI_EVENT_TYPE eEventType, CYIEventHandler *pListener, EVENT_PHASE ePhase=BUBBLE)
 
bool RemoveEventListener (YI_EVENT_TYPE eEventType, CYIEventHandler *pListener, EVENT_PHASE ePhase=BUBBLE)
 
void SetSpecialTypeFlag (YI_SPECIAL_EVENT_TARGET_TYPE eType)
 
void ClearSpecialTypeFlag (YI_SPECIAL_EVENT_TARGET_TYPE eType)
 
YI_SPECIAL_EVENT_TARGET_TYPE GetSpecialTypes () const
 
- Public Member Functions inherited from CYIScriptableRTTIObject
 CYIScriptableRTTIObject ()
 
virtual ~CYIScriptableRTTIObject ()
 
virtual const CYIRuntimeTypeInfoGetRuntimeTypeInfoForScriptObject () const override
 
- Public Member Functions inherited from CYIScriptableObject
 CYIScriptableObject ()
 
 CYIScriptableObject (const CYIScriptableObject &other)
 
CYIScriptableObjectoperator= (const CYIScriptableObject &other)
 
virtual ~CYIScriptableObject ()
 
CYIBindingImplementationGetBindingImplementation () const
 
void SetBindingImplementation (CYIBindingImplementation *pBindingImplementation)
 
- Public Member Functions inherited from CYISignalHandler
 CYISignalHandler ()
 
 CYISignalHandler (const CYISignalHandler &rSignalHandler)
 
virtual ~CYISignalHandler ()
 
CYISignalHandleroperator= (const CYISignalHandler &rSignalHandler)
 
void MoveToThread (CYIThread *pThread)
 This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More...
 
CYIThreadHandle GetThreadAffinity () const
 
void SetThreadAffinity (const CYIThreadHandle &rThreadAffinity)
 
virtual bool IsConnected () const
 
virtual bool IsConnected (const CYISignalBase &rSignal) const
 
void Disconnect (CYISignalBase &rSignal)
 
void DisconnectFromAllSignals ()
 
- Public Member Functions inherited from CYIThread::Listener
 Listener ()
 
virtual ~Listener ()
 
virtual void OnThreadStarted (CYIThread *)
 
virtual void OnThreadTerminated (CYIThread *)
 
virtual void OnThreadFinished (CYIThread *)
 
- Public Member Functions inherited from IYIPropertiesSource
virtual ~IYIPropertiesSource ()
 
- Public Member Functions inherited from CYIEventHandler
 CYIEventHandler ()
 
 CYIEventHandler (const CYIEventHandler &)
 
virtual ~CYIEventHandler ()
 
CYIEventHandleroperator= (const CYIEventHandler &)
 
bool RegisterEventFilter (CYIEventFilter *pFilter)
 
bool UnregisterEventFilter (CYIEventFilter *pFilter)
 
bool PreFilter (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent)
 
bool PostFilter (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent)
 
bool AreEventsEnabled () const
 
void EnableEvents (bool bEnable)
 

Public Attributes

CYISignal ImageAssigned
 
CYISignal< const CYIString & > ImageAssignmentFailed
 
- Public Attributes inherited from CYISceneView
CYISignal< CYISceneView * > GainedFocus
 Emitted when focus has entered this view. More...
 
CYISignal< CYISceneView * > LostFocus
 Emitted when focus has left this view. More...
 
- Public Attributes inherited from CYISceneNode
CYISignal< CYISceneNode *, YI_NODE_PROPERTY_TYPEPropertyAnimationComplete
 
CYISignal DescendantGainedFocus
 Emitted when focus has entered this tree. More...
 
CYISignal DescendantLostFocus
 Emitted when focus has left this tree. More...
 
CYISignal DescendantsChangedFocus
 Emitted when focus has changed within this tree. More...
 

Protected Attributes

float m_fImagePlaceholderWidth
 
float m_fImagePlaceholderHeight
 
float m_fImagePlaceholderAspectRatio
 
glm::vec3 m_imagePlaceholderAnchorPoint
 
CYISceneNodem_pImageNode
 
CYITextSceneNodem_pDefaultTextNode
 
CYIString m_sDefaultText
 
CYIColor m_DefaultTextColor
 
int32_t m_nDefaultFontSize
 
ssize_t m_nDefaultFontID
 
SCALE_MODE m_eScaleMode
 
REPEAT_MODE m_eRepeatMode
 
bool m_bUseMipmapping
 
CYIUrl m_ImageUrl
 
std::shared_ptr< CYIAssetTexturem_pTextAsset
 
std::shared_ptr< CYIMeshm_pImagePlaceholderMesh
 
std::shared_ptr< CYIMaterialm_pImagePlaceholderMaterial
 
- Protected Attributes inherited from CYISceneView
bool m_bStopEventPropagation
 
bool m_bResponsiveLayoutEnabled
 
bool m_bSceneTreeBuilt
 
bool m_bInAnimatedPosition
 
CYISceneNodem_pClippingNode
 
CYIAbstractTimelinem_pFocusInTimeline
 
CYIAbstractTimelinem_pFocusOutTimeline
 
std::unique_ptr< CYILayoutm_pLayout
 
std::shared_ptr< CYIAssetViewTemplatem_pAssetViewTemplate
 
std::shared_ptr< CYISceneNodeProxym_pInitiallyFocusedView
 
std::multimap< YI_ANCHOR_TYPE, YI_ANCHOR_DATAm_anchors
 
std::map< CYIString, std::unique_ptr< CYITimeline > > m_timelines
 
std::map< CYIString, std::unique_ptr< CYIParallelTimelineGroup > > m_timelineGroups
 
- Protected Attributes inherited from CYISceneNode
CYIString m_name
 
CYISceneNodem_pParent
 
CYISceneNodem_pDrawParent
 
CYISceneManagerm_pSceneManager
 
std::vector< std::unique_ptr< CYISceneNode > > m_children
 
std::vector< CYISceneNode * > m_drawChildren
 
std::map< CYIString, CYIStringm_Properties
 
std::vector< std::shared_ptr< CYIMaterial > > m_pMaterials
 
std::vector< std::unique_ptr< CYIMask > > m_Masks
 
std::vector< std::shared_ptr< CYIEffect > > m_Effects
 
std::vector< PropertyAnimation * > m_propertyAnimations
 
float m_fLocalOpacity
 
CYIAABB m_WSClipBox
 
glm::mat4 m_EffectTransform
 
glm::quat m_Orientation
 
glm::vec3 m_Rotate
 
glm::vec3 m_AnchorPoint
 
glm::vec3 m_Position
 
glm::vec3 m_Scale
 
glm::vec3 m_vSize
 
glm::vec3 m_vInitialSize
 
glm::vec3 m_vMeasuredSize
 
glm::vec3 m_vlsLastCollision
 
bool m_bClip
 
bool m_bIsRotated
 
bool m_bIsOriented
 
bool m_bLocalVisibility
 
int32_t m_nID
 
uint64_t m_uGUID
 
std::shared_ptr< CYIRenderTargetm_pRenderTarget
 
std::shared_ptr< CYIMeshm_pMesh
 
std::shared_ptr< IYIUniformBufferObjectm_pShaderUniforms
 
- Protected Attributes inherited from CYIEventTarget
YI_SPECIAL_EVENT_TARGET_TYPE m_eSpecialTypes
 
std::vector< EventListenerEntry > m_listeners
 
- Protected Attributes inherited from CYIEventHandler
bool m_bEnableEvents
 

Additional Inherited Members

- Static Public Member Functions inherited from CYISceneView
static void RegisterAllViews ()
 
- Static Public Member Functions inherited from CYISceneNode
static void RegisterAllSceneNodes ()
 
- Static Public Attributes inherited from CYISceneNode
static const float OPACITY_NOT_VISIBLE_EPSILON
 
- Protected Member Functions inherited from CYISceneView
void UpdateClipping ()
 
virtual void WorldScaleUpdated () override
 
virtual void WorldBoundingBoxUpdated () override
 
virtual void OnViewReflowed (const glm::vec3 &worldScale)
 
virtual void ViewReflowed (const glm::vec3 &worldScale)
 
virtual bool HandleEvent (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent) override
 
virtual bool ProcessEvent (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent) override
 
void UpdateResponsiveLayoutAnchors ()
 
virtual void SizeChanged () override
 
virtual void ChildNeedsLayout () override
 
virtual void LayoutDirtied () override
 
virtual void ChildAdded (CYISceneNode *pChild) override
 
virtual void ChildRemoved (CYISceneNode *pChild) override
 
virtual void ChildVisibilityChanged (CYISceneNode *pChild) override
 
void OnViewIsInAnimatedPosition ()
 
void OnViewIsGoingOutOfAnimatedPosition ()
 
void SetInTimeline (CYIAbstractTimeline *pTimeline)
 
void SetOutTimeline (CYIAbstractTimeline *pTimeline)
 
virtual void OnInit ()
 
bool TryRequestFocusOnInitiallyFocusedView ()
 
- Protected Member Functions inherited from CYISceneNode
void Update (bool bForceDirty=false)
 
virtual void OnUpdateBegin ()
 
virtual void UpdateBegin ()
 
virtual void OnUpdateEnd ()
 
virtual void UpdateEnd ()
 
virtual void OnDirtyFlagChanged ()
 
virtual void DirtyFlagChanged ()
 
virtual void OnTransformUpdated ()
 
virtual void TransformUpdated ()
 
virtual void OnWorldScaleUpdated ()
 
virtual void OnWorldSurfaceScaleUpdated ()
 
virtual void WorldSurfaceScaleUpdated ()
 
virtual void OnVisibilityUpdated ()
 
virtual void VisibilityUpdated ()
 
virtual void OnCompositeOpacityUpdated ()
 
virtual void CompositeOpacityUpdated ()
 
virtual void OnWorldBoundingBoxUpdated ()
 
virtual void OnLocalBoundingBoxUpdated ()
 
virtual void LocalBoundingBoxUpdated ()
 
virtual void OnChildAdded (CYISceneNode *pChild)
 
virtual void OnChildRemoved (CYISceneNode *pChild)
 
virtual void OnSizeChanged ()
 
virtual void CalculateLocalTransform (glm::mat4 *pTransform) const
 
virtual void OnChildVisibilityChanged (CYISceneNode *pChild)
 
LayoutDirtyFlag GetCurrentLayoutDirtyFlag () const
 
virtual CYIString GetDumpTreeString () const
 
void DumpTree (int32_t nIndentLevel) const
 
void SetShaderUniforms ()
 
virtual void SetCustomUniforms ()
 
template<class T >
void SetNodeType ()
 
virtual CYISceneNodeGetNodeFromChildren (const CYIString &name)
 
virtual CYISceneNodeGetNodeFromChildren (const int32_t nID)
 
virtual CYISceneNodeGetNodeFromChildren (const CYIRuntimeTypeInfo &enforceClassType)
 
CYISceneNodeGetNodeFromChildrenAfterTarget (const CYIRuntimeTypeInfo &enforceClassType, bool *pbTargetReached, CYISceneNode *pStartAfterTarget)
 
- Protected Member Functions inherited from CYIScriptableRTTIObject
virtual std::pair< const CYIRuntimeTypeInfo *, const void * > GetRuntimeTypeInfoWithObject () const =0
 

Member Enumeration Documentation

The repeat mode determines how the image will repeat within the 'ImageNode'. The repeat mode will only have a visual effect when there is empty space after scaling in the 'ImageNode'.

Warning
Not all devices support the use of REPEAT_TILE or REPEAT_MIRROR with non-power-of-two texture sizes. A power-of-two texture size is a texture which has a height and width that are a power-of-two, for example a 256x128 texture. If a device does not support this and the image has a non-power-of-two texture size the image will not be rendered. It is recommended when using these modes that the image texture width and height are power-of-two.
See also
SetRepeatMode
Enumerator
REPEAT_NONE 

The image will not repeat.

REPEAT_TILE 

The image will be tiled within empty space of the 'ImageNode'.

REPEAT_MIRROR 

Similar tiling to REPEAT_TILE except the tiles adjacent to the image will be the mirror image of the image.

REPEAT_CLAMP_TO_EDGE 

The edge pixels of the image are stretched to the size of 'ImageNode'.

The scale mode determines how the image will be scaled to fit within the 'ImageNode'.

See also
SetScaleMode
Enumerator
SCALE_STRETCH 

Will stretch the image to fill the 'ImageNode'. The aspect ratio of the image is not retained.

SCALE_FILL 

Will proportionally scale the image to fill the 'ImageNode', with the excess being cropped.

SCALE_FILL_WITH_OVERFLOW 

Will proportionally scale the image to fill the 'ImageNode', with the excess overflowing beyond the bounds of the image view.

SCALE_FIT 

Will proportionally scale the image to fit within the bounds of the 'ImageNode'. There may be negative space in the form of letterboxing or pillarboxing.

SCALE_ACTUAL_SIZE 

The original size and aspect ratio of the image will be retained, and it will be centered in the middle of the 'ImageNode' with its overflow cropped.

SCALE_ACTUAL_SIZE_WITH_OVERFLOW 

The original size and aspect ratio of the image will be retained, and it will overflow the bounds of the 'ImageNode'.

Constructor & Destructor Documentation

CYIImageView::CYIImageView ( )
virtual CYIImageView::~CYIImageView ( )
virtual

Member Function Documentation

virtual void CYIImageView::ApplyMeasurements ( )
overridevirtual

Applies the measured sizes of this node's children.

Note
Typically, if ApplyMeasurements is overridden then Measure must also be overridden.
Measurements should be applied before calculating position for layout.
Warning
Subclasses that override this function must ensure that the ApplyMeasurements function of ALL children of this scene node is called.
Note
Subclasses that override this function should make use of the GetCurrentLayoutDirtyFlag() function (rather than GetLayoutDirtyFlag() ).

Reimplemented from CYISceneView.

CYISceneNode* CYIImageView::GetImageNode ( ) const

Returns the node containing the image that's being displayed.

const CYIUrl& CYIImageView::GetImageUrl ( ) const

Returns the last set image URL associated with this view.

Note
The returned URL maybe not be from the last image set on the view. SetImageUrl() sets the URL but does not initiate a download.
See also
SetImage
SetImageUrl
REPEAT_MODE CYIImageView::GetRepeatMode ( ) const

Returns the current repeat mode applied to the image view.

See also
REPEAT_MODE
SetRepeatMode
SCALE_MODE CYIImageView::GetScaleMode ( ) const

Returns the scale mode of the image view.

See also
SetScaleMode
virtual bool CYIImageView::Init ( )
overridevirtual

Initializes the view and all of its content. Subclasses must call CYISceneView::Init().

Note
This must be called after CYISceneView::BuildFromTemplate()

Reimplemented from CYISceneView.

bool CYIImageView::IsMipmappingEnabled ( ) const
virtual void CYIImageView::Measure ( const MeasureSpec widthSpec,
const MeasureSpec heightSpec,
const MeasureSpec depthSpec 
)
overridevirtual

Measures this scene node, considering the layout configuration constraints (if available) and the provided measure specifications. The Measure function is used by the layout system to determine the 'desired' size of elements in a container. The result of calls to this function can be accessed through the GetMeasuredSize() function.

Note
The Measure function may be called multiple times on a single scene node during a layout pass.
The measure specs passed in must take in consideration the node's scale. For example, if a node is calling the Measure function on one of its children and that child has a scale of glm::vec3(1, 3, 1), then the fSize of heightSpec must be divided by 3.
The measured values may exceed the provided measure specifications if the specifications cannot be met given the constraints placed on this scene node. In other words, the constraints placed on this node have a higher priority than the provided measure specifications.
Warning
Subclasses that override this function must ensure that the Measure function of ALL children of this scene node is called at least once, even if those children are hidden.
Note
Typically, if Measure is overridden then ApplyMeasurements must also be overridden.
Subclasses that override this function should make use of the GetCurrentLayoutDirtyFlag() function (rather than GetLayoutDirtyFlag() ).

Reimplemented from CYISceneView.

virtual void CYIImageView::OnImageHasChanged ( )
virtual

Called when a new image has been set, before ImageAssigned is emitted. This implementation does nothing.

virtual void CYIImageView::Reset ( )
overridevirtual

Resets the image back to its original placeholder image, and clears the optional overlay text node if available.

Reimplemented from CYISceneView.

void CYIImageView::SetImage ( const std::shared_ptr< CYIAssetTextureBase > &  pTexture)

Sets an image on the view from the supplied texture. ImageAssigned will be emitted on a successful assignment.

See also
ImageAssigned
void CYIImageView::SetImage ( const CYIUrl url)

Downloads an image from the specified url and sets it on the view. ImageAssignmentFailed will be emitted in the case of asset download failure.

See also
ImageAssigned
ImageAssignmentFailed
void CYIImageView::SetImageUrl ( const CYIUrl url)

Sets the image URL associated with this view.

Note
Does not initiate a download and set it on the view.
void CYIImageView::SetMipmappingEnabled ( bool  bEnable)

Configures the underlying texture to use mipmapping. Mipmapping is disabled by default.

See also
CYIAssetTextureBase::SetMipmappingEnabled
void CYIImageView::SetOverlayText ( const CYIString text)

Sets the overlay text. By default, no overlay text is shown.

void CYIImageView::SetOverlayTextColor ( const CYIColor color)

Sets the text color; the default text color is white.

void CYIImageView::SetOverlayTextFontID ( const ssize_t nFontID)

Sets the text nFontID; the default font ID is 0.

void CYIImageView::SetOverlayTextSize ( const uint32_t &  nFontSize)

Sets the text nFontSize; the default font size is 20 pixels.

void CYIImageView::SetRepeatMode ( REPEAT_MODE  eRepeatMode)

Sets the repeat mode for the image view to eRepeatMode. The repeat mode will be applied to the image when this method is called if an image has already been set. If an image has not yet been set on the view the mode will apply when the image has been set.

Default: REPEAT_NONE

See also
REPEAT_MODE
SetImage
void CYIImageView::SetScaleMode ( SCALE_MODE  eScaleMode)

Sets the scale mode of the image view. When an image is set using CYIImageView::SetImage the image will be scaled using eScaleMode.

Default: SCALE_FILL

Member Data Documentation

CYISignal CYIImageView::ImageAssigned

Signals that the image was assigned correctly.

CYISignal<const CYIString &> CYIImageView::ImageAssignmentFailed

Signals that the asset download has failed and provides an error message for why the asset download failure occured.

bool CYIImageView::m_bUseMipmapping
protected
CYIColor CYIImageView::m_DefaultTextColor
protected
REPEAT_MODE CYIImageView::m_eRepeatMode
protected
SCALE_MODE CYIImageView::m_eScaleMode
protected
float CYIImageView::m_fImagePlaceholderAspectRatio
protected
float CYIImageView::m_fImagePlaceholderHeight
protected
float CYIImageView::m_fImagePlaceholderWidth
protected
glm::vec3 CYIImageView::m_imagePlaceholderAnchorPoint
protected
CYIUrl CYIImageView::m_ImageUrl
protected
ssize_t CYIImageView::m_nDefaultFontID
protected
int32_t CYIImageView::m_nDefaultFontSize
protected
CYITextSceneNode* CYIImageView::m_pDefaultTextNode
protected
CYISceneNode* CYIImageView::m_pImageNode
protected
std::shared_ptr<CYIMaterial> CYIImageView::m_pImagePlaceholderMaterial
protected
std::shared_ptr<CYIMesh> CYIImageView::m_pImagePlaceholderMesh
protected
std::shared_ptr<CYIAssetTexture> CYIImageView::m_pTextAsset
protected
CYIString CYIImageView::m_sDefaultText
protected

The documentation for this class was generated from the following file: