]> granicus.if.org Git - graphviz/commitdiff
xdot images
authorarif <devnull@localhost>
Tue, 13 Jul 2010 15:33:24 +0000 (15:33 +0000)
committerarif <devnull@localhost>
Tue, 13 Jul 2010 15:33:24 +0000 (15:33 +0000)
cmd/smyrna/draw.c
cmd/smyrna/gui/glcompui.c
cmd/smyrna/smyrna.vcproj
cmd/smyrna/smyrna.vcproj.RESEARCH.arif.user
lib/glcomp/glcompbutton.c
lib/glcomp/glcompimage.c
lib/glcomp/glcompimage.h
lib/glcomp/glcomptexture.c
lib/glcomp/glutils.c

index ed31616d962d7063a11bdaaa49871fbacf5d472a..07003d2d4c71223ac64536db4f1981e4e1f067e1 100755 (executable)
@@ -31,6 +31,8 @@ XDOT DRAWING FUNCTIONS, maybe need to move them somewhere else
 #include "appmouse.h"
 #include "hotkeymap.h"
 #include "polytess.h"
+#include "glcompimage.h"
+
 
 //delta values
 static float dx = 0.0;
@@ -426,22 +428,24 @@ void InsertImage(sdot_op * o, int param)
 {
 
 
-    float w,h,x,y;
+    float w,h,x,y,X,Y,Z;
+    glCompImage *i;
+
     if(!o->obj)
        return;
-    w=atof(agget(o->obj,"width"))*72;
-    h=atof(agget(o->obj,"height"))*72;
 
     if(!o->iData.data)
+    {
        o->iData.data = load_png(o->op.u.image.name, &o->iData.w, &o->iData.h);    
-    x=o->op.u.image.pos.x;
-    y=o->op.u.image.pos.y;
-    x=x+(o->iData.w-w)/2.0;
-    y=y+(o->iData.h-h)/2.0;
- //   glRasterPos3f(x,y,5);
-    glRasterPos3f(20,20,0);
-    if(o->iData.data)
-       glDrawPixels(o->iData.w,o->iData.h,GL_RGBA,GL_UNSIGNED_BYTE,o->iData.data);
+       x=o->op.u.image.pos.x;
+       y=o->op.u.image.pos.y;
+       i = glCompImageNew(NULL, x, y);
+       glCompImageLoadPng(i, o->op.u.image.name,0);
+       i->common.functions.draw(i);
+
+    }
+
+
 }
 void EmbedText(sdot_op* o, int param)
 {
index cc9c74ed49ba3f6b0173d50ced13e9de8df57963..d46d7765b355faa1542731a7fd143dad78cb77ee 100644 (file)
@@ -381,18 +381,16 @@ glCompSet *glcreate_gl_topview_menu(void)
     p->shadowwidth = 0;
 
     i = glCompImageNew((glCompObj *) p, 0, 0);
-    glCompImageLoadPng(i, smyrnaPath("mod_fisheye.png"));
+    glCompImageLoadPng(i, smyrnaPath("mod_fisheye.png"),1);
     imgFisheye = i;
     i->common.visible = 0;
 
     i = glCompImageNew((glCompObj *) p, 0, 52);
-    glCompImageLoadPng(i, smyrnaPath("mod_3D.png"));
+    glCompImageLoadPng(i, smyrnaPath("mod_3D.png"),1);
     img3D = i;
     i->common.visible = 0;
-/*    l=glCompLabelNew((glCompObj *)s,100,5,view->Topview->Graphdata.GraphFileName);
-    glCompLabelSetFontSize(l,24);*/
+    
 
-//    testContainer(s);
     return s;
 
 
index 73e3df3c4c5089484f0e9c871f5c876ebcd44a4b..4ba47dd114982b95cd4b134f25b1381d466a9685 100644 (file)
                                RelativePath=".\draw.c"
                                >
                        </File>
-                       <File
-                               RelativePath=".\drawxdot.c"
-                               >
-                       </File>
                        <File
                                RelativePath=".\filter.c"
                                >
                        </File>
-                       <File
-                               RelativePath=".\gui\filterscallbacks.c"
-                               >
-                       </File>
                        <File
                                RelativePath=".\gui\frmobjectui.c"
                                >
                                RelativePath=".\smyrna_utils.c"
                                >
                        </File>
-                       <File
-                               RelativePath=".\template.c"
-                               >
-                       </File>
                        <File
                                RelativePath=".\gui\toolboxcallbacks.c"
                                >
index 3bf2607b83b03dfc48fefc8e925509b65ff38068..dfdb7952261767986a0e6eb7e0bb38b2e02f8f49 100644 (file)
@@ -2,7 +2,7 @@
 <VisualStudioUserFile
        ProjectType="Visual C++"
        Version="9.00"
-       ShowAllFiles="true"
+       ShowAllFiles="false"
        >
        <Configurations>
                <Configuration
@@ -15,7 +15,7 @@
                                Attach="false"
                                DebuggerType="3"
                                Remote="1"
-                               RemoteMachine="YEHUDA"
+                               RemoteMachine="DT-BYUNG"
                                RemoteCommand=""
                                HttpUrl=""
                                PDBPath=""
                        >
                        <DebugSettings
                                Command="$(TargetPath)"
-                               WorkingDirectory="C:\graphviz-ms\bin"
-                               CommandArguments="c:/4elt.dot"
+                               WorkingDirectory=""
+                               CommandArguments=""
                                Attach="false"
                                DebuggerType="3"
                                Remote="1"
-                               RemoteMachine="YEHUDA"
+                               RemoteMachine="DT-BYUNG"
                                RemoteCommand=""
                                HttpUrl=""
                                PDBPath=""
                                SQLDebugging=""
                                Environment=""
                                EnvironmentMerge="true"
-                               DebuggerFlavor="0"
+                               DebuggerFlavor=""
                                MPIRunCommand=""
                                MPIRunArguments=""
                                MPIRunWorkingDirectory=""
index f523ea1ea97f8a57a4344318aa0c883616d3c7a4..8b39db1fc11ad8a79cbe9ec14156406333cf9a27 100644 (file)
@@ -82,7 +82,7 @@ int glCompButtonAddPngGlyph(glCompButton * b, char *fileName)
     /*image on left for now */
     b->image = glCompImageNew((glCompObj *) b, 0, 0);
 
-    rv = glCompImageLoadPng(b->image, fileName);
+    rv = glCompImageLoadPng(b->image, fileName,1);
     if (rv) {
        b->image->common.anchor.leftAnchor = 1;
        b->image->common.anchor.left = 0;
index 4525258f11b4ba17da7d9ea929baea5907e4570e..c0d06df22cdda24cd9c4ba177cdab90a3242e587 100644 (file)
@@ -49,13 +49,13 @@ void glCompImageDelete(glCompImage * 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 height,int is2D)
 {
     if (data != NULL) {                /*valid image data */
        glCompDeleteTexture(i->texture);
        i->texture =
            glCompSetAddNewTexImage(i->common.compset, width, height, data,
-                                   1);
+                                   is2D);
        if (i->texture) {
            i->common.width = width;
            i->common.height = height;
@@ -68,26 +68,26 @@ int glCompImageLoad(glCompImage * i, unsigned char *data, int width,
 
 
 
-int glCompImageLoadPng(glCompImage * i, char *pngFile)
+int glCompImageLoadPng(glCompImage * i, char *pngFile,int is2D)
 {
     int imageWidth, imageHeight;
     unsigned char *data;
     data = load_png(pngFile, &imageWidth, &imageHeight);
-    return glCompImageLoad(i, data, imageWidth, imageHeight);
+    return glCompImageLoad(i, data, imageWidth, imageHeight,is2D);
 }
-int glCompImageLoadRaw(glCompSet * s, glCompImage * i, char *rawFile)
+int glCompImageLoadRaw(glCompSet * s, glCompImage * i, char *rawFile,int is2D)
 {
     int imageWidth, imageHeight;
     unsigned char *data;
     data = load_png(rawFile, &imageWidth, &imageHeight);
-    return glCompImageLoad(i, data, imageWidth, imageHeight);
+    return glCompImageLoad(i, data, imageWidth, imageHeight,is2D);
 }
 
 void glCompImageDraw(void *obj)
 {
     glCompImage *p;
     static glCompCommon ref;
-//      static GLfloat w,h,d;
+    static GLfloat w,h,d;
     p = (glCompImage *) obj;
     ref = p->common;
     glCompCalcWidget((glCompCommon *) p->common.parent, &p->common, &ref);
@@ -96,15 +96,18 @@ void glCompImageDraw(void *obj)
     if (!p->texture)
        return;
 
-    glRasterPos2f(ref.pos.x, ref.pos.y);
-//    glPixelZoom(2,2);
-    glDrawPixels(p->texture->width, p->texture->height, GL_RGBA,
-                GL_UNSIGNED_BYTE, p->texture->data);
+    if(p->texture->id <=0)
+    {
+       glRasterPos2f(ref.pos.x, ref.pos.y);
+       glDrawPixels(p->texture->width, p->texture->height, GL_RGBA,GL_UNSIGNED_BYTE, p->texture->data);
+    }
+    else
+    {
 
-/*     w=ref.width;
+       w=ref.width;
        h=ref.height;
        d=(GLfloat)p->common.layer* (GLfloat)GLCOMPSET_BEVEL_DIFF;
-    glDisable(GL_BLEND);
+       glDisable(GL_BLEND);
        glEnable(GL_TEXTURE_2D);
        glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
        glBindTexture(GL_TEXTURE_2D,p->texture->id);
@@ -115,8 +118,10 @@ void glCompImageDraw(void *obj)
                glTexCoord2d(0.0f, 0.0f);glVertex3d(ref.pos.x,ref.pos.y+h,d);
        glEnd();
 
+
        glDisable(GL_TEXTURE_2D);
-    glEnable(GL_BLEND);*/
+       glEnable(GL_BLEND);
+    }
 
 }
 
index cf3d533e9d1130f1d0ed2e1be9b0f868885760c9..5d54d040c09bbeac27a99329eb01956259969176 100644 (file)
@@ -26,8 +26,8 @@ extern "C" {
                                       GLfloat y);
     extern void glCompImageDelete(glCompImage * p);
     extern int glCompImageLoad(glCompImage * i, unsigned char *data,
-                              int width, int height);
-    extern int glCompImageLoadPng(glCompImage * i, char *pngFile);
+                              int width, int height,int is2D);
+    extern int glCompImageLoadPng(glCompImage * i, char *pngFile,int is2D);
     extern void glCompImageDraw(void *obj);
     extern void glCompImageClick(glCompObj * o, GLfloat x, GLfloat y,
                                 glMouseButtonType t);
index fc24a06a4582501658bcbc025cbf361208b13bde..cc57e282437c502886651f56d03513255ae17738 100644 (file)
@@ -78,10 +78,13 @@ static glCompTex *glCompSetAddNewTexture(glCompSet * s, int width,
     t->userCount = 1;
     t->width = (GLfloat) width;
     t->height = (GLfloat) height;
-    s->textureCount++;
-    s->textures =
+    if(s)
+    {
+       s->textureCount++;
+       s->textures =
        realloc(s->textures, s->textureCount * sizeof(glCompTex *));
-    s->textures[s->textureCount - 1] = t;
+       s->textures[s->textureCount - 1] = t;
+    }
     return t;
 
 
index 10b185a829b80e9a9829932f4eedbca731484ee2..9a06781b19297163b5fe53629f2883546e5f98af 100644 (file)
@@ -506,6 +506,12 @@ void glCompCalcWidget(glCompCommon * parent, glCompCommon * child,
     GLfloat borderWidth;
     ref->height = child->height;
     ref->width = child->width;
+    if(!parent)
+    {
+       child->refPos.x = child->pos.x;
+       child->refPos.y = child->pos.y;
+       return;
+    }
     if (parent->borderType == glBorderNone)
        borderWidth = 0;
     else