Tools::Alloc_Graph_*

 

Tools::Alloc_Graph_Select

Tools::Alloc_Graph_Normal

 

These method allocate memory for the Graph_Select and Graph_Normal variables. 

 

 

Syntax

 

int  Alloc_Graph_Select(

          unsigned long start_value=COLOR_INV_RED

) ;

 

int  Alloc_Graph_Normal(

          unsigned long start_value=COLOR_GREY

) ;

 

 

Parameters

 

start_value

          The color (as RGB 32 bit integer) used to fill out the tool. If no color is specified, then the default color for normal or select are used..

 

 

Return value

 

1 if success, 0 if an error has occurred.

 

 

Remarks

 

By using these methods to allocate the memory, you are assured that it will be reclaimed when the tools are deleted.  You should only use this method to allocate memory if you plan to create your own graphic background for the tools. The memory should be allocated before you call "init".

 

 

Requirements

 

Header:

          TomoVision_Util.hpp

          TomoVision_Tools.hpp

 

Library:

          TomoVision_Util.lib

          TomoVision_Tools.lib

 

 

Example

 

// --- Assign a red scale to a slider (from black at the left to red at the right) ---

 

int          i, j, k ;

Valuators red ;

Color          col ;

 

          col.color = 0 ;

          col.col.I = 255 ;

 

          ...

 

          // --- prepare memory ---

          red.Alloc_Graph_Normal() ;

 

          // --- fill out the color background ---

          for ( k=j=0; j < red.Dim_Y; j++ )

                    for ( i=0; i < red.Dim_X; i++, k++ ) {

                              // --- The colors displayed in GDI are inverse of OpenGL ---

                              col.inv.R = (unsigned char) ((i * 255.0f) / red.Dim_X) ;

                              ((long *) red.Graph_Normal)[k] = col.color ;

                    }

 

          // --- assign same background to Normal and Select ---

          red.Graph_Select = red.Graph_Normal ;

 

          red.ini() ;

 

          ...

 

See also