The Tool_Brush class enable you to draw a tool that is used to select the Current Brush. Clicking on one of the brush's buttons will select it inside the tool. The "Read()" method can then be used to return its index.
The variables of the Tool_Brush class are:
There is no variable associated with this class.
The methods of the Tool_Brush class are:
|
Tool_Brush( void ) ;
|
Constructor |
|
~Tool_Brush() ;
|
Destructor |
|
int Read( void ) ;
|
Return the index of the currently selected brush. You should use this method inside "Ctrl_Click" function to update the current brush's variable. if ( tool_brush.Click( up_down ) >= 0 ) { unsigned short *Brush_Cur = (unsigned short *) Fct_Variable_Get( "$BRUSH_CUR" ) ; if ( ! Brush_Cur ) return( 0 ) ; if ( *Brush_Cur != tool_brush.Read() ) { // --- we changed the current tag --- *Brush_Cur = tool_brush.Read() ; Fct_Update( UPDATE_CUR_BRUSH ) ; } return( 1 ) ; } |
The methods shared with the other SliceO_Tool classes are:
|
int Click( int up_down ) ; |
You must call this method if the user has activated a mouse button while the cursor is inside the tool |
|
void Draw( void ) ;
|
This method will draw the tool |
|
int Height( unsigned short nb=10 ) ; |
This method returns the height (in pixel) of the tool. The "nb" parameter defines how many lines of information will be displayed. |
|
int Keyboard( int key ) ; |
You must call this method if the user has activated a keyboard key while the cursor is inside the tool |
|
void Leave( void ) ;
|
You must call this method if the user move the cursor outside of the tool |
|
int Motion( int up_down ) ;
|
You must call this method if the user move the cursor inside the tool |
|
int Resize( Boxs *box ) ; |
You must call this method to resize the tool. The tool will reside inside the bounding box of the "Boxs" class. |
|
int Scroll( int val ) ; |
You must call this method if the user has activated the mouse wheel while the cursor is inside the tool |
|
void Update( UInt64 flag ) |
You must call this method when external events change the content of the tool. The "flag" parameter is the "Update Flag" defining these changes. The update should be called if one of the following flags are changed: UPDATE_ALL_TOOLS UPDATE_CUR_TAG // the current tag has changed UPDATE_COLOR_TAG // the color of a tag has changed UPDATE_CUR_BRUSH // the current brush has changed |
The Brushes in sliceOmatic are controlled by a number of system variables:
Brush_Max
The maximum number of brushes that can be defined in sliceO. This variable is read only. (=6)
You can get the value of this variable with:
unsigned short Brush_Max = (unsigned short) Fct_Variable_Value( "$BRUSH_MAX" ) ;
Brush_Nb
The number of brushes defined in sliceO. (default = 6)
You can get the value of this variable with:
unsigned short Brush_Nb = (unsigned short) Fct_Variable_Value( "$BRUSH_NB" ) ;
You can get a pointer to this variable with:
unsigned short * Brush_Nb = (unsigned short) Fct_Variable_Get( "$BRUSH_NB" ) ;
Brush_Cur
The currently selected brush.
You can get the value of this variable with:
unsigned short Brush_Cur = (unsigned short) Fct_Variable_Value( "$BRUSH_NB" ) ;
You can get a pointer to this variable with:
unsigned short * Brush_Cur = (unsigned short) Fct_Variable_Get( "$BRUSH_NB" ) ;
Brush_Radius
Maximum radius of the brushes. This variable is read only. (=25)
You can get the value of this variable with:
unsigned short Brush_Radius = (unsigned short) Fct_Variable_Value( "$BRUSH_RADIUS" ) ;
Brush_Size
A vector of brush size (one per brush). The size is the radius (in pixels) of the brush's circle. (default = 1, 2, 4, 6, 8, 10)
You can get the value of this variable with:
unsigned short * Brush_Size = (unsigned short *) Fct_Variable_Value( "$BRUSH_SIZE" ) ;
Brush_Big
The size of the big square brush (when the middle mouse button is pressed). (default =15)
You can get the value of this variable with:
unsigned short Brush_Big = (unsigned short) Fct_Variable_Value( "$BRUSH_BIG" ) ;
You can get a pointer to this variable with:
unsigned short * Brush_Big = (unsigned short) Fct_Variable_Get( "$BRUSH_BIG" ) ;
Brush_Pt
A vector of 2D images for the brush matrix (one per brush). Each matrix is 2*Brush_Radius+1 by 2*Brush_Radius+1. each element of the matrix is an unsigned char, either transparent (0) or opaque (1).
You can get the value of this variable with:
unsigned char *** Brush_Pt = (unsigned char ***) Fct_Variable_Value( "$BRUSH_PT" ) ;
An example of the usage of the Tool_Brush class is given in the Samples\SliceO Tools\Brush_Selection demo directory.
The tool_brush_ctrl.cpp file from the Tool_Brush demo
|