GDexIndex.gif Previous-2.gif Next-3.gif

Probea location in a 2D view (DrawCursor2D)


The following example illustrates how to use the DrawCursor2D module to probe a location in a 2D view. DrawCursor2D is a general module that, given a screen space XY coordinate, translates that position into the coordinate system of any Graphics Display Kit object. A cursor is displayed at the current screen space XY position.

 

GENERATE/FH413315.gif

Starting up

  1. 1.      Start AVS/Express and choose None from the startup dialog, or if you have an existing AVS/Express session, delete or close any existing application workspaces that you have open.
  2. Instance the example

    Instance DrawCursor2D into the empty NE workspace.

    This example is found in Libraries.Examples.Graphics_Display. The example renders the image avs.x in the viewer's window.

    Probe the image

    We are now ready to probe positions in the image.

    Select Editors->Modules to make the modules user interface panel visible. Select DrawCursor2D from the Modules option menu. This causes the user interface for the DrawCursor2D module to appear.

    Begin probing the view using the cursor.

    The mouse operations that control the drawing of the cursor are:

    Mouse-controlled operations

     

    Gesture

     

    Probe position

    Hold down the right button, and drag the mouse.

     

    The DrawCursor2D module displays the XY position it is probing in its user interface. By default, the module updates the XY position every time it gets a new screen space input.

    Toggle Immediate.

    This causes the XY position to be updated only when the right mouse button has been released (that is, at the end of the gesture).

    The avs.x image has dimensions of 628 by 184. Notice that when the cursor is inside the extents of the image, the values displayed in the DrawCursor2D user interface for X are in the range 0 to 627 and for Y in the range of 0 to 183.

    In the application workspace, disconnect Read_Image.image and DrawCursor2D.obj_in.

    Begin probing the view using the cursor.

    Notice that the values displayed in the DrawCursor2D user interface now range from -5 in the lower left to 5 in the upper right. This is the default coordinate system of the camera. When there is no object as input to DrawCursor2D, the screen space positions are translated into the camera's coordinate system.

    Toggle Cross

    This causes a cross of the specified size and thickness to be displayed when probing instead of a full-screen cross hair cursor.

    Cleanup

    This completes the example.

    Delete the DrawCursor2D application.

     



    GDexIndex.gif Previous-2.gif Next-3.gif