Welcome Guest, you are in: Login

EventIDE Wiki

RSSRSS

Navigation




Search the wiki


PoweredBy
Element Icon GDI Canvas
Info
Category: Visual stimuli AddIn: Base Elements
Creator: OkazoLab Team Scope: Parent Event
Owns Snippets: no Usage: Stimulus Screen,Snippets

Synchronized Internal Actions

Experiment StartParent Event OnsetStatus change between Onset/OffsetParent Event OffsetExperiment End
Is displayed on screen Is removed from screen

Properties

Generic properties

NameDescriptionConstraintsValue TypeUpon Change
RunTime
GraphicsReturns a reference to the drawing context that is used in the GDI functions.System.Drawing.GraphicsVisual Update

+=== Properties inherited from clVisualElement ===
NameDescriptionConstraintsValue TypeUpon Runtime Change
VISUAL APPEARANCE
Alpha MaskingDefines whether the visual content rendered by this element will be used as an opacity mask which is applied onto the given event surface. The active opacity mask allows one to expose pixels of the parent event surface through a solid background of the given event. If the value is true, the darker pixels of the content will make more transparent holes on the entire event surface.Boolean
AntiAliasingIf true, the rendered content will be anti-aliased for smoother visual appearance. If false, rendering will be authentic to its source, e.g. a bitmap. Boolean
PositionDefines the position of the element viewport on the screen. The position can be set in any of three coordinate systems: a) pixels, b) polar, c) central. clPoint
SizeDefines the size of the element viewport on the screen. The size can be set in any of three coordinate systems: a) pixels, b) visual degrees, c) 'relative-to-screen' size. clSize
Z OrderIndicates the current depth order of the element viewport on the surface of the parent event. The greatest number corresponds to the top position. The order can be changed by moving the element up and down in the element list.Int32
Pivot PointDefines the pivot point (coordinate and the rotation centers) within the element viewport. stAlignment or Int32
VisibleDefines whether the element is currently visible on the event surface. The property is convenient for switching visual content on and off. Boolean
RotationDefines the rotation angle (in degrees) of element viewport relative to the its pivot point. Double in the range 0..360
EFFECTS
Transparent ColorThe color of the original pixels of rendered content that will be set as transparent. stColor
Transparency ToleranceTolerance ratio for choosing colors that become transparent. Zero means that effect is not applied, 1 denotes that all colors will become trasparent. Int32, range (0..100)
Color MaskProduces a multiplicative combination of the original pixels and the selected mask color (except the alpha channel). The effect emulates a look through a colored glass. White or transparent mask color doesn't change the original pixels. stColor
OpacityOpacity of the rendered content. Int32, range (0..100)
ContrastContrast of the rendered content. Int32, range (-100..100)
BrightnessDefines the brighness of the rendered content. Int32, range (-100..100)
SaturationSaturation of the rendered content. Double
PixelationDefines the pixel scale of the rendering. Int32, range (0..100)
BlurringThe radius used in the gaussian blur of rendered content, as a pixel-based factor. The default is 0 which means no blurring. Int32
POSITIONAL JITTER
Reset JitterSet to true at runtime to reset the current positional jitter.Boolean, set true for action
Current JitterJitter range, in pixels (non inclusive)..clSize
Jitter RangeJitter range, centered at the original position of the element.. clSize

+=== Properties inherited from clElement === Inherited properties of clElement
NameDescriptionConstraintsValue TypeUpon Change
Control
Is EnabledIf set to false the element is completely omitted when the experiment is run.Boolean
TitleTitle of the element.String



GDI Canvas element provides a rectangular canvas for drawing using programmable routines of GDI+ library. All GDI+ routines can be directly called in code snippets.


Description

GDI+ is a powerful graphical library for Windows, with thousands functions for drawing graphical primitives and bitmaps, managing colors and geometrical transforms GDI+ tutorial. You can call these functions in your code snippets in order to draw a dynamic 2D graphical content in your experiments.

Snapshots

Image
Example canvas

Example canvas

Example code

Example code


Practical Use

Using the element is very easy. By setting its position and size you define a rectangular area on the screen that represents a rendering canvas for drawing functions. Then you address the Graphics property of the element. This property provides you with the base GDI class which, in turn, possesses all available drawing functions. Now you call these functions directly as in the following C# line:

 Graphics.DrawRectangle(new Pen(Color.Red), 20,20,248,162); 

When a snippet with GDI calls is completed the canvas element redraws its rendering canvas which also reappears on the screen if the parent event is active.

Step by Step: Adding a GDI Canvas element

  1. On an event, click "Add Element", under the "VISUAL STIMULI" category, select the "GDI canvas" element.
  2. Double click on the black square that appears.
  3. Create a proxy variable from the "Graphics" property, e.g "Graphics"
  4. In the bottom 'Snippets' panel, under 'Preparation', click on the 'Start' Snippet.
  5. add the following code:

     Graphics.DrawRectangle(new Pen(Color.Red), 20,20,248,162); 


Note: If unsure about proxy variables, please see the Proxy variables concept page.

Notes

  • The drawing coordinates in your code have to be inside of the range defined by the size of the GDI Canvas element in pixels, otherwise the drawn content will be cut off.
  • The GDI canvas element remembers its rendered state even if the parent event is deactivated and activated again. To clear the drawn graphics use the GDI Clear() function.
  Name Size
- GDICanvasCircles.png 536.55 KB
- GDICanvasCircles_sm.jpg 41.79 KB

ScrewTurn Wiki version 5.2.0.8. Some of the icons created by FamFamFam.