Graphviz 12.0.1~dev.20240715.2254
Loading...
Searching...
No Matches
glcomplabel.c
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11#include <cgraph/alloc.h>
12#include <glcomp/glcomplabel.h>
13#include <glcomp/glcompfont.h>
14#include <glcomp/glcompset.h>
15#include <glcomp/glutils.h>
16
17static void glCompLabelDraw(void *label) {
18 glCompLabel *p = label;
20 ref = p->common;
22 /*draw background */
23 if (!p->transparent) {
25 glBegin(GL_QUADS);
26 glVertex3d(ref.refPos.x, ref.refPos.y, ref.refPos.z);
27 glVertex3d(ref.refPos.x + ref.width, ref.refPos.y, ref.refPos.z);
28 glVertex3d(ref.refPos.x + ref.width, ref.refPos.y + ref.height,
29 ref.refPos.z);
30 glVertex3d(ref.refPos.x, ref.refPos.y + ref.height, ref.refPos.z);
31 glEnd();
32 }
34}
35
37 glCompLabel *p = gv_alloc(sizeof(glCompLabel));
38 glCompInitCommon((glCompObj*)p, par, 0, 0);
40 p->transparent=1;
41
42 p->text = gv_strdup(text);
45
46 return p;
47}
Memory allocation wrappers that exit on failure.
static char * gv_strdup(const char *original)
Definition alloc.h:101
static void * gv_alloc(size_t size)
Definition alloc.h:47
@ glLabelObj
Definition glcompdefs.h:93
void glCompRenderText(glCompFont *f, glCompObj *parentObj)
Definition glcompfont.c:142
glCompFont * glNewFontFromParent(glCompObj *o, char *text)
Definition glcompfont.c:75
static void glCompLabelDraw(void *label)
Definition glcomplabel.c:17
glCompLabel * glCompLabelNew(glCompObj *par, char *text)
Definition glcomplabel.c:36
void glCompInitCommon(glCompObj *childObj, glCompObj *parentObj, float x, float y)
Definition glcompset.c:120
void glCompCalcWidget(glCompCommon *parent, glCompCommon *child, glCompCommon *ref)
Definition glutils.c:195
void glCompSetColor(glCompColor *c)
Definition glutils.c:294
static int label(Agnode_t *n, int nodecnt, int *edgecnt)
Definition sccmap.c:158
void ref(Site *v)
Definition site.c:59
glcompdrawfunc_t draw
Definition glcompdefs.h:190
glCompColor color
Definition glcompdefs.h:212
glCompCallBacks functions
Definition glcompdefs.h:223
glCompFont * font
Definition glcompdefs.h:218
void * parent
Definition glcompdefs.h:216
char * text
Definition glcompdefs.h:251
glCompCommon common
Definition glcompdefs.h:250
glObjType objType
Definition glcompdefs.h:249