aboutsummaryrefslogtreecommitdiff
path: root/plotlib/colorstuff/rgbtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'plotlib/colorstuff/rgbtest.c')
-rw-r--r--plotlib/colorstuff/rgbtest.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/plotlib/colorstuff/rgbtest.c b/plotlib/colorstuff/rgbtest.c
new file mode 100644
index 0000000..f30a0a0
--- /dev/null
+++ b/plotlib/colorstuff/rgbtest.c
@@ -0,0 +1,56 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "rgbtbl.h"
+
+main(argc,argv)
+char **argv;
+int argc;
+{
+
+int IC,ic,ncols;
+int i,n,ired,igrn,iblu;
+char teststr[50], c;
+
+IC = sizeof(Colordef);
+ic = sizeof(colordef);
+ncols = ic/IC;
+
+printf("Colordef %d\n",IC);
+printf("colordef %d\n",ic);
+printf("#entries %d\n",ncols);
+
+printf("\nEnter color string: ");
+
+/*if ((c=fgetc(stdin)) != '\n')
+ungetc(c,stdin); */
+
+fgets(teststr,50,stdin);
+printf("strlen = %d\n",strlen(teststr));
+
+if ((n=strlen(teststr)) != 0) {
+ while(n > 0 && teststr[--n] == '\n')
+ teststr[n] = '\0'; }
+
+/*fscanf(stdin,"%s",teststr);*/
+printf("\nTest string = %s\n",teststr);
+
+for (i=0; i < ncols; i++) {
+ if(!strcasecmp(colordef[i].name,teststr)) {
+
+ printf("test string %s found at %d\n",teststr,i);
+ printf("found string %s code %d\n",colordef[i].name,colordef[i].rgb);
+
+ ired = 0x000000ff & (colordef[i].rgb >> 16);
+ igrn = 0x000000ff & (colordef[i].rgb >> 8);
+ iblu = 0x000000ff & (colordef[i].rgb);
+
+ printf("red = %d\ngrn = %d\nblu = %d\n",ired,igrn,iblu);
+ }
+}
+
+}
+
+