From: <hez...@us...> - 2011-04-17 22:00:19
|
Revision: 11708 http://plplot.svn.sourceforge.net/plplot/?rev=11708&view=rev Author: hezekiahcarty Date: 2011-04-17 22:00:13 +0000 (Sun, 17 Apr 2011) Log Message: ----------- Add plscmap1_range and plgcmap1_range These functions set/get the recently added color map 1 range stream attributes. Modified Paths: -------------- trunk/include/plplot.h trunk/src/plctrl.c Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2011-04-17 21:59:08 UTC (rev 11707) +++ trunk/include/plplot.h 2011-04-17 22:00:13 UTC (rev 11708) @@ -732,6 +732,8 @@ #define plscmap1l c_plscmap1l #define plscmap1la c_plscmap1la #define plscmap1n c_plscmap1n +#define plscmap1_range c_plscmap1_range +#define plgcmap1_range c_plgcmap1_range #define plscol0 c_plscol0 #define plscol0a c_plscol0a #define plscolbg c_plscolbg @@ -1531,6 +1533,16 @@ PLDLLIMPEXP void c_plscmap1n( PLINT ncol1 ); +// Set the color map 1 range used in continuous plots + +PLDLLIMPEXP void +c_plscmap1_range( PLFLT min_color, PLFLT max_color ); + +// Get the color map 1 range used in continuous plots + +PLDLLIMPEXP void +c_plgcmap1_range( PLFLT *min_color, PLFLT *max_color ); + // Set a given color from color map 0 by 8 bit RGB value PLDLLIMPEXP void Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2011-04-17 21:59:08 UTC (rev 11707) +++ trunk/src/plctrl.c 2011-04-17 22:00:13 UTC (rev 11708) @@ -782,6 +782,56 @@ } //-------------------------------------------------------------------------- +//! Set the color map 1 value range to use in continuous color plots. +//! +//! @param min_color Specifies the minimum color to use. A value of 0.0 or +//! less indicates that the range should start at the lowest color map 1 +//! value available. +//! @param max_color Specifies the maximum color to use. A value of 1.0 or +//! greater indicates that the range should exten to the highest color map 1 +//! value available. +//! +//! If min_color > max_color or min_color is greater than 1.0 or max_color is +//! less than 0.0 then no change is made. +//-------------------------------------------------------------------------- + +void +c_plscmap1_range( PLFLT min_color, PLFLT max_color ) +{ + if ( min_color > max_color || max_color < 0.0 || min_color > 1.0 ) + { + plwarn( "plscmap1_range called with invalid color range" ); + return; + } + if ( min_color < 0.0 ) + { + plwarn( "plscmap1_range called with a negative minimum color value" ); + min_color = 0.0; + } + if ( max_color > 1.0 ) + { + plwarn( "plscmap1_range called with an out of range maximum color value" ); + max_color = 1.0; + } + plsc->cmap1_min = min_color; + plsc->cmap1_max = max_color; +} + +//-------------------------------------------------------------------------- +//! Get the color map 1 value range used in continuous color plots. +//! +//! @param min_color Specifies the minimum color used. +//! @param max_color Specifies the maximum color used. +//-------------------------------------------------------------------------- + +void +c_plgcmap1_range( PLFLT *min_color, PLFLT *max_color ) +{ + *min_color = plsc->cmap1_min; + *max_color = plsc->cmap1_max; +} + +//-------------------------------------------------------------------------- // plscmap0n() // // Set number of colors in cmap 0, (re-)allocate cmap 0, and fill with This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |