CAlfImageVisual Class Reference

class CAlfImageVisual : public CAlfVisual

Image visual displays an image.

An image visual can be used to display portions of CAlfTextures on the UI. Crossfading between two images in a single image visual is possible. The secondaryAlpha property controls the blending between the primary and secondary images of the visual. The default value is 0.0, which results in only the primary image being drawn. The secondary image is ignored when doing scaling calculations.

Usage:
 //Create image visual and set image
 //It will set primary image for imagevisual
 CAlfImageVisual* imagevisual =  CAlfImageVisual::AddNewL( control );
 imagevisual->SetImage( iImage );
 
 
 //Set secondary image and alpha value for crossfading
 imagevisual->SetSecondaryImage( iImage2 );
 imagevisual->SetSecondaryAlpha( 0.5 );
TAlfImage CAlfTexturealfclient.lib
Since
S60 v3.2

Inherits from

Nested Classes and Structures

Public Member Functions
CAlfImageVisual()
~CAlfImageVisual()
IMPORT_C CAlfImageVisual *AddNewL(CAlfControl &, CAlfLayout *)
IMPORT_C voidConstructL(CAlfControl &)
IMPORT_C CAlfVisual *FindTag(const TDesC8 &)
IMPORT_C const TAlfImage &Image()
IMPORT_C TAlfTimedPointOffset()
IMPORT_C voidRemoveAndDestroyAllD()
IMPORT_C TAlfTimedValueScale()
IMPORT_C CAlfImageVisual::TScaleModeScaleMode()
IMPORT_C TAlfTimedValueSecondaryAlpha()
IMPORT_C const TAlfImage &SecondaryImage()
IMPORT_C voidSetColor(const TRgb &)
IMPORT_C voidSetColorMode(CAlfImageVisual::TColorMode, TReal32)
IMPORT_C voidSetDropShadow(TInt)
IMPORT_C voidSetDropShadow(const TAlfMetric &)
IMPORT_C voidSetDropShadow(const TAlfXYMetric &)
IMPORT_C voidSetImage(const TAlfImage &)
IMPORT_C voidSetOffset(const TAlfTimedPoint &)
IMPORT_C voidSetScale(const TAlfTimedValue &)
IMPORT_C voidSetScaleMode(CAlfImageVisual::TScaleMode)
IMPORT_C voidSetSecondaryAlpha(const TAlfTimedValue &)
IMPORT_C voidSetSecondaryImage(const TAlfImage &)
IMPORT_C voidSetStretch(TInt, TInt)
IMPORT_C voidSetStretchMode(CAlfGc::TStretchMode)
IMPORT_C voidSetTurnAngle(const TAlfTimedValue &)
IMPORT_C TAlfTimedValueTurnAngle()
IMPORT_C voidUpdateChildrenLayout(TInt)
Protected Member Functions
IMPORT_C voidDoRemoveAndDestroyAllD()
IMPORT_C voidPropertyOwnerExtension(const TUid &, TAny **)
Inherited Functions
CAlfPropertyOwner::CAlfPropertyOwner()
CAlfPropertyOwner::CopyProperty(const CAlfPropertyOwner &,const TDesC8 &)
CAlfPropertyOwner::PropertyClear()
CAlfPropertyOwner::PropertyFindInteger(const TDesC8 &,TInt *)const
CAlfPropertyOwner::PropertyFindString(const TDesC8 &,TDesC **)const
CAlfPropertyOwner::PropertyRemove(const TDesC8 &)
CAlfPropertyOwner::PropertySetIntegerL(const TDesC8 &,TInt,TInt,TInt)
CAlfPropertyOwner::PropertySetStringL(const TDesC8 &,const TDesC &)
CAlfPropertyOwner::~CAlfPropertyOwner()
CAlfVisual::AlignByOrigin(TAlfRealRect &)const
CAlfVisual::Brushes()
CAlfVisual::CAlfVisual()
CAlfVisual::ClearFlag(TAlfVisualFlags)
CAlfVisual::ClearFlags(TUint)
CAlfVisual::Clipping()const
CAlfVisual::Comms()const
CAlfVisual::ConstructL(CAlfControl &,TInt,TInt,const TDesC8 &)
CAlfVisual::CopyValues(const CAlfVisual &,TInt,TInt)
CAlfVisual::DepthOffset()const
CAlfVisual::Display()const
CAlfVisual::DisplayRect()const
CAlfVisual::DisplayRectTarget()const
CAlfVisual::DisplayToLocal(const TAlfRealPoint &)const
CAlfVisual::DisplayToLocal(const TPoint &)const
CAlfVisual::DropShadowHandler()const
CAlfVisual::EffectiveOpacity()const
CAlfVisual::EnableBrushesL(TBool)
CAlfVisual::EnableDropShadowL(TBool)
CAlfVisual::EnableTransformationL(TBool)
CAlfVisual::Env()const
CAlfVisual::Flags()const
CAlfVisual::HasTactileFeedback(TInt)const
CAlfVisual::HorizontalOrigin()const
CAlfVisual::HorizontalPadding()const
CAlfVisual::Identifier()const
CAlfVisual::IsTagged()const
CAlfVisual::Layout()const
CAlfVisual::LocalToDisplay(const TAlfRealPoint &)const
CAlfVisual::LocalToDisplay(const TPoint &)const
CAlfVisual::MaxSize()const
CAlfVisual::MaxSizeInBaseUnits()const
CAlfVisual::Mimic(CAlfVisual &,TInt)
CAlfVisual::MinSize()const
CAlfVisual::MinSizeInBaseUnits()const
CAlfVisual::Move(const TAlfRealPoint &,TInt)
CAlfVisual::Move(const TPoint &,TInt)
CAlfVisual::MoveToFront(TInt)
CAlfVisual::Opacity()const
CAlfVisual::Owner()const
CAlfVisual::Padding()const
CAlfVisual::PaddingAsMetric()const
CAlfVisual::PaddingInPixels()const
CAlfVisual::Pause(TInt)
CAlfVisual::Pos()const
CAlfVisual::RemoveTactileFeedback(TInt)
CAlfVisual::Resume(TInt)
CAlfVisual::SetCenteredPosAndSize(const TAlfRealPoint &,const TAlfRealSize &,TInt)
CAlfVisual::SetCenteredPosAndSize(const TPoint &,const TSize &,TInt)
CAlfVisual::SetClipping(TBool)
CAlfVisual::SetDepthOffset(const TAlfTimedValue &)
CAlfVisual::SetDisplay(CAlfDisplay *)
CAlfVisual::SetEffectL(const TDesC &)
CAlfVisual::SetFlag(TAlfVisualFlags)
CAlfVisual::SetFlags(TUint)
CAlfVisual::SetGroupEffectL(const TDesC &,TInt)
CAlfVisual::SetLayout(CAlfLayout *)
CAlfVisual::SetMaxSize(const TAlfRealSize &)
CAlfVisual::SetMaxSize(const TSize &)
CAlfVisual::SetMinSize(const TAlfRealSize &)
CAlfVisual::SetMinSize(const TSize &)
CAlfVisual::SetOpacity(const TAlfTimedValue &)
CAlfVisual::SetOrigin(TAlfVisualHOrigin,TAlfVisualVOrigin)
CAlfVisual::SetOwner(CAlfControl &)
CAlfVisual::SetPadding(TInt)
CAlfVisual::SetPadding(const TAlfBoxMetric &)
CAlfVisual::SetPadding(const TPoint &)
CAlfVisual::SetPos(const TAlfRealPoint &,TInt)
CAlfVisual::SetPos(const TAlfTimedPoint &)
CAlfVisual::SetRect(const TAlfRealRect &,TInt)
CAlfVisual::SetSize(const TAlfRealSize &,TInt)
CAlfVisual::SetSize(const TAlfTimedPoint &)
CAlfVisual::SetTactileFeedbackL(TInt,TInt)
CAlfVisual::SetTagL(const TDesC8 &)
CAlfVisual::Size()const
CAlfVisual::Tag()const
CAlfVisual::TagMatches(const TDesC8 &)const
CAlfVisual::Transformation()
CAlfVisual::VerticalOrigin()const
CAlfVisual::VerticalPadding()const
CAlfVisual::~CAlfVisual()
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enumTColorMode { EColorModulate, EColorDimmed }
enumTScaleMode {
EScaleNormal, EScaleFitWidth, EScaleFitHeight, EScaleCover, EScaleFit, EScaleFitInside
}
Private Attributes
TImageVisualPrivateData *iImageVisualData

Constructor & Destructor Documentation

CAlfImageVisual()

IMPORT_CCAlfImageVisual()

Constructor.

~CAlfImageVisual()

IMPORT_C~CAlfImageVisual()[virtual]

Destructor

Member Functions Documentation

AddNewL(CAlfControl &, CAlfLayout *)

IMPORT_C CAlfImageVisual *AddNewL(CAlfControl &aOwnerControl,
CAlfLayout *aParentLayout = 0
)[static]

Constructs and appends a new image visual to the owner control.

Parameters

CAlfControl & aOwnerControlControl that will own the new visual.
CAlfLayout * aParentLayout = 0

ConstructL(CAlfControl &)

IMPORT_C voidConstructL(CAlfControl &aOwner)[virtual]

Second-phase constructor, from CAlfVisual

Parameters

CAlfControl & aOwner

DoRemoveAndDestroyAllD()

IMPORT_C voidDoRemoveAndDestroyAllD()[protected, virtual]

FindTag(const TDesC8 &)

IMPORT_C CAlfVisual *FindTag(const TDesC8 &aTag)[virtual]

Finds a visual whose tag descriptor contains a specific tag.

CAlfVisual::FindTag() is the basic implementation that checks if this visual's tag matches the specified tag. CAlfLayout::FindTag() extends the search into child visuals, covering recursively entire visual hierarchies.

