Index: trunk/Ohana/src/libkapa/include/kapa.h
===================================================================
--- trunk/Ohana/src/libkapa/include/kapa.h	(revision 5848)
+++ trunk/Ohana/src/libkapa/include/kapa.h	(revision 5852)
@@ -1,4 +1,7 @@
 # ifndef KAPA_H
 # define KAPA_H
+
+# include <X11/Xlib.h>
+# include <png.h>
 
 typedef struct {
@@ -34,18 +37,55 @@
 } KiiOverlayType;
 
+typedef struct {
+  char *name;
+  float x;
+  float y;
+  float dx;
+  float dy;
+} KapaSection;
+
+typedef struct {
+  double xmin, xmax, ymin, ymax;
+  int style, ptype, ltype, etype, ebar, color;
+  double lweight, size;
+  Coords coords;
+  int flipeast, flipnorth;
+  char axis[8], labels[8], ticks[8];
+} Graphdata;
+
+typedef struct {
+  int dx, dy, ascent;
+  unsigned char *bits;
+} RotFont;
+
+typedef struct {
+  RotFont *font;
+  char name[64];
+  int size;
+} FontSet;
+
+typedef png_byte bDrawColor;
+
+typedef struct {
+  int Nx, Ny;
+  bDrawColor **pixels;
+} bDrawBuffer;
+
 /* IOfuncs.c */
 int KiiSendMessage (int device, char *format, ...);
 int KiiSendCommand (int device, int length, char *format, ...);
 int KiiSendCommandV (int device, int length, char *format, va_list argp);
+int KiiScanMessage (int device, char *format, ...);
+int KiiSendData (int device, char *data, int Nbytes);
+char *KiiRecvData (int device);
 
 /* KiiOpen.c */
 int KiiOpen (char *kii_exec, char *name);
 int KiiClose (int socket);
+int KiiWait (char *sockpath);
 
 /* KiiPicture.c */
 int KiiNewPicture1D (int fd, KiiImage *image, KiiDisplayMode *mode, Coords *coords);
 int KiiNewPicture2D (int fd, KiiImage *image, KiiDisplayMode *mode, Coords *coords);
-int KiiResize (int fd, int Nx, int Ny);
-int KiiCenter (int fd, double x, double y, int zoom);
 
 /* KiiOverlay.c */
@@ -58,6 +98,8 @@
 
 /* KiiConvert.c */
-int KiiJpeg (int fd, char *filename);
 int KiiPS (int fd, int scale, int raw, char *filename);
+int KiiJPEG (int fd, char *filename);
+int KapaPNG (int fd, char *filename);
+int KapaPPM (int fd, char *filename);
 
 /* KiiCursor.c */
@@ -66,3 +108,68 @@
 int KiiCursorRead (int fd, double *x, double *y, char *key);
 
+/* KapaWindow.c */
+int KiiResize (int fd, int Nx, int Ny);
+int KiiCenter (int fd, double x, double y, int zoom);
+int KapaBox (int fd, Graphdata *graphdata);
+int KapaClear (int fd, int ClearSection);
+int KapaSetFont (int fd, char *name, int size);
+int KapaSendLabel (int fd, char *string, int mode);
+int KapaSendTextline (int fd, char *string, float x, float y, float angle);
+int KapaSetLimits (int fd, Graphdata *graphmode);
+int KapaSetSection (int fd, KapaSection *section);
+int KapaSelectSection (int fd, char *name);
+int KapaGetSection (int fd, char *name);
+
+/* KapaColors */
+int KapaColorByName (char *name);
+int KapaColormapSize ();
+char *KapaColorRGBString (int N);
+png_color *KapaPNGPalette (int *Npalette);
+unsigned long *KapaX11colors (Display *display, Colormap colormap, unsigned long default_color, int *Ncolors);
+
+/* RotFont.c */
+void InitRotFonts PROTO(());
+int SetRotFont PROTO((char *name, int size));
+char *GetRotFont PROTO((int *size));
+RotFont *GetRotFontData (double *scale);
+int RotStrlen PROTO((char *c));
+
+/* DrawRotString.c */
+int DrawRotText PROTO((int x, int y, char *string, int pos, double angle));
+int DrawRotBitmap PROTO((int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale));
+int DrawRotTextInit (Display *display, Window window, GC gc, unsigned long fore, unsigned long back);
+
+
+/* PSRotFont.c */
+void PSRotText PROTO((FILE *f, int x, int y, char *string, int pos, double angle));
+void PSDumpRotSegment PROTO((FILE *f, char *segment, int *Nseg));
+void PSSetFont PROTO((FILE *f, char *name, int size));
+
+/* bDrawFuncs.c */
+bDrawBuffer *bDrawBufferCreate (int Nx, int Ny);
+void bDrawBufferFree (bDrawBuffer *buffer);
+void bDrawSetBuffer (bDrawBuffer *buffer);
+void bDrawSetStyle (bDrawColor color, int lw, int lt);
+void bDrawPoint (int x, int y);
+void bDrawPointf (float x, float y);
+
+void bDrawArc (double Xc, double Yc, double Xr, double Yr, double Ts, double Te);
+void bDrawCircle (double Xc, double Yc, double radius);
+void bDrawCircleFill (double xc, double yc, double radius);
+
+void bDrawLine (double x1, double y1, double x2, double y2);
+void bDrawLineWeight (int X1, int Y1, int X2, int Y2, int swapcoords);
+void bDrawLineBresen (int X1, int Y1, int X2, int Y2, int swapcoords);
+void bDrawLineHorizontal (int X1, int X2, int Y);
+void bDrawLineVertical (int X, int Y1, int Y2);
+
+void bDrawRectOpen (double x1, double y1, double x2, double y2);
+void bDrawRectFill (double x1, double y1, double x2, double y2);
+void bDrawTriOpen (double x1, double y1, double x2, double y2, double x3, double y3);
+void bDrawTriFill (double x1, double y1, double x2, double y2, double x3, double y3);
+
+/* bDrawRotFont.c */
+int bDrawRotText (int x, int y, char *string, int pos, double angle);
+int bDrawRotBitmap (int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale);
+
 # endif
