/* * VisiQuest */ /* * Copyright (c) AccuSoft Corporation, 2005. * All rights reserved. See $BOOTSTRAP/repos/license/License or run klicense. */ /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<< >>>> >>>> Driver code for myrgbdecompose >>>> >>>> Private: >>>> run_myrgbdecompose() >>>> myrgbdecompose_extra_usage_additions(); >>>> myrgbdecompose_extra_free_args(); >>>> Static: >>>> Public: >>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<< */ #include "myrgbdecompose.h" /*----------------------------------------------------------- | | Routine Name: run_myrgbdecompose() - Extract R, G, B channels from a color image | | Purpose: program driver code for myrgbdecompose | | Returns: TRUE (1) on success, FALSE (0) on failure | Written By: gnemeth | Date: Apr 23, 2008 | ------------------------------------------------------------*/ int run_myrgbdecompose(void) { /*-- Put Your Code Here --*/ return TRUE; } /*----------------------------------------------------------- | | Routine Name: myrgbdecompose_usage_additions | | Purpose: Prints usage additions in myrgbdecompose_usage routine | | Written By: gnemeth | Date: Apr 23, 2008 | ------------------------------------------------------------*/ void myrgbdecompose_extra_usage_additions(void) { /*-- Put Your Code Here --*/ return; } /*----------------------------------------------------------- | | Routine Name: myrgbdecompose_free_args | | Purpose: Frees CLUI struct allocated in myrgbdecompose_get_args() | | Input: status - The exit status for the program. | client_data - Client data needed to by the exit handler | Written By: gnemeth | Date: Apr 23, 2008 | ------------------------------------------------------------*/ /* ARGSUSED */ void myrgbdecompose_extra_free_args( kexit_status status, kaddr client_data) { /*-- Put Your Code Here --*/ /* -main_variable_list */ char *lib = "mythreshold_obj"; char *rtn = "main"; kobject in_object = NULL; kobject red_object = NULL; kobject green_object = NULL; kobject blue_object = NULL; int inRGB[3]; int red, green, blue; int redRGB[3]; int greenRGB[3]; int blueRGB[3]; int w, h, d, t, e; int cw, ch, ct, pos; /* -main_variable_list_end */ /* -main_before_lib_call */ if ((in_object = kpds_open_input_object(clui_info->i_file)) == KOBJECT_INVALID) { kerror(lib, rtn, "Can not open input object %s.\n", clui_info->i_file); kexit(KEXIT_FAILURE); } if ((red_object = kpds_open_output_object(clui_info->ored_file)) == KOBJECT_INVALID) { kerror(lib, rtn, "Can not open output object %s.\n", clui_info->ored_file); kexit(KEXIT_FAILURE); } if ((green_object = kpds_open_output_object(clui_info->ogreen_file)) == KOBJECT_INVALID) { kerror(lib, rtn, "Can not open output object %s.\n", clui_info->ogreen_file); kexit(KEXIT_FAILURE); } if ((blue_object = kpds_open_output_object(clui_info->oblue_file)) == KOBJECT_INVALID) { kerror(lib, rtn, "Can not open output object %s.\n", clui_info->oblue_file); kexit(KEXIT_FAILURE); } if (!kpds_copy_object(in_object, red_object)) { kerror(lib, rtn, "Can not copy input object to output object.\n"); kexit(KEXIT_FAILURE); } if (!kpds_copy_object(in_object, green_object)) { kerror(lib, rtn, "Can not copy input object to output object.\n"); kexit(KEXIT_FAILURE); } if (!kpds_copy_object(in_object, blue_object)) { kerror(lib, rtn, "Can not copy input object to output object.\n"); kexit(KEXIT_FAILURE); } kpds_set_attribute(in_object, KPDS_VALUE_DATA_TYPE, KUINT); kpds_set_attribute(red_object, KPDS_VALUE_DATA_TYPE, KUINT); kpds_set_attribute(green_object, KPDS_VALUE_DATA_TYPE, KUINT); kpds_set_attribute(blue_object, KPDS_VALUE_DATA_TYPE, KUINT); kpds_get_attribute(in_object, KPDS_VALUE_SIZE, &w, &h, &d, &t, &e); /* -main_before_lib_call_end */ /* -main_library_call */ for (ct = 0; ct < t; ct++) { for ( ch = 0; ch < h; ch++ ) { for ( cw = 0; cw < w; cw++ ) { kpds_set_attribute( in_object, KPDS_VALUE_POSITION, cw,ch,0, ct, 0 ); kpds_get_data( in_object, KPDS_VALUE_VECTOR, (kaddr)inRGB ); pos = ch * w + cw; redRGB[0] = inRGB[0]; redRGB[1] = 0; redRGB[2] = 0; greenRGB[0] = 0; greenRGB[1] = inRGB[1]; greenRGB[2] = 0; blueRGB[0] = 0; blueRGB[1] = 0; blueRGB[2] = inRGB[2]; kpds_set_attribute( red_object, KPDS_VALUE_POSITION, cw,ch,0, ct, 0 ); kpds_put_data( red_object, KPDS_VALUE_VECTOR, (kaddr)redRGB ); kpds_set_attribute( green_object, KPDS_VALUE_POSITION, cw,ch,0, ct, 0 ); kpds_put_data( green_object, KPDS_VALUE_VECTOR, (kaddr)greenRGB ); kpds_set_attribute( blue_object, KPDS_VALUE_POSITION, cw,ch,0, ct, 0 ); kpds_put_data( blue_object, KPDS_VALUE_VECTOR, (kaddr)blueRGB ); } } } /* -main_library_call_end */ /* -main_after_lib_call */ if (!kpds_set_attribute(red_object, KPDS_HISTORY, kpds_history_string())) { kerror(lib,rtn,"Unable to set history on the destination object"); kexit(KEXIT_FAILURE); } if (!kpds_set_attribute(green_object, KPDS_HISTORY, kpds_history_string())) { kerror(lib,rtn,"Unable to set history on the destination object"); kexit(KEXIT_FAILURE); } if (!kpds_set_attribute(blue_object, KPDS_HISTORY, kpds_history_string())) { kerror(lib,rtn,"Unable to set history on the destination object"); kexit(KEXIT_FAILURE); } kpds_close_object(in_object); kpds_close_object(red_object); kpds_close_object(green_object); kpds_close_object(blue_object); /* -main_after_lib_call_end */ return; }