Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
gvloadimage.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/*
12 * graphics code generator wrapper
13 *
14 * This library forms the socket for run-time loadable loadimage plugins.
15 */
16
17#include "config.h"
18#include <common/const.h>
20#include <gvc/gvcint.h>
21#include <gvc/gvcproc.h>
22
23/* for agerr() */
24#include <cgraph/cgraph.h>
25#include <stdbool.h>
26#include <stddef.h>
27#include <util/agxbuf.h>
28
29static int gvloadimage_select(GVJ_t * job, char *str)
30{
32 gvplugin_installed_t *typeptr;
33
34 plugin = gvplugin_load(job->gvc, API_loadimage, str, NULL);
35 if (plugin) {
36 typeptr = plugin->typeptr;
37 job->loadimage.engine = typeptr->engine;
38 job->loadimage.id = typeptr->id;
39 return GVRENDER_PLUGIN;
40 }
41 return NO_SUPPORT;
42}
43
44void gvloadimage(GVJ_t * job, usershape_t *us, boxf b, bool filled, const char *target)
45{
47 agxbuf type_buf = {0};
48
49 assert(job);
50 assert(us);
51 assert(us->name);
52 assert(us->name[0]);
53
54 agxbprint(&type_buf, "%s:%s", us->stringtype, target);
55 char *type = agxbuse(&type_buf);
56
58 agwarningf("No loadimage plugin for \"%s\"\n", type);
59
60 if ((gvli = job->loadimage.engine) && gvli->loadimage)
61 gvli->loadimage(job, us, b, filled);
62
63 agxbfree(&type_buf);
64}
static void agxbfree(agxbuf *xb)
free any malloced resources
Definition agxbuf.h:78
static int agxbprint(agxbuf *xb, const char *fmt,...)
Printf-style output to an agxbuf.
Definition agxbuf.h:234
static WUR char * agxbuse(agxbuf *xb)
Definition agxbuf.h:307
abstract graph C library, Cgraph API
#define NO_SUPPORT
Definition const.h:147
#define GVRENDER_PLUGIN
Definition const.h:146
expr procedure type
Definition exparse.y:208
node NULL
Definition grammar.y:163
void agwarningf(const char *fmt,...)
Definition agerror.c:173
gvplugin_available_t * gvplugin_load(GVC_t *gvc, api_t api, const char *type, FILE *debug)
Definition gvplugin.c:250
static int gvloadimage_select(GVJ_t *job, char *str)
Definition gvloadimage.c:29
void gvloadimage(GVJ_t *job, usershape_t *us, boxf b, bool filled, const char *target)
Definition gvloadimage.c:44
textitem scanner parser str
Definition htmlparse.y:224
gvplugin_active_loadimage_t loadimage
Definition gvcjob.h:287
GVC_t * gvc
Definition gvcjob.h:263
Definition geom.h:41
void(* loadimage)(GVJ_t *job, usershape_t *us, boxf b, bool filled)
gvloadimage_engine_t * engine
Definition gvcjob.h:142
gvplugin_installed_t * typeptr
Definition gvcint.h:65
ingroup plugin_api
Definition gvplugin.h:35
const char * name
Definition usershape.h:54
char * stringtype
Definition usershape.h:60