Reference for the Mosaic class Views::WarpView
SEE ALSO
Using the Warp Image view to display a bitmap stretched, scaled and rotated in the 3D space.
The class Views::WarpView provides the base functionality for views able to show images scaled and rotated in the 2D/3D space. First of all, Embedded Wizard is not a 3D GUI development tool! Its lightweight 3D functionality is limited to the perspectively correct projection of an image onto a quad (four corners polygon). Depending on this polygon's shape, different kinds of transformations are possible, e.g. scaling, rotation or mirroring. The polygon is determined by the four corners Point1, Point2, Point3 and Point4. Moving these corners is thus sufficient to determine the desired transformation.
More sophisticated way to control the transformations is provided by the methods RotateAndScale() and Warp3D(). These methods derive the polygon coordinates automatically from the given parameters.
The visibility of the view is controlled by the properties Visible, AlphaBlended, 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.
The class Views::WarpView doesn't define any particular appearance. It exists as base for derived view classes like the Views::WarpImage and Views::WarpGroup.
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 rect Clipping = <0,0,0,0>;
The property 'Clipping' determines an additional area to limit the visibility of this view. Parts of the view lying outside this are are clipped - they are not visible. The area is expressed in coordinates of the view's Owner. If Clipping is <0,0,0,0>, no clipping is applied and the entire view can be seen.
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 float LightingEffect = 0.0;
The property 'LightingEffect' determines the impact of a light in the appearance of the view. Embedded Wizard provides a simple 3D lighting model with one light source placed infinitely far away behind the observer. In this model views will become darker if they are not facing to the light source. The more a view is averted the darker does it appear.
This property can take values in the range 0.0 .. 1.0. The value 0.0 means no lighting effect - the view will appear with its original intensity regardless its orientation in the 3D space. In contrast, the value 1.0 means that the brightness of the view depends exclusively on its orientation to the light source.
property bool Quality = true;
The property 'Quality' determines whether the image projection should be performed with an additional bi-linear filter or not. The usage of the filter may produce smooth outputs. Without the filter the projected 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.
method void RotateAndScale
(
arg point aDstPos,
arg float aAngle,
arg float aScaleX,
arg float aScaleY
);
The method RotateAndScale() performs a 2D rotation and scaling of the source image. The transformation is performed around a reference position specified in the property SourceAnchor. This allows e.g. a rotation around the center of the image, etc. The rotation angle is passed in the parameter aAngle as a value in the range 0 .. 360°. The values passed in the parameters aScaleX and aScaleY determine additional scaling factors for the image in the horizontal and vertical direction. If no scaling should be performed, the value 1.0 can be passed to these parameters. In contrast, if no rotation is desired, 0.0 can be passed to the parameter aAngle.
The transformed image appears on the screen at the position aDstPos relative to the top-left corner of this view's Owner. The view itself takes the shape resulting from this transformation and adapts its Point1 .. Point4 coordinates accordingly. More sophisticated 2D and 3D transformations are performed by the method Warp3D().
property float Shininess = 5.0;
The property 'Shininess' determines in case of an active lighting effect the shininess of the view's surface. This property can take values in the range 1.0 .. 100.0. The higher the value the more shining the view. The lighting is activated and controlled by the property LightingEffect. If the lighting is not active, the property has no effect.
property point SourceAnchor = <0,0>;
The property 'SourceAnchor' determines within the source image a reference position to perform all rotation, scaling and 3D warp transformations. For example, the method RotateAndScale() will rotate the image around this position. The position is expressed in coordinates relative to the top-left corner of the area resulting from the property SourceArea.
property rect SourceArea = <0,0,0,0>;
The property 'SourceArea' determines the area of the source image to project onto the destination polygon. The area is expressed in coordinates relative to the top-left corner of the source image. If SrcArea is <0,0,0,0>, the entire image is used.
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.
method void Warp3D
(
arg point aDstPos,
arg Graphics::WarpMatrix
aMatrix
);
The method Warp3D() performs a 2D or 3D transformation of the source image. The transformation is performed around a reference position specified in the property SourceAnchor. This allows e.g. a rotation around the center of the image, etc. The kind of transformation is determined by the warp matrix passed in the parameter aMatrix. The corresponding Graphics::WarpMatrix class provides several method for different kinds of transformations. Even one matrix can describe a complex transformation composed of several separate steps.
The transformed image appears on the screen at the position aDstPos relative to the top-left corner of this view's Owner. The view itself takes the shape resulting from this transformation and adapts its Point1 .. Point4 coordinates accordingly. Simple 2D rotation and scaling operations can be performed by the method RotateAndScale().