Some buffers are specific to the frames, for the most used ones (Erase, Work_GLI and Work_TAG) we have specific methods to address them:
|
Public: |
Buf_Erase (void *) |
Shortcut to the Erase buffer. If this variable exist, you can access the buffer directly from it. Otherwise, you need to use "Erase_Get()" to obtain a pointer to the buffer. |
|
|
||
|
|
||
|
|
||
|
Methods to Lock and Unlock the buffer while you are working with it.
|
||
|
Public: |
Buf_Work_GLI (void *) |
Shortcut to the Erase buffer. If this variable exist, you can access the buffer directly from it. Otherwise, you need to use "Work_GLI_Get()" to obtain a pointer to the buffer. |
|
|
||
|
|
||
|
|
||
|
Methods to Lock and Unlock the buffer while you are working with it.
|
||
|
Public: |
Buf_Work_TAG (void *) |
Shortcut to the Erase buffer. If this variable exist, you can access the buffer directly from it. Otherwise, you need to use "Work_TAG_Get()" to obtain a pointer to the buffer. |
|
|
||
|
|
||
|
|
||
|
Methods to Lock and Unlock the buffer while you are working with it.
|
||
|
Public: |
Buf_Disp_GLI (void *) |
Shortcut to the buffers. If this variable exist, you can access the buffers directly from them. Otherwise, you need to use "User_Get()" mechanism to obtain a pointer to the buffer.
|
|
Buf_Disp_TAG (void *) |
||
|
Buf_Mask (void *) |
||
|
Buf_Filter (void *) |
||
|
Buf_Gradient (void *) |
The Erase buffer
The erase buffer is used for all the "Erase" operation. When the user use the right mouse button to "erase", he actually paint with the content of the erase buffer.
The Work_GLI buffer
The Work_TAG buffer
These buffers contain a copy of the GLI and TAG information in the same format as the original data. The GLI data is 16 bit unsigned and the TAG is also a 16 bit unsigned. The lower byte of the Work_TAG pixels contain the 8 bit TAG value which leave another 8 bits for you (for example, when computing the "preview" in region growing, I use one of these bits). When reading pixel data, it is faster to access these buffers than to go through the database tree up to the root and access the data from the original files. However, when changing the TAG data you have no choice but to go all the way to the files.
Example of Work_GLI and Work_TAG usage:
This example is extracted from the Region Growing Mode code. The value extracted from the Work_GLI buffer is used to test if a pixel in within the threshold range of a TAG. If it is, I mark one of the higher bits of the Work_TAG pixels under the brush. In this mode, I also replaced the callback for the "Fct_Update_TAG_Disp" function. In that function, I display the preview color for all pixels who have the Work_TAG bit marked (see the example for the Display_TAG_Buffer).
The Disp_GLI buffer
The Disp_TAG buffer
These buffers are used by SliceOmatic when redrawing the frames, they contain a copy of the GLI and TAG data as it is displayed. For the GLI buffer, the data is transformed from the original 16 bit unsigned value to an 32bit RGBA value using the colormap and the brightness/contrast information. The TAG values are transformed from the original 8 bit to 32 bit RGBA using the $TAG_RED, $TAG_GRN, $TAG_BLU and $TAG_ALPHA information.
Example of Display_TAG usage:
In the previous example, I marked one of the high bits of the Work_TAG buffer. In this example, I assigne the "Region_Update_TAG_Disp" function to the "Fct_Update_TAG_Disp" callback. It will assign the preview color to these marked pixels. By changing the color of the pixels in the Disp_TAG buffer, I changed the color of the pixel that will be displayed on the screen.
The Mask buffer
Unless you plan to replace the default callbacks for "Fct_Pixel_Get_Filter", "Fct_Pixel_Get_Gradient_Amp" and "Fct_Pixel_Get_Gradient_Dir", this buffer is of no interest to you. This buffer is associated with the Filter and the Gradient buffers. For each pixel of the frame, we have an 8 bit flag that tells us if the filtered and gradient values for this pixel have already been computed.
If you have "frame" a pointer to a frame, you can get a pointer to the Mask buffer with:
The Filter buffer
Unless you plan to replace the default callbacks for "Fct_Pixel_Get_Filter", this buffer is of no interest to you. This buffer contain a 16 bit filtered version of the frame's GLI image
If you have "frame" a pointer to a frame, you can get a pointer to the Filter buffer with:
The Gradient buffer
Unless you plan to replace the default callbacks for "Fct_Pixel_Get_Gradient_Amp" and "Fct_Pixel_Get_Gradient_Dir", this buffer is of no interest to you. This buffer contain the gradient amplitude and direction for each of the GLI pixels. The gradient amplitude is stored as a 16 bit unsigned short in the higher 16 bits of a 32 bit value. The lower 16 bits store the direction of the gradient as 2 angles in spherical systems.
If you have "frame" a pointer to a frame, you can get a pointer to the Gradient buffer with: