Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

colour_coding.c

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------- 00002 @COPYRIGHT : 00003 Copyright 1993,1994,1995 David MacDonald, 00004 McConnell Brain Imaging Centre, 00005 Montreal Neurological Institute, McGill University. 00006 Permission to use, copy, modify, and distribute this 00007 software and its documentation for any purpose and without 00008 fee is hereby granted, provided that the above copyright 00009 notice appear in all copies. The author and McGill University 00010 make no representations about the suitability of this 00011 software for any purpose. It is provided "as is" without 00012 express or implied warranty. 00013 ---------------------------------------------------------------------------- */ 00014 00015 #include <volume_io/internal_volume_io.h> 00016 #include <bicpl/vols.h> 00017 00018 #ifndef lint 00019 static char rcsid[] = "$Header: /software/source//libraries/bicpl/Volumes/colour_coding.c,v 1.26 2000/12/15 19:55:07 stever Exp $"; 00020 #endif 00021 00022 private void interpolate_colours( 00023 colour_point *p1, 00024 colour_point *p2, 00025 Real pos, 00026 Real *r, 00027 Real *g, 00028 Real *b, 00029 Real *a ); 00030 00031 private void recreate_piecewise_function( 00032 colour_coding_struct *colour_coding, 00033 Colour_coding_types type, 00034 BOOLEAN set_user_defined ); 00035 00036 /* ----------------------------- MNI Header ----------------------------------- 00037 @NAME : initialize_colour_coding 00038 @INPUT : type 00039 under_colour 00040 over_colour 00041 min_value 00042 max_value 00043 @OUTPUT : colour_coding 00044 @RETURNS : 00045 @DESCRIPTION: Initializes the colour coding struct to the given values. 00046 @METHOD : 00047 @GLOBALS : 00048 @CALLS : 00049 @CREATED : 1993 David MacDonald 00050 @MODIFIED : 00051 ---------------------------------------------------------------------------- */ 00052 00053 public void initialize_colour_coding( 00054 colour_coding_struct *colour_coding, 00055 Colour_coding_types type, 00056 Colour under_colour, 00057 Colour over_colour, 00058 Real min_value, 00059 Real max_value ) 00060 { 00061 colour_coding->n_colour_points = 0; 00062 colour_coding->user_defined_n_colour_points = 0; 00063 00064 set_colour_coding_type( colour_coding, type ); 00065 set_colour_coding_min_max( colour_coding, min_value, max_value ); 00066 set_colour_coding_under_colour( colour_coding, under_colour ); 00067 set_colour_coding_over_colour( colour_coding, over_colour ); 00068 00069 recreate_piecewise_function( colour_coding, GRAY_SCALE, TRUE ); 00070 } 00071 00072 /* ----------------------------- MNI Header ----------------------------------- 00073 @NAME : delete_colour_coding 00074 @INPUT : colour_coding 00075 @OUTPUT : 00076 @RETURNS : 00077 @DESCRIPTION: 00078 @METHOD : 00079 @GLOBALS : 00080 @CALLS : 00081 @CREATED : Nov. 25, 1996 David MacDonald 00082 @MODIFIED : 00083 ---------------------------------------------------------------------------- */ 00084 00085 public void delete_colour_coding( 00086 colour_coding_struct *colour_coding ) 00087 { 00088 if( colour_coding->n_colour_points > 0 ) 00089 FREE( colour_coding->colour_points ); 00090 if( colour_coding->user_defined_n_colour_points > 0 ) 00091 FREE( colour_coding->user_defined_colour_points ); 00092 } 00093 00094 /* ----------------------------- MNI Header ----------------------------------- 00095 @NAME : set_colour_coding_type 00096 @INPUT : colour_coding 00097 type 00098 @OUTPUT : 00099 @RETURNS : 00100 @DESCRIPTION: Sets the type of the colour coding (e.g. GRAY_SCALE, HOT_METAL). 00101 @METHOD : 00102 @GLOBALS : 00103 @CALLS : 00104 @CREATED : 1993 David MacDonald 00105 @MODIFIED : 00106 ---------------------------------------------------------------------------- */ 00107 00108 public void set_colour_coding_type( 00109 colour_coding_struct *colour_coding, 00110 Colour_coding_types type ) 00111 { 00112 colour_coding->type = type; 00113 00114 recreate_piecewise_function( colour_coding, type, FALSE ); 00115 } 00116 00117 /* ----------------------------- MNI Header ----------------------------------- 00118 @NAME : get_colour_coding_type 00119 @INPUT : colour_coding 00120 @OUTPUT : 00121 @RETURNS : type of colour_coding 00122 @DESCRIPTION: 00123 @METHOD : 00124 @GLOBALS : 00125 @CALLS : 00126 @CREATED : Nov. 25, 1996 David MacDonald 00127 @MODIFIED : 00128 ---------------------------------------------------------------------------- */ 00129 00130 public Colour_coding_types get_colour_coding_type( 00131 colour_coding_struct *colour_coding ) 00132 { 00133 return( colour_coding->type ); 00134 } 00135 00136 /* ----------------------------- MNI Header ----------------------------------- 00137 @NAME : set_colour_coding_min_max 00138 @INPUT : colour_coding 00139 min_value 00140 max_value 00141 @OUTPUT : 00142 @RETURNS : 00143 @DESCRIPTION: Sets the limits of the colour coding. 00144 @METHOD : 00145 @GLOBALS : 00146 @CALLS : 00147 @CREATED : 1993 David MacDonald 00148 @MODIFIED : 00149 ---------------------------------------------------------------------------- */ 00150 00151 public void set_colour_coding_min_max( 00152 colour_coding_struct *colour_coding, 00153 Real min_value, 00154 Real max_value ) 00155 { 00156 colour_coding->min_value = min_value; 00157 colour_coding->max_value = max_value; 00158 } 00159 00160 /* ----------------------------- MNI Header ----------------------------------- 00161 @NAME : get_colour_coding_min_max 00162 @INPUT : colour_coding 00163 @OUTPUT : min_value 00164 max_value 00165 @RETURNS : 00166 @DESCRIPTION: Passes back the limits of the colour coding. 00167 @METHOD : 00168 @GLOBALS : 00169 @CALLS : 00170 @CREATED : 1993 David MacDonald 00171 @MODIFIED : 00172 ---------------------------------------------------------------------------- */ 00173 00174 public void get_colour_coding_min_max( 00175 colour_coding_struct *colour_coding, 00176 Real *min_value, 00177 Real *max_value ) 00178 { 00179 *min_value = colour_coding->min_value; 00180 *max_value = colour_coding->max_value; 00181 } 00182 00183 /* ----------------------------- MNI Header ----------------------------------- 00184 @NAME : get_colour_coding_under_colour 00185 @INPUT : colour_coding 00186 @OUTPUT : 00187 @RETURNS : Colour 00188 @DESCRIPTION: Returns the colour used to code values below the min_value. 00189 @METHOD : 00190 @GLOBALS : 00191 @CALLS : 00192 @CREATED : 1993 David MacDonald 00193 @MODIFIED : 00194 ---------------------------------------------------------------------------- */ 00195 00196 public Colour get_colour_coding_under_colour( 00197 colour_coding_struct *colour_coding ) 00198 { 00199 return( colour_coding->under_colour ); 00200 } 00201 00202 /* ----------------------------- MNI Header ----------------------------------- 00203 @NAME : set_colour_coding_under_colour 00204 @INPUT : colour_coding 00205 under_colour 00206 @OUTPUT : 00207 @RETURNS : 00208 @DESCRIPTION: Sets the colour used to code values below the min_value. 00209 @METHOD : 00210 @GLOBALS : 00211 @CALLS : 00212 @CREATED : 1993 David MacDonald 00213 @MODIFIED : 00214 ---------------------------------------------------------------------------- */ 00215 00216 public void set_colour_coding_under_colour( 00217 colour_coding_struct *colour_coding, 00218 Colour under_colour ) 00219 { 00220 colour_coding->under_colour = under_colour; 00221 } 00222 00223 /* ----------------------------- MNI Header ----------------------------------- 00224 @NAME : get_colour_coding_over_colour 00225 @INPUT : colour_coding 00226 @OUTPUT : 00227 @RETURNS : Colour 00228 @DESCRIPTION: Returns the colour used to code values above the max_value. 00229 @METHOD : 00230 @GLOBALS : 00231 @CALLS : 00232 @CREATED : 1993 David MacDonald 00233 @MODIFIED : 00234 ---------------------------------------------------------------------------- */ 00235 00236 public Colour get_colour_coding_over_colour( 00237 colour_coding_struct *colour_coding ) 00238 { 00239 return( colour_coding->over_colour ); 00240 } 00241 00242 /* ----------------------------- MNI Header ----------------------------------- 00243 @NAME : set_colour_coding_over_colour 00244 @INPUT : colour_coding 00245 over_colour 00246 @OUTPUT : 00247 @RETURNS : 00248 @DESCRIPTION: Sets the colour used to code values above the max_value. 00249 @METHOD : 00250 @GLOBALS : 00251 @CALLS : 00252 @CREATED : 1993 David MacDonald 00253 @MODIFIED : 00254 ---------------------------------------------------------------------------- */ 00255 00256 public void set_colour_coding_over_colour( 00257 colour_coding_struct *colour_coding, 00258 Colour over_colour ) 00259 { 00260 colour_coding->over_colour = over_colour; 00261 00262 /*--- force regeneration of the piecewise colour function, if needed, 00263 since the over colour determines the colour map in the case 00264 of SINGLE_COLOUR_SCALE */ 00265 00266 if( get_colour_coding_type( colour_coding ) == SINGLE_COLOUR_SCALE ) 00267 { 00268 recreate_piecewise_function( colour_coding, 00269 get_colour_coding_type(colour_coding), 00270 FALSE ); 00271 } 00272 } 00273 00274 /* ----------------------------- MNI Header ----------------------------------- 00275 @NAME : get_colour_table_piecewise_function 00276 @INPUT : colour_coding 00277 @OUTPUT : points 00278 @RETURNS : number of points 00279 @DESCRIPTION: Gets a piecewise function from 0 to 1 representing the colour 00280 coding. 00281 @METHOD : 00282 @GLOBALS : 00283 @CALLS : 00284 @CREATED : 1993 David MacDonald 00285 @MODIFIED : Nov. 25, 1996 D. MacDonald - now stores the table in the 00286 structure 00287 ---------------------------------------------------------------------------- */ 00288 00289 private void recreate_piecewise_function( 00290 colour_coding_struct *colour_coding, 00291 Colour_coding_types type, 00292 BOOLEAN set_user_defined ) 00293 { 00294 static colour_point gray_scale_points[] = 00295 { {0.0, 0.0, 0.0, 0.0, 1.0, RGB_SPACE }, 00296 {1.0, 1.0, 1.0, 1.0, 1.0, RGB_SPACE } }; 00297 static colour_point hot_metal_points[] = 00298 { {0.0, 0.0, 0.0, 0.0, 1.0, RGB_SPACE }, 00299 {0.25, 0.5, 0.0, 0.0, 1.0, RGB_SPACE }, 00300 {0.5, 1.0, 0.5, 0.0, 1.0, RGB_SPACE }, 00301 {0.75, 1.0, 1.0, 0.5, 1.0, RGB_SPACE }, 00302 {1.0, 1.0, 1.0, 1.0, 1.0, RGB_SPACE } }; 00303 static colour_point spectral_points[] = 00304 { { 0.00, 0.0000,0.0000,0.0000, 1.0, RGB_SPACE}, 00305 { 0.05, 0.4667,0.0000,0.5333, 1.0, RGB_SPACE}, 00306 { 0.10, 0.5333,0.0000,0.6000, 1.0, RGB_SPACE}, 00307 { 0.15, 0.0000,0.0000,0.6667, 1.0, RGB_SPACE}, 00308 { 0.20, 0.0000,0.0000,0.8667, 1.0, RGB_SPACE}, 00309 { 0.25, 0.0000,0.4667,0.8667, 1.0, RGB_SPACE}, 00310 { 0.30, 0.0000,0.6000,0.8667, 1.0, RGB_SPACE}, 00311 { 0.35, 0.0000,0.6667,0.6667, 1.0, RGB_SPACE}, 00312 { 0.40, 0.0000,0.6667,0.5333, 1.0, RGB_SPACE}, 00313 { 0.45, 0.0000,0.6000,0.0000, 1.0, RGB_SPACE}, 00314 { 0.50, 0.0000,0.7333,0.0000, 1.0, RGB_SPACE}, 00315 { 0.55, 0.0000,0.8667,0.0000, 1.0, RGB_SPACE}, 00316 { 0.60, 0.0000,1.0000,0.0000, 1.0, RGB_SPACE}, 00317 { 0.65, 0.7333,1.0000,0.0000, 1.0, RGB_SPACE}, 00318 { 0.70, 0.9333,0.9333,0.0000, 1.0, RGB_SPACE}, 00319 { 0.75, 1.0000,0.8000,0.0000, 1.0, RGB_SPACE}, 00320 { 0.80, 1.0000,0.6000,0.0000, 1.0, RGB_SPACE}, 00321 { 0.85, 1.0000,0.0000,0.0000, 1.0, RGB_SPACE}, 00322 { 0.90, 0.8667,0.0000,0.0000, 1.0, RGB_SPACE}, 00323 { 0.95, 0.8000,0.0000,0.0000, 1.0, RGB_SPACE}, 00324 { 1.00, 0.8000,0.8000,0.8000, 1.0, RGB_SPACE} 00325 }; 00326 static colour_point red_points[] = 00327 { {0.0, 0.0, 0.0, 0.0, 1.0, RGB_SPACE }, 00328 {1.0, 1.0, 0.0, 0.0, 1.0, RGB_SPACE } }; 00329 static colour_point green_points[] = 00330 { {0.0, 0.0, 0.0, 0.0, 1.0, RGB_SPACE }, 00331 {1.0, 0.0, 1.0, 0.0, 1.0, RGB_SPACE } }; 00332 static colour_point blue_points[] = 00333 { {0.0, 0.0, 0.0, 0.0, 1.0, RGB_SPACE }, 00334 {1.0, 0.0, 0.0, 1.0, 1.0, RGB_SPACE } }; 00335 static colour_point contour_points[] = 00336 { {0.0, 0.0, 0.0, 0.3, 1.0, RGB_SPACE }, 00337 {0.166, 0.0, 0.0, 1.0, 1.0, RGB_SPACE }, 00338 {0.166, 0.0, 0.3, 0.3, 1.0, RGB_SPACE }, 00339 {0.333, 0.0, 1.0, 1.0, 1.0, RGB_SPACE }, 00340 {0.333, 0.0, 0.3, 0.0, 1.0, RGB_SPACE }, 00341 {0.5, 0.0, 1.0, 0.0, 1.0, RGB_SPACE }, 00342 {0.5, 0.3, 0.3, 0.0, 1.0, RGB_SPACE }, 00343 {0.666, 1.0, 1.0, 0.0, 1.0, RGB_SPACE }, 00344 {0.666, 0.3, 0.0, 0.0, 1.0, RGB_SPACE }, 00345 {0.833, 1.0, 0.0, 0.0, 1.0, RGB_SPACE }, 00346 {0.833, 0.3, 0.3, 0.3, 1.0, RGB_SPACE }, 00347 {1.0, 1.0, 1.0, 1.0, 1.0, RGB_SPACE } }; 00348 colour_point *points, **points_ptr; 00349 int p, n_points, *n_points_ptr; 00350 Real r, g, b, a; 00351 00352 switch( type ) 00353 { 00354 case GRAY_SCALE: 00355 case SINGLE_COLOUR_SCALE: 00356 n_points = SIZEOF_STATIC_ARRAY( gray_scale_points ); 00357 points = gray_scale_points; 00358 break; 00359 00360 case HOT_METAL: 00361 n_points = SIZEOF_STATIC_ARRAY( hot_metal_points ); 00362 points = hot_metal_points; 00363 break; 00364 00365 case SPECTRAL: 00366 n_points = SIZEOF_STATIC_ARRAY( spectral_points ); 00367 points = spectral_points; 00368 break; 00369 00370 case RED_COLOUR_MAP: 00371 n_points = SIZEOF_STATIC_ARRAY( red_points ); 00372 points = red_points; 00373 break; 00374 00375 case GREEN_COLOUR_MAP: 00376 n_points = SIZEOF_STATIC_ARRAY( green_points ); 00377 points = green_points; 00378 break; 00379 00380 case BLUE_COLOUR_MAP: 00381 n_points = SIZEOF_STATIC_ARRAY( blue_points ); 00382 points = blue_points; 00383 break; 00384 00385 case CONTOUR_COLOUR_MAP: 00386 n_points = SIZEOF_STATIC_ARRAY( contour_points ); 00387 points = contour_points; 00388 break; 00389 00390 case USER_DEFINED_COLOUR_MAP: 00391 n_points = colour_coding->user_defined_n_colour_points; 00392 points = colour_coding->user_defined_colour_points; 00393 break; 00394 } 00395 00396 if( set_user_defined ) 00397 { 00398 n_points_ptr = &colour_coding->user_defined_n_colour_points; 00399 points_ptr = &colour_coding->user_defined_colour_points; 00400 } 00401 else 00402 { 00403 n_points_ptr = &colour_coding->n_colour_points; 00404 points_ptr = &colour_coding->colour_points; 00405 } 00406 00407 if( n_points != *n_points_ptr ) 00408 { 00409 if( *n_points_ptr > 0 ) 00410 FREE( *points_ptr ); 00411 00412 *n_points_ptr = n_points; 00413 ALLOC( *points_ptr, n_points ); 00414 } 00415 00416 for_less( p, 0, n_points ) 00417 (*points_ptr)[p] = points[p]; 00418 00419 if( type == SINGLE_COLOUR_SCALE ) 00420 { 00421 r = get_Colour_r_0_1( colour_coding->over_colour ); 00422 g = get_Colour_g_0_1( colour_coding->over_colour ); 00423 b = get_Colour_b_0_1( colour_coding->over_colour ); 00424 a = get_Colour_a_0_1( colour_coding->over_colour ); 00425 00426 for_less( p, 0, n_points ) 00427 { 00428 (*points_ptr)[p].r *= r; 00429 (*points_ptr)[p].g *= g; 00430 (*points_ptr)[p].b *= b; 00431 (*points_ptr)[p].a *= a; 00432 } 00433 } 00434 } 00435 00436 /* ----------------------------- MNI Header ----------------------------------- 00437 @NAME : define_colour_coding_user_defined 00438 @INPUT : colour_code 00439 n_colours 00440 colours 00441 positions 00442 interpolation_space 00443 @OUTPUT : 00444 @RETURNS : 00445 @DESCRIPTION: Sets the piecewise function of the user defined colour coding. 00446 The positions must be monotonically between 0 and 1. 00447 @METHOD : 00448 @GLOBALS : 00449 @CALLS : 00450 @CREATED : Nov. 25, 1996 David MacDonald 00451 @MODIFIED : Apr. 16, 1997 D. MacDonald - now rescales to [0..1] 00452 ---------------------------------------------------------------------------- */ 00453 00454 public BOOLEAN define_colour_coding_user_defined( 00455 colour_coding_struct *colour_code, 00456 int n_colours, 00457 Colour colours[], 00458 Real positions[], 00459 Colour_spaces interpolation_space ) 00460 { 00461 Real pos; 00462 int p; 00463 00464 if( n_colours < 2 ) 00465 { 00466 print( "User defined colour coding must have at least 2 colours.\n" ); 00467 return( FALSE ); 00468 } 00469 00470 for_less( p, 0, n_colours ) 00471 { 00472 if( p > 0 && positions[p-1] > positions[p] ) 00473 { 00474 print( "User defined colour coding must have\n" ); 00475 print( "monotonic positions.\n" ); 00476 return( FALSE ); 00477 } 00478 } 00479 00480 if( positions[0] == positions[n_colours-1] ) 00481 { 00482 print( 00483 "User defined colour coding must have non-empty position range.\n" ); 00484 return( FALSE ); 00485 } 00486 00487 if( colour_code->user_defined_n_colour_points > 0 ) 00488 FREE( colour_code->user_defined_colour_points ); 00489 00490 colour_code->user_defined_n_colour_points = n_colours; 00491 ALLOC( colour_code->user_defined_colour_points, n_colours ); 00492 00493 for_less( p, 0, n_colours ) 00494 { 00495 if( p == 0 ) 00496 pos = 0.0; 00497 else if( p == n_colours - 1 ) 00498 pos = 1.0; 00499 else 00500 pos = (positions[p] - positions[0]) / 00501 (positions[n_colours-1] - positions[0]); 00502 00503 colour_code->user_defined_colour_points[p].position = pos; 00504 colour_code->user_defined_colour_points[p].r = 00505 get_Colour_r_0_1(colours[p]); 00506 colour_code->user_defined_colour_points[p].g = 00507 get_Colour_g_0_1(colours[p]); 00508 colour_code->user_defined_colour_points[p].b = 00509 get_Colour_b_0_1(colours[p]); 00510 colour_code->user_defined_colour_points[p].a = 00511 get_Colour_a_0_1(colours[p]); 00512 colour_code->user_defined_colour_points[p].interpolation_space = 00513 interpolation_space; 00514 } 00515 00516 if( get_colour_coding_type( colour_code ) == USER_DEFINED_COLOUR_MAP ) 00517 { 00518 recreate_piecewise_function( colour_code, 00519 get_colour_coding_type(colour_code), 00520 FALSE ); 00521 } 00522 00523 return( TRUE ); 00524 } 00525 00526 /* ----------------------------- MNI Header ----------------------------------- 00527 @NAME : get_colour_code 00528 @INPUT : colour_coding 00529 value 00530 @OUTPUT : 00531 @RETURNS : Colour 00532 @DESCRIPTION: Returns the colour associated with the value. 00533 @METHOD : 00534 @GLOBALS : 00535 @CALLS : 00536 @CREATED : 1993 David MacDonald 00537 @MODIFIED : 00538 ---------------------------------------------------------------------------- */ 00539 00540 public Colour get_colour_code( 00541 colour_coding_struct *colour_coding, 00542 Real value ) 00543 { 00544 Real pos, r, g, b, a; 00545 int i, n_points; 00546 colour_point *points; 00547 00548 if( colour_coding->min_value <= colour_coding->max_value ) 00549 { 00550 if( value < colour_coding->min_value ) 00551 return( colour_coding->under_colour ); 00552 else if( value >= colour_coding->max_value ) 00553 return( colour_coding->over_colour ); 00554 } 00555 else 00556 { 00557 if( value > colour_coding->min_value ) 00558 return( colour_coding->under_colour ); 00559 else if( value <= colour_coding->max_value ) 00560 return( colour_coding->over_colour ); 00561 } 00562 00563 pos = (value - colour_coding->min_value) / 00564 (colour_coding->max_value - colour_coding->min_value); 00565 00566 n_points = colour_coding->n_colour_points; 00567 00568 if( n_points < 2 ) 00569 { 00570 print_error( "get_colour_code(): invalid piecewise function.\n" ); 00571 return( make_rgba_Colour( 0, 0, 0, 0 ) ); 00572 } 00573 00574 points = colour_coding->colour_points; 00575 00576 for_less( i, 0, n_points-1 ) 00577 { 00578 if( pos <= points[i+1].position ) 00579 break; 00580 } 00581 00582 interpolate_colours( &points[i], &points[i+1], pos, &r, &g, &b, &a ); 00583 00584 return( make_rgba_Colour_0_1( r, g, b, a ) ); 00585 } 00586 00587 /* ----------------------------- MNI Header ----------------------------------- 00588 @NAME : interpolate_colours 00589 @INPUT : p1 - rgb or hls colours 00590 p2 00591 pos - position relative to position of colours 00592 @OUTPUT : 00593 @RETURNS : interpolated colour 00594 @DESCRIPTION: Interpolates a colour based on two positions on a piecewise 00595 linear function. 00596 @METHOD : 00597 @GLOBALS : 00598 @CALLS : 00599 @CREATED : 1993 David MacDonald 00600 @MODIFIED : 00601 ---------------------------------------------------------------------------- */ 00602 00603 private void interpolate_colours( 00604 colour_point *p1, 00605 colour_point *p2, 00606 Real pos, 00607 Real *r, 00608 Real *g, 00609 Real *b, 00610 Real *a ) 00611 { 00612 Real ratio, r0, g0, b0, a0, r1, g1, b1, a1; 00613 00614 ratio = (pos - p1->position) / (p2->position - p1->position); 00615 00616 r0 = p1->r; 00617 g0 = p1->g; 00618 b0 = p1->b; 00619 a0 = p1->a; 00620 00621 r1 = p2->r; 00622 g1 = p2->g; 00623 b1 = p2->b; 00624 a1 = p2->a; 00625 00626 if( p1->interpolation_space == HSL_SPACE ) 00627 { 00628 rgb_to_hsl( r0, g0, b0, &r0, &g0, &b0 ); 00629 rgb_to_hsl( r1, g1, b1, &r1, &g1, &b1 ); 00630 00631 if( r0 == 1.0 && r1 < 0.5 ) 00632 r0 = 0.0; 00633 if( r1 == 1.0 && r0 < 0.5 ) 00634 r1 = 0.0; 00635 } 00636 00637 *r = r0 + (r1 - r0) * ratio; 00638 *g = g0 + (g1 - g0) * ratio; 00639 *b = b0 + (b1 - b0) * ratio; 00640 *a = a0 + (a1 - a0) * ratio; 00641 00642 if( p1->interpolation_space == HSL_SPACE ) 00643 hsl_to_rgb( *r, *g, *b, r, g, b ); 00644 }

Generated on Wed Jul 28 09:10:56 2004 for BICPL by doxygen 1.3.7