From: <and...@us...> - 2009-07-09 14:47:20
|
Revision: 10126 http://plplot.svn.sourceforge.net/plplot/?rev=10126&view=rev Author: andrewross Date: 2009-07-09 14:47:16 +0000 (Thu, 09 Jul 2009) Log Message: ----------- Fix up warning messages for cmap0 palette reading code. Alter so that alpha (if present) is a floating point number, consistent with plscol0. Add an example of a cmap0 palette to the data directory - this is default palette with black and white swapped to give a white background. Modified Paths: -------------- trunk/data/CMakeLists.txt trunk/src/plctrl.c Added Paths: ----------- trunk/data/cmap0_white_bg.pal Modified: trunk/data/CMakeLists.txt =================================================================== --- trunk/data/CMakeLists.txt 2009-07-09 09:14:55 UTC (rev 10125) +++ trunk/data/CMakeLists.txt 2009-07-09 14:47:16 UTC (rev 10126) @@ -26,6 +26,7 @@ plxtnd5.fnt usa.map usaglobe.map +cmap0_white_bg.pal cmap1_blue_yellow.pal ) Added: trunk/data/cmap0_white_bg.pal =================================================================== --- trunk/data/cmap0_white_bg.pal (rev 0) +++ trunk/data/cmap0_white_bg.pal 2009-07-09 14:47:16 UTC (rev 10126) @@ -0,0 +1,17 @@ +16 +#ffffff 1.0 +#ff0000 1.0 +#ffff00 1.0 +#00ff00 1.0 +#7fffd4 1.0 +#ffc0cb 1.0 +#f5deb3 1.0 +#bebebe 1.0 +#a52a2a 1.0 +#0000ff 1.0 +#8a2be2 1.0 +#00ffff 1.0 +#40e0d0 1.0 +#ff00ff 1.0 +#fa8072 1.0 +#000000 1.0 Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-07-09 09:14:55 UTC (rev 10125) +++ trunk/src/plctrl.c 2009-07-09 14:47:16 UTC (rev 10126) @@ -1219,7 +1219,8 @@ void c_plspal0(const char *filename) { - int i, r, g, b, a; + int i, r, g, b, nread; + double a; int number_colors; char color_info[30]; FILE *fp; @@ -1227,12 +1228,12 @@ fp = plLibOpen(filename); if (fp == NULL) { - snprintf(msgbuf,1024,"Unable to open cmap1 file %s\n",filename); + snprintf(msgbuf,1024,"Unable to open cmap0 file %s\n",filename); plwarn(msgbuf); return; } if (fscanf(fp, "%d\n", &number_colors) != 1) { - snprintf(msgbuf,1024,"Unrecognized cmap1 header\n"); + snprintf(msgbuf,1024,"Unrecognized cmap0 header\n"); plwarn(msgbuf); fclose(fp); return; @@ -1248,13 +1249,13 @@ } c_plscol0(i, r, g, b); } - else if(strlen(color_info) == 9){ - if (sscanf(color_info, "#%2x%2x%2x%2x", &r, &g, &b, &a) != 4) { + else if(strlen(color_info) > 9){ + if (sscanf(color_info, "#%2x%2x%2x %lf", &r, &g, &b, &a) != 4) { snprintf(msgbuf,1024,"Unrecognized cmap0 format %s\n", color_info); plwarn(msgbuf); break; } - c_plscol0a(i, r, g, b, a); + c_plscol0a(i, r, g, b, (PLFLT) a); } else{ snprintf(msgbuf,1024,"Unrecognized cmap0 format %s\n", color_info); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |