]> granicus.if.org Git - graphviz/commitdiff
ifdef out unused code; clean up interfaces; make external names more uniform
authorerg <devnull@localhost>
Fri, 16 Jul 2010 18:15:35 +0000 (18:15 +0000)
committererg <devnull@localhost>
Fri, 16 Jul 2010 18:15:35 +0000 (18:15 +0000)
18 files changed:
lib/glcomp/glcompbutton.c
lib/glcomp/glcompdefs.h
lib/glcomp/glcompfont.c
lib/glcomp/glcompfont.h
lib/glcomp/glcompimage.c
lib/glcomp/glcompimage.h
lib/glcomp/glcomplabel.c
lib/glcomp/glcomppanel.c
lib/glcomp/glcompset.c
lib/glcomp/glcompset.h
lib/glcomp/glcomptextpng.c
lib/glcomp/glcomptextpng.h
lib/glcomp/glcomptexture.c
lib/glcomp/glcomptexture.h
lib/glcomp/glpangofont.c
lib/glcomp/glpangofont.h
lib/glcomp/glutils.c
lib/glcomp/glutils.h

index 8b39db1fc11ad8a79cbe9ec14156406333cf9a27..9184e8de31a282891b69cf78643d3bd9ba684b44 100644 (file)
@@ -51,7 +51,7 @@ glCompButton *glCompButtonNew(glCompObj * par, GLfloat x, GLfloat y,
     p->customptr = '\0';
     /*set event functions */
 
-    p->common.functions.draw = glCompButtonDraw;
+    p->common.functions.draw = (glcompdrawfunc_t)glCompButtonDraw;
 
     p->common.functions.click = glCompButtonClick;
     p->common.functions.doubleclick = glCompButtonDoubleClick;
@@ -62,7 +62,7 @@ glCompButton *glCompButtonNew(glCompObj * par, GLfloat x, GLfloat y,
     p->common.functions.mouseup = glCompButtonMouseUp;
 
     /*caption */
-    p->common.font = new_font_from_parent((glCompObj *) p, NULL);
+    p->common.font = glNewFontFromParent ((glCompObj *) p, NULL);
     p->label = glCompLabelNew((glCompObj *) p, 0, 0, caption);
     p->label->common.font->justify.VJustify = glFontVJustifyCenter;
     p->label->common.font->justify.HJustify = glFontHJustifyCenter;
index ce171b4d45011d1dd4e80668a36d7591af1ab7cb..7f544c8d0e62af4d362a91a959e24a18c162bcc1 100644 (file)
@@ -273,14 +273,11 @@ extern "C" {
        glObjType objType;      /*always keep this here for each drawable object */
        glCompCommon common;
        glCompTex *texture;
-       char *pngFile;
+       GLfloat width, height;  /* width and height in world coords */
+       /* char *pngFile; */
        int stretch;
     } glCompImage;
 
-
-
-
-
 /*generic panel*/
     typedef struct _glCompPanel {
        glObjType objType;      /*always keep this here for each drawable object */
index ca9905e9c7f10616f8add5e3dda04ce0b0097cfc..7387c8832d0f4118cf93718006be9a5019ba56a1 100644 (file)
@@ -22,7 +22,7 @@
 #include "memory.h"
 #include <GL/glut.h>
 
-void print_bitmap_string(void *font, char *s)
+static void print_bitmap_string(void *font, char *s)
 {
     if (s && strlen(s)) {
        while (*s) {
@@ -33,6 +33,7 @@ void print_bitmap_string(void *font, char *s)
     }
 }
 
+#if 0
 void init_gl_vars(glCompFont * f)
 {
 
@@ -84,6 +85,7 @@ void restore_gl_vars(glCompFont * f)
        glDisable(GL_TEXTURE_2D);
     glMatrixMode(f->glcache.matrix);*/
 }
+#endif
 void glprintfglut(void *font, GLfloat xpos, GLfloat ypos, GLfloat zpos,
                  char *bf)
 {
@@ -93,8 +95,7 @@ void glprintfglut(void *font, GLfloat xpos, GLfloat ypos, GLfloat zpos,
 
 }
 
-
-
+#if 0
 static void
 glPrintf(glCompFont * font, GLfloat xpos, GLfloat ypos, GLfloat zpos,
         GLfloat width, char *bf, int usez)
@@ -129,8 +130,6 @@ glprintfz(glCompFont * font, GLfloat xpos, GLfloat ypos, GLfloat zpos,
     glPrintf(font, xpos, ypos, zpos, width, bf, 0);
 }
 
-
-
 static int fontId(fontset_t * fontset, char *fontdesc)
 {
     int ind = 0;
@@ -152,7 +151,7 @@ static int glutfontId(fontset_t * fontset, void *glutfont)
 }
 
 
-glCompFont *glut_font_init(void)
+static glCompFont *glut_font_init(void)
 {
     glCompFont *font = NEW(glCompFont);
     font->color.R = 1.00;
@@ -185,7 +184,8 @@ glCompFont *glut_font_init(void)
     return font;
 }
 
-void delete_font(glCompFont * f)
+#endif
+void glDeleteFont(glCompFont * f)
 {
     if (f->fontdesc)
        free(f->fontdesc);
@@ -195,7 +195,7 @@ void delete_font(glCompFont * f)
 
 }
 
-glCompFont *new_font(glCompSet * s, char *text, glCompColor * c,glCompFontType type, char *fontdesc, int fs,int is2D)
+glCompFont *glNewFont (glCompSet * s, char *text, glCompColor * c,glCompFontType type, char *fontdesc, int fs,int is2D)
 {
     glCompFont *font = (glCompFont*) malloc(sizeof(glCompFont));
     font->reference = 0;
@@ -227,7 +227,7 @@ glCompFont *new_font(glCompSet * s, char *text, glCompColor * c,glCompFontType t
 
 
 
-glCompFont *new_font_from_parent(glCompObj * o, char *text)
+glCompFont *glNewFontFromParent(glCompObj * o, char *text)
 {
     glCompCommon *parent;
     glCompFont *font = NEW(glCompFont);
@@ -264,13 +264,13 @@ glCompFont *new_font_from_parent(glCompObj * o, char *text)
        c.B = GLCOMPSET_FONT_COLOR_B;
        c.A = GLCOMPSET_FONT_COLOR_ALPHA;
        font =
-           new_font(o->common.compset, text, &c, pangotext,
+           glNewFont (o->common.compset, text, &c, pangotext,
                     GLCOMPSET_FONT_DESC, GLCOMPSET_FONT_SIZE,1);
     }
     return font;
 }
 
-
+#if 0
 
 #ifndef _WIN32
 #define TMPTEMP "/tmp/_sfXXXX"
@@ -324,7 +324,7 @@ glCompFont *add_font(fontset_t * fontset, char *fontdesc, int fs)
            fontpath = ALLOC(fontpathsz, fontpath, char);
        }
 /*     sprintf(fontpath, "%s/%s.png", fontset->font_directory, fontdesc);
-       if (create_font_file(fontdesc,fs, fontpath, (float) 32, (float) 32) ==
+       if (glCompCreateFontFile(fontdesc,fs, fontpath, (float) 32, (float) 32) ==
            0) {
            fontset->fonts =
                ALLOC(fontset->count + 1, fontset->fonts, glCompFont *);
@@ -377,7 +377,7 @@ void fontColor(glCompFont * font, float r, float g, float b, float a)
     font->color.B = b;
     font->color.A = a;
 }
-
+#endif
 
 /*texture base 3d text rendering*/
 void glCompDrawText3D(glCompFont * f,GLfloat x,GLfloat y,GLfloat z,GLfloat w,GLfloat h)
@@ -398,12 +398,13 @@ void glCompDrawText3D(glCompFont * f,GLfloat x,GLfloat y,GLfloat z,GLfloat w,GLf
     glEnable(GL_BLEND);
 
 }
+#if 0
 /*bitmap base 2D text rendering */
 static void change_fontC(unsigned char* d,int w,int h,glCompColor* c)
 {
     int size=w*h*4;
     int ind=0;
-    for (ind;ind <=size; ind=ind+4)
+    for (;ind <=size; ind=ind+4)
     {
        if(d[ind+3] != 0)
        {
@@ -414,7 +415,7 @@ static void change_fontC(unsigned char* d,int w,int h,glCompColor* c)
        }
     }
 }
-
+#endif
 
 void glCompDrawText(glCompFont * f,GLfloat x,GLfloat y)
 {
@@ -467,3 +468,63 @@ void glCompRenderText(glCompFont * f, glCompObj * parentObj)
                glCompDrawText(f,x,y);
 
 }
+
+#if 0
+#define imageWidth 256
+#define imageHeight 256 
+static GLubyte imageData[imageWidth][imageHeight][4];
+#endif
+
+#if 0
+int glCompLoadFontPNG(char *name, int id)
+{
+    GLubyte *imageData = NULL;
+    int imageWidth, imageHeight, idx2, c;
+
+//      imageData = fontGetData (s, size, imageBits);
+    imageData = glCompLoadPng (name, &imageWidth, &imageHeight);
+
+    c = 0;
+    idx2 = 0;
+/*     for (idx=0;idx < imageWidth*imageHeight+30000;idx=idx+1)
+               {
+                       if (c!=imageData[idx])
+                       {
+                               c=imageData[idx];
+                               printf ("%i) %i \n ",idx2,imageData[idx]);
+                       }
+
+                       idx2++;
+                       c=((((idx&0x8)==0)^((idx2&0x8))==0))*255;
+                               imageData[idx][idx2][0] = c;
+                               imageData[idx][idx2][1] = c;
+                               imageData[idx][idx2][2] = c;
+                               imageData[idx][idx2][3] = 255;
+
+               }*/
+
+
+    /* no image data */
+    if (imageData == NULL)
+       return -1;
+
+    glBindTexture(GL_TEXTURE_2D, id);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+    /* glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); */
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    /* glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); */
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+//      glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE , GL_DECAL);
+
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, imageWidth, imageHeight, 0,
+                GL_ALPHA, GL_UNSIGNED_BYTE, imageData);
+//      glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
+
+    /* release data, its been uploaded */
+
+    return 1;
+}
+#endif
index 99f58826606012fa176e9f6e6e3a3ff5c5693985..447ea9765ed5c0c3b4821427c2d1d2928371137e 100644 (file)
@@ -31,27 +31,27 @@ typedef float GLfloat;
 #ifdef __cplusplus
 extern "C" {
 #endif
-    extern fontset_t *fontset_init(void);
-    extern void free_font_set(fontset_t * fontset);
-    extern void copy_font(glCompFont * targetfont,
-                         const glCompFont * sourcefont);
-    extern glCompFont *add_font(fontset_t * fontset, char *fontdesc,
-                               int fs);
-    extern glCompFont *add_glut_font(fontset_t * fontset, void *glutfont);
-    extern void glprintf(glCompFont *, GLfloat, GLfloat, GLfloat, GLfloat,
-                        char *);
-    extern void glprintfglut(void *font, GLfloat xpos, GLfloat ypos,
-                            GLfloat zpos, char *bf);
-    extern glCompFont *font_init(void);
-    extern void fontColor(glCompFont * font, float r, float g, float b,
-                         float a);
-    extern int glCompLoadFontPNG(char *name, int id);
-       extern glCompFont *new_font(glCompSet * s, char *text, glCompColor * c,glCompFontType type, char *fontdesc, int fs,int is2D);
-    extern glCompFont *new_font_from_parent(glCompObj * o, char *text);
-    extern void delete_font(glCompFont * f);
-       extern void glCompDrawText(glCompFont * f,GLfloat x,GLfloat y);
-       extern void glCompRenderText(glCompFont * f, glCompObj * parentObj);
-       extern void glCompDrawText3D(glCompFont * f,GLfloat x,GLfloat y,GLfloat z,GLfloat w,GLfloat h);
+#if 0
+    void copy_font(glCompFont * targetfont, const glCompFont * sourcefont);
+    fontset_t *fontset_init(void);
+    void free_font_set(fontset_t * fontset);
+    glCompFont *add_font(fontset_t * fontset, char *fontdesc, int fs);
+    glCompFont *add_glut_font(fontset_t * fontset, void *glutfont);
+    void fontColor(glCompFont * font, float r, float g, float b, float a);
+    glCompFont *font_init(void);
+    int glCompLoadFontPNG(char *name, int id);
+    void glprintf(glCompFont *, GLfloat, GLfloat, GLfloat, GLfloat, char *);
+#endif
+
+    void glprintfglut(void *font, GLfloat xpos, GLfloat ypos, GLfloat zpos, char *bf);
+
+    glCompFont *glNewFont(glCompSet * s, char *text, glCompColor * c,
+          glCompFontType type, char *fontdesc, int fs,int is2D);
+    glCompFont *glNewFontFromParent(glCompObj * o, char *text);
+    void glDeleteFont(glCompFont * f);
+    void glCompDrawText(glCompFont * f,GLfloat x,GLfloat y);
+    void glCompRenderText(glCompFont * f, glCompObj * parentObj);
+    void glCompDrawText3D(glCompFont * f,GLfloat x,GLfloat y,GLfloat z,GLfloat w,GLfloat h);
 
 #ifdef __cplusplus
 }
index c0d06df22cdda24cd9c4ba177cdab90a3242e587..c13a1a0c6d7f935f8f01f05cc1a211178dcdd910 100644 (file)
@@ -31,23 +31,46 @@ glCompImage *glCompImageNew(glCompObj * par, GLfloat x, GLfloat y)
 
     p->objType = glImageObj;
     p->stretch = 0;
+#if 0
     p->pngFile = (char *) 0;
+#endif
     p->texture = NULL;
     p->common.functions.draw = glCompImageDraw;
     return p;
 }
 
+/* glCompImageNewFile:
+ * Creates image from given input file.
+ * At present, we assume png input.
+ * Return 0 on failure.
+ */
+glCompImage *glCompImageNewFile (glCompObj * par, GLfloat x, GLfloat y, char* imgfile, int is2D)
+{
+    int imageWidth, imageHeight;
+    unsigned char *data = glCompLoadPng (imgfile, &imageWidth, &imageHeight);
+    glCompImage *p;
+
+    if (!data) return NULL;
+    p = glCompImageNew (par, x, y);
+    if (!glCompImageLoad (p, data, imageWidth, imageHeight, is2D)) {
+       glCompImageDelete (p);
+       return NULL;
+    }
+    return p;
+}
+
 void glCompImageDelete(glCompImage * p)
 {
     glCompEmptyCommon(&p->common);
+#if 0
     if (p->pngFile)
        free(p->pngFile);
+#endif
     if (p->texture)
        glCompDeleteTexture(p->texture);
     free(p);
 }
-extern unsigned char *load_png(char *file_name, int *imageWidth,
-                              int *imageHeight);
+
 int glCompImageLoad(glCompImage * i, unsigned char *data, int width,
                    int height,int is2D)
 {
@@ -72,24 +95,26 @@ int glCompImageLoadPng(glCompImage * i, char *pngFile,int is2D)
 {
     int imageWidth, imageHeight;
     unsigned char *data;
-    data = load_png(pngFile, &imageWidth, &imageHeight);
+    data = glCompLoadPng (pngFile, &imageWidth, &imageHeight);
     return glCompImageLoad(i, data, imageWidth, imageHeight,is2D);
 }
+
+#if 0
 int glCompImageLoadRaw(glCompSet * s, glCompImage * i, char *rawFile,int is2D)
 {
     int imageWidth, imageHeight;
     unsigned char *data;
-    data = load_png(rawFile, &imageWidth, &imageHeight);
+    data = glCompLoadPng (rawFile, &imageWidth, &imageHeight);
     return glCompImageLoad(i, data, imageWidth, imageHeight,is2D);
 }
+#endif
 
 void glCompImageDraw(void *obj)
 {
-    glCompImage *p;
-    static glCompCommon ref;
-    static GLfloat w,h,d;
-    p = (glCompImage *) obj;
-    ref = p->common;
+    glCompImage *p = (glCompImage *) obj;
+    glCompCommon ref = p->common;
+    GLfloat w,h,d;
+
     glCompCalcWidget((glCompCommon *) p->common.parent, &p->common, &ref);
     if (!p->common.visible)
        return;
@@ -103,9 +128,12 @@ void glCompImageDraw(void *obj)
     }
     else
     {
-
+#if 0
        w=ref.width;
        h=ref.height;
+#endif
+       w = p->width;
+       h = p->height;
        d=(GLfloat)p->common.layer* (GLfloat)GLCOMPSET_BEVEL_DIFF;
        glDisable(GL_BLEND);
        glEnable(GL_TEXTURE_2D);
index 5d54d040c09bbeac27a99329eb01956259969176..f71d2651f7bbe9c9c5e19a01658f2300aa019501 100644 (file)
@@ -22,6 +22,8 @@
 extern "C" {
 #endif
 
+    extern glCompImage *glCompImageNewFile(glCompObj * par, GLfloat x,
+                                      GLfloat y, char* imgfile, int is2D);
     extern glCompImage *glCompImageNew(glCompObj * par, GLfloat x,
                                       GLfloat y);
     extern void glCompImageDelete(glCompImage * p);
index fa1d8401287ab6f74076565ce384b415ed4b75c4..58def751ba48445c041dfd58edcde4e2e36d271f 100644 (file)
@@ -32,8 +32,8 @@ glCompLabel *glCompLabelNew(glCompObj * par, GLfloat x, GLfloat y,
     //typedef enum {glPanelObj,glbuttonObj,glLabelObj,glImageObj}glObjType;
 
     p->text = strdup(text);
-    p->common.font = new_font_from_parent((glCompObj*)p, text);
-    p->common.functions.draw = glCompLabelDraw;
+    p->common.font = glNewFontFromParent ((glCompObj*)p, text);
+    p->common.functions.draw = (glcompdrawfunc_t)glCompLabelDraw;
 
     return p;
 }
@@ -67,9 +67,9 @@ static void update_font(glCompLabel * p,char* text,char* desc,int fs)
     if (strlen(text) >512)
        return ;
 
-    p->common.font=new_font(p->common.compset,text,&p->common.color,temp->type,desc,fs,temp->is2D);
+    p->common.font=glNewFont (p->common.compset,text,&p->common.color,temp->type,desc,fs,temp->is2D);
     if(temp)
-       delete_font(temp);
+       glDeleteFont(temp);
     if(p->text)
        free(p->text);
     p->text = strdup(text);
index 6c485be08e7372938c4acacf19fe3537108140d2..144aafee2fd7fb23cf8a6faed88ca239b5ab1264 100644 (file)
@@ -41,9 +41,9 @@ glCompPanel *glCompPanelNew(glCompObj * parentObj, GLfloat x, GLfloat y,
     p->common.width = w;
     p->common.height = h;
 
-    p->common.font = new_font_from_parent((glCompObj *) p, NULL);
+    p->common.font = glNewFontFromParent((glCompObj *) p, NULL);
     p->text = (char *) 0;
-    p->common.functions.draw = glCompPanelDraw;
+    p->common.functions.draw = (glcompdrawfunc_t)glCompPanelDraw;
     p->image = (glCompImage *) 0;
     return p;
 }
@@ -171,9 +171,10 @@ void glCompPanelMouseUp(glCompObj * obj, GLfloat x, GLfloat y,
 }
 
 
-
+#if 0
 
 void glCompPanelSetText(glCompPanel * p, char *str)
 {
 //    replacestr(str, &p->text);
 }
+#endif
index 6e36bf2ad2c390ac2e3b2da85ec45acd06bcf321..4d8fb0fdd441b51b5edcfcde8b3d09e689232710 100644 (file)
@@ -174,7 +174,7 @@ static void glCompSetMouseUp(void *obj, GLfloat x, GLfloat y,
 
 
 
-extern void glCompInitCommon(glCompObj * childObj, glCompObj * parentObj,
+void glCompInitCommon(glCompObj * childObj, glCompObj * parentObj,
                             GLfloat x, GLfloat y)
 {
     glCompCommon *c;
@@ -236,12 +236,12 @@ extern void glCompInitCommon(glCompObj * childObj, glCompObj * parentObj,
        c->layer = 0;
        c->pos.z = 0;
     }
-    c->font = new_font_from_parent(childObj, NULL);
+    c->font = glNewFontFromParent(childObj, NULL);
 }
 
 void glCompEmptyCommon(glCompCommon * c)
 {
-    delete_font(c->font);
+    glDeleteFont(c->font);
 }
 glCompSet *glCompSetNew(int w, int h)
 {
@@ -255,11 +255,11 @@ glCompSet *glCompSetNew(int w, int h)
     s->obj = (glCompObj **) 0;
     s->textureCount = 0;
     s->textures = (glCompTex **) 0;
-    s->common.font = new_font_from_parent((glCompObj *) s, NULL);
+    s->common.font = glNewFontFromParent((glCompObj *) s, NULL);
     s->common.compset = (glCompSet *) s;
-    s->common.functions.mouseover = glCompMouseMove;
-    s->common.functions.mousedown = glCompSetMouseDown;
-    s->common.functions.mouseup = glCompSetMouseUp;
+    s->common.functions.mouseover = (glcompmouseoverfunc_t)glCompMouseMove;
+    s->common.functions.mousedown = (glcompmousedownfunc_t)glCompSetMouseDown;
+    s->common.functions.mouseup = (glcompmouseupfunc_t)glCompSetMouseUp;
     glCompMouseInit(&s->mouse);
     return s;
 }
@@ -343,19 +343,6 @@ void glCompDrawEnd(void)   //pops the gl stack
 
 }
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 void glCompSetClear(glCompSet * s)
 {
 /*    int ind = 0;
index a4ea78b206e54f6f330a49332d891bf67ff2edb3..008fff165085275e0df2abcb8cc72d911eb1de9c 100644 (file)
@@ -43,7 +43,6 @@ extern "C" {
     extern int glcompsetGetGroupId(glCompSet * s);
     extern void glCompDrawBegin(void);
     extern void glCompDrawEnd(void);
-    extern void glCompDeleteTexture(glCompTex * t);
     extern void glCompSetAddObj(glCompSet * s, glCompObj * obj);
     glCompObj *glCompGetObjByMouse(glCompSet * s, glCompMouse * m,
                                   int onlyClickable);
index 7387ee4cd93c3fe751cd224998ef66fa9f4b826c..07b125bdbb9678527d5f1d868ea5e36cb976e86a 100644 (file)
@@ -19,7 +19,7 @@
 #include <gtk/gtk.h>
 #include <png.h>
 
-unsigned char *load_png(char *filename, int *imageWidth, int *imageHeight)
+unsigned char *glCompLoadPng (char *filename, int *imageWidth, int *imageHeight)
 {
     cairo_surface_t *surface;
     cairo_format_t format;
@@ -27,12 +27,8 @@ unsigned char *load_png(char *filename, int *imageWidth, int *imageHeight)
     unsigned char *d;
     surface = NULL;
 
-/*     d=create_pango_texture("Arial",14,"hello world \ n hello mars",surface,&w,&h);
-       *imageWidth=w;
-       *imageHeight=h;*/
-
-
     surface = cairo_image_surface_create_from_png(filename);
+    if (!surface) return 0;
     w = cairo_image_surface_get_width(surface);
     h = cairo_image_surface_get_height(surface);
     *imageWidth = w;
@@ -40,12 +36,9 @@ unsigned char *load_png(char *filename, int *imageWidth, int *imageHeight)
     format = cairo_image_surface_get_format(surface);
     d = cairo_image_surface_get_data(surface);
     return d;
-
-
-
-
 }
 
+#if 0
 
 unsigned char *load_raw(char *filename, int width, int height)
 {
@@ -60,8 +53,6 @@ unsigned char *load_raw(char *filename, int width, int height)
     return data;
 }
 
-
-
 unsigned char *load_png2(char *file_name, int *imageWidth,
                         int *imageHeight)
 {
@@ -156,60 +147,6 @@ unsigned char *load_png2(char *file_name, int *imageWidth,
     fclose (fp);
     return imageData;
 }
+#endif
 
 
-/*#define imageWidth 256
-#define imageHeight 256 
-static GLubyte imageData[imageWidth][imageHeight][4];*/
-
-int glCompLoadFontPNG(char *name, int id)
-{
-    GLubyte *imageData = NULL;
-    int imageWidth, imageHeight, idx2, c;
-
-//      imageData = fontGetData (s, size, imageBits);
-    imageData = load_png(name, &imageWidth, &imageHeight);
-
-    c = 0;
-    idx2 = 0;
-/*     for (idx=0;idx < imageWidth*imageHeight+30000;idx=idx+1)
-               {
-                       if (c!=imageData[idx])
-                       {
-                               c=imageData[idx];
-                               printf ("%i) %i \n ",idx2,imageData[idx]);
-                       }
-
-                       idx2++;
-                       c=((((idx&0x8)==0)^((idx2&0x8))==0))*255;
-                               imageData[idx][idx2][0] = c;
-                               imageData[idx][idx2][1] = c;
-                               imageData[idx][idx2][2] = c;
-                               imageData[idx][idx2][3] = 255;
-
-               }*/
-
-
-    /* no image data */
-    if (imageData == NULL)
-       return -1;
-
-    glBindTexture(GL_TEXTURE_2D, id);
-    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-    /* glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); */
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-    /* glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); */
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-//      glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE , GL_DECAL);
-
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, imageWidth, imageHeight, 0,
-                GL_ALPHA, GL_UNSIGNED_BYTE, imageData);
-//      glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
-
-    /* release data, its been uploaded */
-
-    return 1;
-}
index 0085f9fc45be4db8cdf0631ed7862ed3a1036028..cb6290bf91aa1328dc6afaf88ad6c0c1ec0e0477 100644 (file)
@@ -14,4 +14,4 @@
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-unsigned char *load_png(char *filename, int *imageWidth, int *imageHeight);
+unsigned char *glCompLoadPng (char *filename, int *imageWidth, int *imageHeight);
index cc57e282437c502886651f56d03513255ae17738..6b2c90894b266ba60a94a98e7cfd78306c96ca71 100644 (file)
 
 #include "memory.h"
 
+#if 0
 void glCompSetRemoveTexLabel(glCompSet * s, glCompFont * t)
 {
 }
-
+#endif
 
 static glCompTex *glCompSetAddNewTexture(glCompSet * s, int width,
                                         int height, unsigned char *data,
@@ -60,7 +61,7 @@ static glCompTex *glCompSetAddNewTexture(glCompSet * s, int width,
        }
     }
     if (is2D && !Er) {
-       t->data = N_NEW(4 * width * height, char);
+       t->data = N_NEW(4 * width * height, unsigned char);
        offset = 4;             //RGBA  mod,TO DO implement other modes 
        /*data upside down because of pango gl coord system */
        for (ind = 0; ind < height; ind++) {
@@ -136,7 +137,7 @@ glCompTex *glCompSetAddNewTexLabel(glCompSet * s, char *def, int fs,
     }
 
 
-    data = create_pango_texture(def, fs, text, surface, &width, &height);
+    data = glCompCreatePangoTexture(def, fs, text, surface, &width, &height);
     if (!data)                 /*pango error , */
        Er = 1;
     t = glCompSetAddNewTexture(s, width, height, data, is2D,fs);
index 89058e081accfc632cef092f76861a195a799f47..dd522d4793b3a7aa378fb8c541d6e7740b380112 100644 (file)
@@ -41,6 +41,7 @@ extern "C" {
                                              int fs, char *text,
                                              int is2D);
 
+    extern void glCompDeleteTexture(glCompTex * t);
 #ifdef __cplusplus
 }
 #endif
index 96ce726c7cf9aa79354aa399550f0fce6dad2b94..2807c62db3ebd6fc394fb7961ea5df74a2caf794 100644 (file)
@@ -93,7 +93,7 @@ writer(void *closure, const unsigned char *data, unsigned int length)
     return CAIRO_STATUS_WRITE_ERROR;
 }
 
-int create_font_file(char *fontdescription, int fs, char *fontfile,
+int glCompCreateFontFile(char *fontdescription, int fs, char *fontfile,
                     float gw, float gh)
 {
 
@@ -158,7 +158,7 @@ int create_font_file(char *fontdescription, int fs, char *fontfile,
 }
 
 
-unsigned char *create_pango_texture(char *fontdescription, int fontsize,
+unsigned char *glCompCreatePangoTexture(char *fontdescription, int fontsize,
                                    char *txt, cairo_surface_t * surface,
                                    int *w, int *h)
 {
index 4ace42d6de77cd5ae36d3bceb427de4c8ef9c2d0..7bc7cf026b1cca25c30319ffcf4a5eb500b77372 100644 (file)
@@ -26,11 +26,11 @@ extern "C" {
 
 //creates a font file with given name and font description
 //returns non-zero if fails
-    unsigned char *create_pango_texture(char *fontdescription,
+    unsigned char *glCompCreatePangoTexture(char *fontdescription,
                                        int fontsize, char *txt,
                                        cairo_surface_t * surface, int *w,
                                        int *h);
-    int create_font_file(char *fontdescription, int fs, char *fontfile,
+    int glCompCreateFontFile(char *fontdescription, int fs, char *fontfile,
                         float gw, float gh);
 
 #ifdef __cplusplus
index 9a06781b19297163b5fe53629f2883546e5f98af..5bd3aea02c9d43f534c43326e993493c36ef143e 100644 (file)
@@ -244,7 +244,8 @@ int GetFixedOGLPoslocal(int x, int y, GLfloat * X, GLfloat * Y,
     return 1;
 
 }
-void linear_interplotate(float x1, float y1, float x2, float y2, float x3,
+#if 0
+void linear_interpolate(float x1, float y1, float x2, float y2, float x3,
                         float *y3)
 {
 
@@ -254,7 +255,6 @@ void linear_interplotate(float x1, float y1, float x2, float y2, float x3,
     *y3 = a * x3 + b;
 }
 
-#if 0
 int glreversecamera(ViewInfo * view)
 {
 
@@ -279,6 +279,7 @@ int glreversecamera(ViewInfo * view)
 
 
 
+#if 0
 static glCompPoint add(glCompPoint p, glCompPoint q)
 {
     p.x += q.x;
@@ -286,6 +287,7 @@ static glCompPoint add(glCompPoint p, glCompPoint q)
     p.z += q.z;
     return p;
 }
+#endif
 
 static glCompPoint sub(glCompPoint p, glCompPoint q)
 {
@@ -305,6 +307,7 @@ static double len(glCompPoint p)
     return sqrt(dot(p, p));
 }
 
+#if 0
 static glCompPoint scale(double d, glCompPoint p)
 {
     p.x *= (float) d;
@@ -312,6 +315,7 @@ static glCompPoint scale(double d, glCompPoint p)
     p.z *= (float) d;
     return p;
 }
+#endif
 
 static glCompPoint blend(glCompPoint p, glCompPoint q, float m)
 {
@@ -323,6 +327,12 @@ static glCompPoint blend(glCompPoint p, glCompPoint q, float m)
     return r;
 }
 
+static double dist(glCompPoint p, glCompPoint q)
+{
+    return (len(sub(p, q)));
+}
+
+#if 0
 static glCompPoint normalize(glCompPoint p)
 {
     double d = len(p);
@@ -330,11 +340,6 @@ static glCompPoint normalize(glCompPoint p)
     return scale(1 / d, p);
 }
 
-static double dist(glCompPoint p, glCompPoint q)
-{
-    return (len(sub(p, q)));
-}
-
 static glCompPoint intersect(line l, plane J)
 {
     double t = -(J.d + dot(l.u, J.N)) / dot(l.v, J.N);
@@ -361,6 +366,7 @@ double point_to_line_dist(glCompPoint p, glCompPoint a, glCompPoint b)
 
     return (dist(p, q));
 }
+#endif
 
 
 /*
@@ -389,11 +395,11 @@ double point_to_lineseg_dist(glCompPoint p, glCompPoint a, glCompPoint b)
 
 }
 
+#if 0
 /*
        Calculates the parameters of a plane via given 3 points on it
 */
 
-
 void make_plane(glCompPoint a, glCompPoint b, glCompPoint c, plane * P)
 {
     P->N.x = a.y * (b.z - c.z) + b.y * (c.z - a.z) + c.y * (a.z - b.z);        //+
@@ -403,6 +409,7 @@ void make_plane(glCompPoint a, glCompPoint b, glCompPoint c, plane * P)
        (a.x * (b.y * c.z - c.y * b.z) + b.x * (c.y * a.z - a.y * c.z) +
         c.x * (a.y * b.z - b.y * a.z)) * -1;
 }
+#endif
 void replacestr(char *source, char **target)
 {
 
@@ -411,6 +418,7 @@ void replacestr(char *source, char **target)
     *target = strdup(source);
 }
 
+#if 0
 /*
        move a point on the great circle of it (spherical)
 
@@ -454,6 +462,7 @@ int rot_spherex(plane J, float tet, glCompPoint P, glCompPoint * P2)
        return 0;
 
 }
+#endif
 
 void glCompSelectionBox(glCompSet * s)
 {
@@ -688,8 +697,8 @@ void copy_glcomp_color(glCompColor * source, glCompColor * target)
 
 }
 
-
-double area2(glCompPoint * p1p, glCompPoint * p2p, glCompPoint * p3p) 
+#if 0
+static double area2(glCompPoint * p1p, glCompPoint * p2p, glCompPoint * p3p) 
 {
     double d;
 
@@ -700,7 +709,7 @@ double area2(glCompPoint * p1p, glCompPoint * p2p, glCompPoint * p3p)
 
 
 enum {ISCCW, ISON, ISCW};  /* counterclockwise; collinear; clockwise */ 
-int sideOf (glCompPoint * p1p, glCompPoint * p2p, glCompPoint * p3p) {
+static int sideOf (glCompPoint * p1p, glCompPoint * p2p, glCompPoint * p3p) {
     double d = area2 (p1p,p2p,p3p);
     if (d < 0) return ISCCW;
     else if (d > 0) return ISCW;
@@ -711,6 +720,7 @@ int lines_intersect (glCompPoint* a, glCompPoint* b, glCompPoint* c, glCompPoint
 {
   return ((sideOf(a,b,c) != sideOf(a,b,d)) && (sideOf(c,d,a) != sideOf(c,d,b))); 
 }
+#endif
 GLfloat distBetweenPts(glCompPoint A,glCompPoint B,float R)
 {
     GLfloat rv=0;      
index 685e4714a460f0b7b8dc02db0f8bb942c723fa2d..87f5abf18a63aec394da1a73023ca9ad531e3268 100644 (file)
@@ -43,11 +43,14 @@ extern "C" {
     int GetFixedOGLPoslocal(int x, int y, GLfloat * X, GLfloat * Y,
                            GLfloat * Z);
     void to3D(int x, int y, GLfloat * X, GLfloat * Y, GLfloat * Z);
-    void linear_interplotate(float, float, float, float, float, float *);
-    double point_to_line_dist(glCompPoint p, glCompPoint u, glCompPoint v);
     double point_to_lineseg_dist(glCompPoint p, glCompPoint a, glCompPoint b);
+#if 0
+    void linear_interpolate(float, float, float, float, float, float *);
+    double point_to_line_dist(glCompPoint p, glCompPoint u, glCompPoint v);
     int rot_spherex(plane J, float tet, glCompPoint P, glCompPoint * P2);
     void make_plane(glCompPoint a, glCompPoint b, glCompPoint c, plane * P);
+    int lines_intersect (glCompPoint* a, glCompPoint* b, glCompPoint* c, glCompPoint* d);
+#endif
     void replacestr(char *source, char **target);
     extern void glCompCalcWidget(glCompCommon * parent,
                                 glCompCommon * child, glCompCommon * ref);
@@ -60,7 +63,6 @@ extern "C" {
     extern void glCompSetColor(glCompColor * c);
 
     void glCompSelectionBox(glCompSet * s);
-    extern int lines_intersect (glCompPoint* a, glCompPoint* b, glCompPoint* c, glCompPoint* d);
     extern GLfloat distBetweenPts(glCompPoint A,glCompPoint B,float R);
     extern int is_point_in_rectangle(float X, float Y, float RX, float RY, float RW,float RH);