define a module to create a 2D drawing with a continuous mouse motion
group GDroi2d_cont_notify_templ
{
int+IPort2 state;
int+IPort2 clear;
int+IPort2 done;
int+IPort2 redraw;
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
{
GDview_templ+IPort2 &view_in;
int+IPort2 x;
int+IPort2 y;
int draw_mode;
int mode;
int option;
int immed;
float red, green, blue;
GDroi2d_buffer+OPort2 out_buf;
ptr+nonotify+nosave local_ptr;
};
GDroi2d_cont_templ GDroi2d_cont {
draw_mode = 0;
mode = 1;
option = 3;
red = 1.0;
green = 0.0;
blue = 0.0;
};
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.
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.
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.
The ouput buffer containing the screen space coordinates of the primitives.
Libraries.Graphics_Display.Interactivity.UI_Interactivity.ContinuousSketch