#121 Linear gradient in rgb space, plscmap1l

open
nobody
None
5
2011-12-12
2011-12-12
Pascal
No

Could be a feature request depending how you see the problem.

The documention states that the gradient is linear. However this is only valid in hls. When using rgb coding it is no longer the case.
http://plplot.sourceforge.net/docbook-manual/plplot-html-5.9.9/plscmap1l.html
"Set color map1 colors using a piece-wise linear relationship between position in the color map (from 0 to 1) and position in HLS or RGB color space"

This is due to the conversion from rgb space to hls when the input is rgb:

n plctrl.c,
void
plcmap1_calc( void )
//! Bin up cmap 1 space and assign colors to make inverse mapping easy.
//! Always do interpolation in HLS space.

This works:
call plscmap1l(.false., &
& (/0.0_plflt, 0.499_plflt, 0.501_plflt, 1.0_plflt /),&
& (/0.0_plflt, 0.0_plflt, 120.0_plflt, 120.0_plflt /),&
& (/0.2_plflt, 1.0_plflt, 1.0_plflt, 0.2_plflt /),&
& (/1.0_plflt, 1.0_plflt, 1.0_plflt, 1.0_plflt /) )

But not this:
call plscmap1l(.true., &
& (/0.0_plflt, 0.5_plflt, 1.0_plflt /),&
& (/1.0_plflt, 1.0_plflt, 0.0_plflt /),&
& (/0.0_plflt, 1.0_plflt, 1.0_plflt /),&
& (/0.0_plflt, 1.0_plflt, 0.0_plflt /) )

Either the documention should mention this but it stills buggy for me as this function accepts rgb input.
Or remove the hls transformation and do the gradient with rgb values when the input is in rgb.

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks