Programming Reference:ImageStimulus Class
Location
src/shared/modules/application/stimuli
Synopsis
The ImageStimulus class provides a VisualStimulus that displays an image loaded from a file.
Properties
string File (rw)
A relative or absolute path to an image file. When relative, the path is interpreted relative to the application module's working directory at startup.
enum RenderingMode (rw)
One of GUI::RenderingMode::Transparent or GUI::RenderingMode::Opaque. When Transparent, the image's bottom leftmost pixel is taken to represent its background, and pixels of this color are not drawn, allowing objects below the ImageStimulus to appear.
Inherited from VisualStimulus
enum PresentationMode (rw)
This property determines the way a stimulus is presented. It is one of the following:
- ShowHide
- The stimulus is initially invisible, and visible while being presented.
- Intensify
- During presentation, the contrast of the stimulus is increased.
- Grayscale
- During presentation, the stimulus is displayed in grayscale rather than color.
- Invert
- During presentation, the stimulus appears color-inverted.
- Dim
- During presentation, the contrast of the stimulus is reduced.
- HideShow
- The stimulus is initially visible, and invisible while being presented.
float DimFactor (rw)
Determines the contrast ratio between presentation and non-presentation in Dim and Intensify modes. In Intensify mode, values greater 1 will result in a brighter appearance during presentation; in Dim mode, values greater 1 will result in a darker appearance during presentation. Due to saturation effects, the result may not be as expected.
Inherited from GraphObject
GraphDisplay Display (r)
The GraphDisplay object that was specified when the object was created.
bool Visible (r)
True if the object is visible, false if it is hidden. Use the Hide() and Show() methods to set this property.
float ZOrder (rw)
Determines the order in which GraphObjects are drawn. GraphObjects with smaller values of ZOrder are drawn on top of those with larger values, hiding these.
enum ScalingMode (rw)
One of the following options:
- AdjustNone
- No adjustment is made.
- AdjustWidth
- The object's width is adapted to its contents, while keeping its height constant.
- AdjustHeight
- The object's height is adapted to its contents, keeping its width constant.
- AdjustBoth
- Both the object's height and width are adjusted to its content.
The exact behavior of aspect ratio adjustment depends on the object's type. E.g., for bitmap images, AdjustBoth will size the image such that one image pixel corresponds to one screen pixel; AdjustHeight and AdjustWidth will adjust such that the original aspect ratio is preserved.
GUI::Rect ObjectRect (rw)
The bounding rectangle of the space that defines the object. This is given in coordinates relative to the size of the object's GraphDisplay; there, the upper left corner corresponds to (0,0), the lower right corner to (1,1). When a GraphObject is created, its object rectangle is empty.
GUI::Rect DisplayRect (r)
The bounding rectangle of the space that is occupied by the object. This is given in coordinates relative to the size of the object's GraphDisplay; there, the upper left corner corresponds to (0,0), the lower right corner to (1,1). Depending on the object, the display rectangle may be identical to the object rectangle, or may be larger than that. E.g., this is the case when the object has a frame that extends beyond the object rectangle; this frame will be taken into account by the display rectangle. When a GraphObject is created, its display rectangle is empty.
Methods
Inherited from GraphObject
Show()
Makes the object visible. Initially, objects are created in visible state.
Hide()
Makes the object invisible.
Invalidate()
Invalidates the object's bounding rectangle, i.e. marks it as needing to be repainted. Typically, this function is called from a derived class, indicating that a change in object properties has occurred that requires a repaint.
Paint()
Asks an object to paint itself by calling its OnPaint event handler.
Change()
Notifies an object of a change in display properties by calling its OnChange event handler.
bool Click(GUI::Point)
Tests whether the specified point is inside an object's bounding rectangle, and calls its OnClick event handler if this is the case.
See also
Programming Reference:VisualStimulus Class, Programming Reference:GraphObject Class