// file: $USFS/class/image_segmentation/v1.0/imags_win_1.cc
//

// isip include files
//
#include "image_segmentation.h"
#include "image_segmentation_constants.h"

// method: update_buf_cc
//
// arguments:
//  int_4 result: (input) the classification result
//  uint_1*& buf_red: (input & output) the buffer for red color
//  uint_1*& buf_green: (input & output) the buffer for green color
//  uint_1*& buf_blue: (input & output) the buffer for blue color
//  int_4 width: (input) the width of the image block
//  int_4 height: (input) the height of the image block
//   
// return:
//   a logical_1 value indicating status
//
// this method updates pixel buffers according to the classification result
//
logical_1 Image_segmentation::update_buf_cc(int_4 result_a, uint_1*& buf_red_a,
					    uint_1*& buf_green_a,
					    uint_1*& buf_blue_a,
					    int_4 width_a, int_4 height_a) {
  
  // compute the length of the buffers
  //
  int_4 buf_len = width_a * height_a;
  
  for (int_4 i=0; i<buf_len; i++) {

    // change the intensity value of the pixel according to the
    // classification result
    //
    buf_red_a[i] = intensity_r[result_a];
    buf_green_a[i] = intensity_g[result_a];
    buf_blue_a[i] = intensity_b[result_a];
  }

  // exit gracefully
  //
  return ISIP_TRUE;
}