Todo: how should several visuals with matching tag to be handled ??

CAlfVisual::Tag() CAlfVisual::SetTagL() CAlfVisual::IsTagged() CAlfLayout::FindTag()

Parameters

const TDesC8 & aTagTag to look for. If this tag is found as a part of a visual's colon-separated tag descriptor, it is treated as a match and the visual is returned. The tag to look for cannot contain separator characters (:).

Image()

IMPORT_C const TAlfImage &Image()const

Returns the image of the visual.

Offset()

IMPORT_C TAlfTimedPointOffset()

Gets relative offset for scaled images.

PropertyOwnerExtension(const TUid &, TAny **)

IMPORT_C voidPropertyOwnerExtension(const TUid &aExtensionUid,
TAny **aExtensionParams
)[protected, virtual]

! future proofing

Parameters

const TUid & aExtensionUid
TAny ** aExtensionParams

RemoveAndDestroyAllD()

IMPORT_C voidRemoveAndDestroyAllD()[virtual]

Scale()

IMPORT_C TAlfTimedValueScale()

Gets uniform scale factor for the image.

ScaleMode()

IMPORT_C CAlfImageVisual::TScaleModeScaleMode()

Gets the scaling mode of the Image Visual texture. Returns the Scalemode set to Image Visual, using SetScaleMode() Default is EScaleFit.

SetScaleMode()

SecondaryAlpha()

IMPORT_C TAlfTimedValueSecondaryAlpha()

Gets alpha for the secondary image.

SecondaryImage()

IMPORT_C const TAlfImage &SecondaryImage()const

Returns the secondary image of the visual.

SetColor(const TRgb &)

IMPORT_C voidSetColor(const TRgb &aColor)

Sets the color of the image. Defaults to white.

Parameters

const TRgb & aColor

SetColorMode(CAlfImageVisual::TColorMode, TReal32)

IMPORT_C voidSetColorMode(CAlfImageVisual::TColorModeaColorMode,
TReal32aParam = 0.0
)

Sets the color mode of the image. Defaults to modulate.

Parameters

CAlfImageVisual::TColorMode aColorModeColor mode.
TReal32 aParam = 0.0Parameter for the mode. With blend, specifies the amount of color to blend (0...1). 1.0 will cause the image to be fully blended to the visual's color.

SetDropShadow(TInt)

IMPORT_C voidSetDropShadow(TIntaShadowDistance)

Use CAlfDropShadow

Sets the drop shadow distance.

Use metric unit version instead.

Parameters

TInt aShadowDistancePixels.

SetDropShadow(const TAlfMetric &)

IMPORT_C voidSetDropShadow(const TAlfMetric &aShadowDistance)

Use CAlfDropShadow

Sets the drop shadow distance.

Parameters

const TAlfMetric & aShadowDistanceSet shadow distance in metric units. Both X and Y will use this value.

SetDropShadow(const TAlfXYMetric &)

IMPORT_C voidSetDropShadow(const TAlfXYMetric &aShadowDistance)

Use CAlfDropShadow

Sets the drop shadow distance.

Parameters

const TAlfXYMetric & aShadowDistanceSet shadow distance in metric units.

SetImage(const TAlfImage &)

IMPORT_C voidSetImage(const TAlfImage &aImage)

Sets the image displayed by the image visual. If no image has been set for the visual, the visual does not draw anything.

Note:

You may call SetImage also with images(/textures) that have not been loaded (yet). The toolkit has been designed so that SetImage() can be called before the texture has been finished loading. In the meantime, a placeholder could be used. In other words, the CAlfTexture that the TAlfImage refers to does need to exist but it doesn't have to be loaded yet.

Redrawing of the visual happens automatically after SetImage() has been called.

Redrawing also happens automatically when a texture has been fully loaded by the texture manager. The manager notifies the environment, which issues a full display redraw.

Parameters

const TAlfImage & aImagePrimary image to be visualized.

SetOffset(const TAlfTimedPoint &)

IMPORT_C voidSetOffset(const TAlfTimedPoint &aOffset)

