Draw

 

This function is called when by sliceOmatic during its redraw process. Depending on the "Redraw Flag" you registered for with the "Draw_Register" function, It may be called more than once.  

 

Syntax

 

extern "C" __declspec(dllexportint  Draw(

          UInt64 flag,

          void *pt_window,

          void *pt_target

)

 

 

Parameters

 

flag

Is a bit representing the current drawing step.  This will be one of the bits you have registered for.

 

pt_window

Is a pointer to the window where the drawing s taking place, or NULL if the drawing is not in a specific window (the REDRAW_GENERAL and REDRAW_FINAL steps).

 

pt_target

Depending on the value of "flag", this parameter will be:

·NULL.  While drawing 2D operations (REDRAW_GENERAL, REDRAW_WINDOW, REDRAW_DLL_OPENGL, REDRAW_DLL_STENCIL and REDRAW_FINAL).

·NULL.  While drawing REDRAW_3D_POST, REDRAW_3D_END.

·Step_Total. While drawing REDRAW_3D_PRE

·Step_Current. While drawing REDRAW_3D_WINDOW, REDRAW_3D_CAMERA, REDRAW_3D_LIGHT, REDRAW_3D_TRANSFO and REDRAW_3D_DLL.

 

 

Return value

 

The function returns "0" if an error occurred, "1" otherwise.

 

 

Remarks

 

 

Requirements

 

Header:

          sliceO_include.hpp

 

Library:

          sliceO_Structures.lib

 

 

Example

 

...

 

// ----------------------------------------------------------------------------

//

//          Function:          Draw

//

//          Parameters:          flag (unsigned int)          flag of this draw (64 bits)

//                              pt_window (VOID *)          Pointer to the current window

//                              pt_target (VOID *)          Pointer to the current structure

//                                                            (study,series,image or frame)

//

//          Returns:          (int)                    0 if error

//

//          This is called after sliceO has redrawn the image, in case you would

//          want to add something to the graphics.

//

// ----------------------------------------------------------------------------

extern "C" __declspec(dllexport) int          Draw( UInt64 flag, void *pt_window, void *pt_target )

{

          // --- only draw point if the ctrl window is on or "On" flag is set ---

          if ( (! Point_On) && (! Ctrl_Query()) )

              return( 1 ) ;

 

          SliceO_Window *window = (SliceO_Window *) pt_window ;

 

          // ====================================================================

          // ===                              Points in 2D images

          // ====================================================================

          if ( flag & REDRAW_DLL_OPENGL ) {

 

              // --- we react differently according to the Window Mode ---

              switch( window->Mode_Get() ) {

              case WINDOW_MODE_ONE :

                    {

                        SliceO_Frame **Frame_Cur = (SliceO_Frame **) Fct_Variable_Value( "$FRAME_CUR" ) ;

                        if( ! Frame_Cur )

                              return( 0 ) ;

 

                        Point_Draw_2D( window, Frame_Cur[window->Id_Get()] ) ;

                    }

                    break ;

 

              case WINDOW_MODE_ALL :

 

                    // --- we are only interested in the drawing of the "frame" ---

                    if ( Iterator_Init( ITERATOR_0, "Point: Draw" ) ) {

                        while ( SliceO_Frame *frame = (SliceO_Frame *) Iterator_Class( ITERATOR_0, CLASS_ID_FRAME, window, ITER_FLAG_VISIBLE ) )

                              Point_Draw_2D( window, frame ) ;

                        Iterator_End( ITERATOR_0 ) ;

                    }

 

                    break ;

              }

          }

 

          // ====================================================================

          // ===                              Points in 3D windows

          // ====================================================================

          if ( flag & REDRAW_3D_PRE ) {

 

              Point_Draw_3D( window ) ;

          }

 

          return( 1 ) ;

}

 

...

 

See also