Index: /trunk/Ohana/src/kapa/doc/notes.txt
===================================================================
--- /trunk/Ohana/src/kapa/doc/notes.txt	(revision 6240)
+++ /trunk/Ohana/src/kapa/doc/notes.txt	(revision 6240)
@@ -0,0 +1,36 @@
+
+2005.11.27
+
+	I am improving the functionality of kapa so that it does not
+	need to have an X server to build PNG / PPM / PS plots.
+	Before, I generated the PNG / PPM plots from the screen image
+	by using an X function to examine the color of each pixel and
+	generate the corresponding PNG/PPM image.  This implied that
+	an X server was required even if the window was not being
+	looked at.  The PS version of the plots were not quite so
+	difficult: the PS code is generated from the plot when the PS
+	output file is constructed.  I decided to implement the
+	equivalent concept for the PNG/PPM images. 
+
+	I have build a set of drawing functions which are used by the
+	PNG function (PPM not yet implemented) to create the PNG image
+	buffer from the graphic objects stored by Kapa.  This
+	subsystem is called bDraw.  Most of the drawing functions
+	correspond to just the primitive point, line, and circle
+	functions.  I have implemented bDrawPoint, bDrawLine,
+	bDrawCircle, and demonstrated the complete concept.  At this
+	point, only a few features are missing:
+
+	- line weight.  the bDraw functions do not respect the value
+          of the line weight (which is available to them).  All lines
+          and circles are drawn as line weight 1.
+
+	- line type.  no line type data is used. (Kapa probably over
+          respects it: it should not apply the line type to the point
+          plotting)
+
+	- rectangles and triangles.  several of the point-types are
+          constructed by calling bDrawRect, bDrawTri, neither of which
+          are implemented at this time.
+
+
Index: /trunk/Ohana/src/kapa/graph/LoadPtext.c
===================================================================
--- /trunk/Ohana/src/kapa/graph/LoadPtext.c	(revision 6239)
+++ /trunk/Ohana/src/kapa/graph/LoadPtext.c	(revision 6240)
@@ -3,7 +3,7 @@
 int LoadPtext () {
   
-  char buffer[256], *c;
+  char *string;
   int N, status, size;
-  double tmp, L;
+  double tX, tY, tT, L;
   Layout *layout;
   
@@ -17,29 +17,23 @@
   REALLOCATE (layout[0].ptext, Label, layout[0].Nptext);
 
-  status = read (sock, buffer, 16); 
-  buffer[16] = 0; 
-  sscanf (buffer, "%lf", &tmp); 
+  KiiScanMessage (sock, "%lf %lf %lf", &tX, &tY, &tT);
+
   L = layout[0].axis[0].dfx;
-  layout[0].ptext[N].x = L * (tmp - layout[0].axis[0].min) / (layout[0].axis[0].max - layout[0].axis[0].min) + layout[0].axis[0].fx;
+  layout[0].ptext[N].x = L * (tX - layout[0].axis[0].min) / (layout[0].axis[0].max - layout[0].axis[0].min) + layout[0].axis[0].fx;
 
-  status = read (sock, buffer, 16); 
-  buffer[16] = 0; 
-  sscanf (buffer, "%lf", &tmp); 
   L = layout[0].axis[1].dfy;
-  layout[0].ptext[N].y = L * (tmp - layout[0].axis[1].min) / (layout[0].axis[1].max - layout[0].axis[1].min) + layout[0].axis[1].fy;
+  layout[0].ptext[N].y = L * (tY - layout[0].axis[1].min) / (layout[0].axis[1].max - layout[0].axis[1].min) + layout[0].axis[1].fy;
 
-  status = read (sock, buffer, 16); 
-  buffer[16] = 0; 
-  sscanf (buffer, "%lf", &layout[0].ptext[N].angle); 
+  layout[0].ptext[N].angle = tT;
 
-  status = read (sock, buffer, 128); 
-  buffer[status] = 0; 
-  strcpy (layout[0].ptext[N].text, buffer);
+  string = KiiRecvData (sock);
+  strcpy (layout[0].ptext[N].text, string);
+  free (string);
 
   fcntl (sock, F_SETFL, O_NONBLOCK);  
   
-  c = GetRotFont (&size);
+  string = GetRotFont (&size);
   layout[0].ptext[N].size = size;
-  strcpy (layout[0].ptext[N].font, c);
+  strcpy (layout[0].ptext[N].font, string);
 
   DrawPtext (layout);
Index: /trunk/Ohana/src/kapa/graph/bDrawLabels.c
===================================================================
--- /trunk/Ohana/src/kapa/graph/bDrawLabels.c	(revision 6239)
+++ /trunk/Ohana/src/kapa/graph/bDrawLabels.c	(revision 6240)
@@ -23,5 +23,5 @@
       }	
       x = layout[0].label[i].x;
-      y = graphic.dy - layout[0].label[i].y;
+      y = layout[0].label[i].y;
       SetRotFont (layout[0].label[i].font, layout[0].label[i].size); 
       bDrawRotText (x, y, layout[0].label[i].text, pos, angle);
@@ -42,5 +42,5 @@
       angle = layout[0].ptext[i].angle;
       x = layout[0].ptext[i].x;
-      y = graphic.dy - layout[0].ptext[i].y;
+      y = layout[0].ptext[i].y;
       SetRotFont (layout[0].ptext[i].font, layout[0].ptext[i].size);
       bDrawRotText (x, y, layout[0].ptext[i].text, 5, angle);