Sets relative offset for scaled images.

Parameters

const TAlfTimedPoint & aOffsetrelative offset

SetScale(const TAlfTimedValue &)

IMPORT_C voidSetScale(const TAlfTimedValue &aScale)

Sets uniform scale factor for the image.

Parameters

const TAlfTimedValue & aScaleScale factor

SetScaleMode(CAlfImageVisual::TScaleMode)

IMPORT_C voidSetScaleMode(CAlfImageVisual::TScaleModeaScaleMode)

Sets the scaling mode for the bitmap. An unscaled image will be drawn at a 1:1 mapping between its texture and the screen. A scaled image will be resized to fit the visual's size exactly. If unset, the default is EScaleFit.

Parameters

CAlfImageVisual::TScaleMode aScaleModeThe scaling mode of this image visual.

SetSecondaryAlpha(const TAlfTimedValue &)

IMPORT_C voidSetSecondaryAlpha(const TAlfTimedValue &aAlpha)

Sets alpha for the secondary image. If one, the primary image is not visible at all.

Parameters

const TAlfTimedValue & aAlphaAlpha value for the image

SetSecondaryImage(const TAlfImage &)

IMPORT_C voidSetSecondaryImage(const TAlfImage &aImage)

Sets the secondary image displayed by the image visual.

The reason there are two images is to make crossfading simpler from the application's point of view. The blending ratio between the images is controlled with the timed value iSecondaryAlpha of CAlfImageVisual.

If iSecondaryAlpha is zero (the default), the secondary image will not be drawn. When iSecondaryAlpha increases, the secondary image becomes gradually visible as its opacity increases.

When crossfading is not needed, SetSecondaryImage() and iSecondaryAlpha can be ignored.

SetImage() SetSecondaryAlpha()

Parameters

const TAlfImage & aImage

SetStretch(TInt, TInt)

IMPORT_C voidSetStretch(TIntaTop,
TIntaBottom
)

Sets the stretch widths of the image. Set both to zero to disable stretching. A stretched image will be scaled over the whole width or height of the visual, except for a band specified by the parameters, which will not be scaled (1:1 pixel mapping). For doing uniform scaling of an image, use the SetScaleMode API instead.

Deprecated as an unneeded and broken functionality.

SetStretchMode. CHuiGc::DrawStretchImage

Parameters

TInt aTopTop width in pixels.
TInt aBottomBottom width in pixels.

SetStretchMode(CAlfGc::TStretchMode)

IMPORT_C voidSetStretchMode(CAlfGc::TStretchModeaStretchMode)

Sets the stretch mode of the image.

CHuiGc::DrawStretchImage. Setstretch.

Parameters

CAlfGc::TStretchMode aStretchModeHorizontal or vertical.

SetTurnAngle(const TAlfTimedValue &)

IMPORT_C voidSetTurnAngle(const TAlfTimedValue &aAngle)

Sets angle for turning the image around its center point.

Parameters

const TAlfTimedValue & aAngle

TurnAngle()

IMPORT_C TAlfTimedValueTurnAngle()

Gets angle for turning the image around its center point.

UpdateChildrenLayout(TInt)

IMPORT_C voidUpdateChildrenLayout(TIntaTransitionTime = 0)[virtual]

Update the layout of all children. Subclasses can call this to recalculate the layout of all children.

Parameters

TInt aTransitionTime = 0Time for layout transition in milliseconds. Any negative value uses value given in CAlfEnv::StaticSetLayoutTransitionTime()

Member Enumerations Documentation

Enum TColorMode

Color modes.

Enumerators

EColorModulate

Default color mode.

EColorDimmed

A dimmed color mode will apply fogging to this visual.

Enum TScaleMode

Image scaling modes.

Enumerators

EScaleNormal

Image is not scaled. It will be drawn at a 1:1 mapping between its texture and the screen pixels.

EScaleFitWidth

Image is uniformly scaled to fit the width of the visual's area. The aspect ratio of the image is preserved.

EScaleFitHeight

Image is uniformly scaled to fit the height of the visual's area. The aspect ratio of the image is preserved.

EScaleCover

Image is uniformly scaled to fit the visual's area so that the entire area is covered. The aspect ratio of the image is preserved.

EScaleFit

Image is uniformly scaled to fit the visual's area. The aspect ratio of the image is not preserved. This is the default scale mode. It allows full control of the appearance of the image by adjusting the visual's size.

EScaleFitInside

Image is uniformly scaled to fit inside the visual's area. The aspect ratio of the image is preserved.

Member Data Documentation

TImageVisualPrivateData * iImageVisualData

TImageVisualPrivateData *iImageVisualData[private]