![]() |
![]() |
![]() |
![]() |
GDroi2d_cont
Synopsis
define a module to create a 2D drawing with a continuous mouse motion
group GDroi2d_cont_notify_templ {
int+IPort2 state;
int+IPort2 clear<export=3>;
int+IPort2 done<export=3>;
int+IPort2 redraw;
GDview_ref_templ+IPort2+read+nonotify &view_in;
method+notify_inst init_func = "GDroi2d_cont_create";
method+notify_deinst del_func() = "GDroi2d_cont_delete";
method+notify_val upd_func = "GDroi2d_cont_update";
};GDroi2d_cont_notify_templ GDroi2d_cont_templ {
int+IPort2 x;
int+IPort2 y;
enum draw_mode<export=3> {
choices = {"Copy", "XOR"};
};
enum mode<export=3> {
choices = {"Clear", "Append"};
};
enum option<export=3> {
choices = {"Point", "Line", "Box", "Polyline", "Polygon"};
};
enum immed<export=3> {
choices = {"Confirm", "On Button Up"};
};
float red<export=3>;
float green<export=3>;
float blue<export=3>;
GDroi2d_buffer+OPort2 out_buf;
ptr+nonotify local_ptr<NEvisible=0>;
};GDroi2d_cont_templ GDroi2d_cont<export=2> {
draw_mode = 0; /* copy */
mode = 1; /* append */
option = 3; /* polygon */
red = 1.0; /* default color = red */
green = 0.0;
blue = 0.0;
};Description
These templates define a module to create a 2D drawing with one continuous motion of the mouse. GDroi2d_cont_notify_templ defines the elements that cause the module's update method to execute. GDroi2d_cont_templ defines the additional elements that are used at execution time but do not trigger an activation. GDroi2d_cont provide initial values to some of the elements. This is the template that should be instanced.The GDroi2d_cont module generates the drawing with a continuous stream of screen space XY positions typically fed to the module from a UItwoPoint interactor. With this method, you can generate a drawing with one smooth, continuous motion of the input device. A potential disadvantage of this method is that it does not allow you to edit the drawing during the construction process.
Input
This input indicates that a drawing operation is in progress: 1 indicates the operation is beginning; 2 indicates the operation is in progress; and 3 indicates the operation is completed. You typically connect this to a UItwoPoint's state subobject.
When this is set, it indicates that you want to clear the screen and internal drawing buffer without writing it to out_buf. You typically connect this to a UI widget, like a button.
When this is set, it indicates that you want to submit the current drawing or drawings. This causes the internal drawing buffer to be written to out_buf. You typically connect this to a UI widget, like a button.
When this is set, it indicates that you want to redraw the drawing. This is useful when the view has been rerendered while drawing is in progress. You typically connect this to a UI widget or to the trigger parameter of a view so redrawing occurs automatically when the view is rerendered.
The x and y screen space coordinates of the next point. You typically connect this to the x and y parameters of the UItwoPoint connected to state.
Parameters
This parameter indicates whether to draw in copy mode (0) or xor mode (1). In copy mode, the rendering window is refreshed as necessary with a pre-drawing copy of the window's contents, if possible. In XOR mode, the drawing is created (and subsequently refreshed) by performing an XOR operation on the background. XOR mode is generally faster.
This parameter controls whether the contents of the internal drawing buffer replace or are appended to out_buf: 0 means replace; 1 means append. You typically connect this to a UI widget, such as a toggle.
This parameter controls the type of primitive to be drawn. Valid values are as follows: 0 means point; 1 means line; 2 means box; 3 means polyline; and 4 means polygon.
This parameter controls if the primitive being built is immediately written to the output buffer or if a confirmation is needed: 0 means that you must supply a confirmation; 1 means that the primitive is written immediately to the output buffer.
These parameters control the color in which the primitives being built are drawn. This is termed the "build" color.
Output Port
Example
Libraries.Graphics_Display.Interactivity.UI_Interactivity.ContinuousSketch
File
See also related modules
![]() |
![]() |
![]() |
![]() |