Reference for the Mosaic class Views::Image
The class Views::Image provides a kind of view specialized to draw and animate bitmaps. The bitmap is determined by the property Bitmap. In case of a multi-frame bitmap the desired frame can be selected by the property FrameNumber. The animation of bitmaps containing short video sequences is controlled by the properties Animated and Endless. Alternatively, the animation can be controlled by sending signals to the slot methods StartAnimation and StopAnimation.
The position and the size of the area where the bitmap is drawn is determined by the property Bounds. If the size of this area differs from the size of the bitmap the bitmap can be aligned or scaled within this area. This is controlled by the property Alignment. With the property Orientation the displayed content can be rotated. The properties Color, ColorTL, ColorTR, ColorBL and ColorBR can be used to tint the bitmap or to modulate its transparency. For each view's corner different color can be set, so the bitmap can be shown with fancy color or opacity gradients. The particular effect of the colors depends on the type of the bitmap:
The property SlideHandler permits the image view to be connected together with an interactive Core::SlideTouchHandler. In this manner the user can scroll the displayed bitmap by simply touching the slide handler on the screen. Alternatively, the scroll position can be controlled by the value of the property ScrollOffset.
The visibility of the image is controlled by the properties Visible, AlphaBlended, Opacity and Embedded. In particular the property Embedded can determine whether the corresponding view is limited (== embedded) to the boundary of a sibling Core::Outline view or not. The embedding of views within a Core::Outline allows a kind of sub-groups within the GUI component itself. Very useful for any kind of scrollable lists, menus, etc.
property Views::ImageAlignment Alignment = Views::ImageAlignment[AlignHorzCenter, AlignVertCenter];
The property 'Alignment' determines how the view should display the bitmap if its size differ from the size of the view. Depending on the value of this property the bitmap can be aligned or stretched within the view's Bounds area.
Please note, the orientation of the area in context of which the bitmap is aligned is affected by the property Orientation. For example, if the view is configured to rotate the displayed bitmap 90 degrees counter-clockwise and to align it to the left edge, the bitmap will be arranged consequently at the bottom edge of the view.
property bool AlphaBlended = true;
The property 'AlphaBlended' determines the drawing mode for the view. Views with disabled alpha-blending will override the affected screen areas. If this mode is enabled, the pixel of the view are combined with the origin screen content by alpha-blending.
property bool Animated = false;
The property 'Animated' determines whether the view may play animated bitmaps. Assigning the value 'true' to this property can cause the view to re-start the animated bitmap with the frame specified in the property FrameNumber. The value 'false' in contrast stops the running animated bitmap at its current position. The animation can also be controlled by sending signals to the slot methods StartAnimation and StopAnimation. Animated bitmaps are a special kind of bitmaps containing short video sequences. The animation can work with an animated bitmap only. See Resources::Bitmap.
property bool AutoSize = false;
The property 'AutoSize' determines whether Bounds of the view should be adjusted automatically in response to bitmap changes. If AutoSize is 'true', the view will adapt its bounds area correspondingly to the size of a bitmap assigned to the Bitmap property.
property Resources::Bitmap Bitmap = null;
The property 'Bitmap' refers to the bitmap object to display in this view. If the bitmap consists of more than one frame, the desired frame number can be determined by the property FrameNumber. If the bitmap is animated, the animation will start if the property Animated is 'true'.
property color Color = #FFFFFFFF;
The property 'Color' controls the color of the entire image. Thus this property is useful if no gradients are desired. The resulting colors can additionally be modulated by the values specified in the properties ColorTL, ColorTR, ColorBL and ColorBR.
The effect of this color value depends on the type of the bitmap specified in the Bitmap property:
property color ColorBL = #FFFFFFFF;
The property 'ColorBL' stores the color at the bottom-left corner of the view's Bounds area. This color value can additionally be modulated by the common color value stored in the property Color.
The effect of the color value depends on the type of the bitmap specified in the Bitmap property:
property color ColorBR = #FFFFFFFF;
The property 'ColorBR' stores the color at the bottom-right corner of the view's Bounds area. This color value can additionally be modulated by the common color value stored in the property Color.
The effect of the color value depends on the type of the bitmap specified in the Bitmap property:
property color ColorTL = #FFFFFFFF;
The property 'ColorTL' stores the color at the top-left corner of the view's Bounds area. This color value can additionally be modulated by the common color value stored in the property Color.
The effect of the color value depends on the type of the bitmap specified in the Bitmap property:
property color ColorTR = #FFFFFFFF;
The property 'ColorTR' stores the color at the top-right corner of the view's Bounds area. This color value can additionally be modulated by the common color value stored in the property Color.
The effect of the color value depends on the type of the bitmap specified in the Bitmap property:
property bool Embedded = false;
The property 'Embedded' controls how the view should appear and behave within its superior Owner. If this property == 'true', the affected view will be embedded (limited) to the boundary of a preceding Core::Outline sibling view. This is as if the view had been embedded within this outline. Beside the appearance limitation of the outline boundary, the outline also provides more sophisticated arrangement mechanisms and the content scrolling. It is therefore useful to create scrollable menus or lists.
If this property is 'false', the view is considered as a regular view of its Owner - it doesn't belong to any outline.
property bool Endless = true;
The property 'Endless' determines whether the view should play the animated bitmap endlessly. If this property is 'false', the animation will run only once after it has been started. If it is 'true' the animated bitmap will re-start automatically with the frame specified in the property FrameNumber.
property int32 FrameNumber = 0;
The property 'FrameNumber' determines the bitmap frame to display in this view. Each bitmap consists of either one or more frames (images). The first frame has the number 0, the second frame has the number 1, and so far. Bitmaps containing more than one frame are called multi-frame bitmaps. See Resources::Bitmap.
Changes of this property cause the view to switch the shown frame. If the desired frame is not available in the bitmap, no bitmap is shown. Additionally, the value stored in this property determines the frame to start an animation of an animated bitmap. The animation is controlled by the property Animated.
method rect GetContentArea();
The method GetContentArea() returns the position and the size of an area where the view will show the bitmap. This area is expressed in coordinates relative to the top-left corner of the view's Owner. The method takes in account all properties which do affect the position and the alignment of the bitmap, e.g. Alignment or ScrollOffset.
property slot OnFinished = null;
The property 'OnFinished' can refer to a slot method, which should be invoked when the animation is done. It's up to you to provide the slot method and to fill it with the desired behavior. It makes possible to chain animations together, so the finish of one animation can trigger another animation. To do this simply assign the StartAnimation slot method of the one view to the OnFinished property of the other view.
property int32 Opacity = 255;
The property 'Opacity' controls the translucence of the view. This property can take values in range of 0 .. 255. If the value is 255, the view will appear with its full opacity. The value equal to zero results in a fully transparent view. Other values in the range 1 .. 254 show a semitransparent view.
property Views::Orientation Orientation = Views::Orientation.Normal;
The property 'Orientation' determines whether the bitmap should be displayed with normal or rotated orientation.
property bool Quality = true;
The property 'Quality' determines whether the image scale or stretch operations should be performed with an additional bi-linear filter or not. The usage of the filter may produce smooth outputs. Without the filter the image may appear with ugly steps. Depending on the underlying graphics system, the filter may impact the resulting performance. Therefore it's up to you to decide which part of the GUI should appear with the higher quality. To activate the filter assign 'true' to this property.
property point ScrollOffset = <0,0>;
The property 'ScrollOffset' stores an additional displacement in pixel to move the bitmap within the view's area. It is useful to create e.g. marquee images.
property Core::SlideTouchHandler SlideHandler = null;
The property 'SlideHandler' provides an interface, where a slide handler can be attached. In this manner the handler can control the view and the user can scroll the displayed bitmap by simply touching the slide handler on the screen.
slot StartAnimation;
The slot method 'StartAnimation' re-starts the animated bitmap if a signal is sent to this slot method. The animation will start with the frame specified in the property FrameNumber. Animated bitmaps are a special kind of bitmaps containing short video sequences. The method has no effect if the bitmap can't be animated. See Resources::Bitmap.
slot StopAnimation;
The slot method 'StopAnimation' stops the running animated bitmap if a signal is sent to this slot method. This causes the animation to pause at its current position. Animated bitmaps are a special kind of bitmaps containing short video sequences. See Resources::Bitmap.
property bool Visible = true;
The property 'Visible' determines the visibility state of the view. Invisible views will not appear on the screen. Whether a view is really visible depends on the visibility of its Owner and the position of the view within the owners boundary area.