rv.x = rv.y = -1;
return rv;
}
-
-point gd_user_shape_size(node_t * n, char *shapeimagefile)
-{
- return (gd_image_size(n->graph, shapeimagefile));
-}
return rv;
}
-point ps_user_shape_size(node_t * n, char *shapeimagefile)
-{
- return (ps_image_size(n->graph, shapeimagefile));
-}
-
void ps_freeusershapes(void)
{
if (EPSF_contents) {
extern char *gd_alternate_fontlist(char *font);
extern char *gd_textsize(textline_t * textline, char *fontname,
double fontsz, char **fontpath);
- extern point gd_user_shape_size(node_t * n, char *shapeimagefile);
- extern point ps_user_shape_size(node_t * n, char *shapeimagefile);
- extern point svg_user_shape_size(node_t * n, char *shapeimagefile);
- extern point quartz_user_shape_size(node_t * n, char *shapeimagefile);
- extern point gd_image_size(graph_t * n, char *shapeimagefile);
- extern point ps_image_size(graph_t * n, char *shapeimagefile);
- extern point svg_image_size(graph_t * n, char *shapeimagefile);
- extern point quartz_image_size(graph_t * n, char *shapeimagefile);
extern void getdouble(graph_t * g, char *name, double *result);
extern splines *getsplinepoints(edge_t * e);
extern void global_def(char *,
extern void updateBB(graph_t * g, textlabel_t * lp);
extern void use_library(char *);
extern char *username(void);
- extern point user_shape_size(node_t * n, char *shapefile);
extern char* utf8ToLatin1 (char* ins);
extern void write_attributed_dot(graph_t *g, FILE *f);
extern void write_canonical_dot(graph_t *g, FILE *f);
point imagesize;
char *sfile = agget(n, "shapefile");
- imagesize = user_shape_size(n, sfile);
+ imagesize = image_size(n->graph, sfile);
if ((imagesize.x == -1) && (imagesize.y == -1)) {
agerr(AGERR,
"No or improper shapefile=\"%s\" for node \"%s\"\n",
rv.x = rv.y = 0;
return rv;
}
-
-point svg_user_shape_size(node_t * n, char *shapeimagefile)
-{
- point rv;
-
- rv.x = rv.y = 0;
- return rv;
-}
return rv;
}
-/*
- * This routine extracts the usershape size from known filetypes,
- * it does not check that the output renderer knows how to render
- * this file type
- * Returns the size required for the shape in points;
- * returns (-1,-1) on error;
- * returns (0,0) to indicate "don't care". For example, in
- * postscript, a node can have a user-defined shape but no shapefile.
- */
-point user_shape_size(node_t * n, char *shapefile)
-{
- char *suffix;
- point rv;
-
- /* no shape file, no shape size */
- if (!shapefile) {
- rv.x = rv.y = -1;
- return rv;
- }
- if (*shapefile == '\0') {
- rv.x = rv.y = 0;
- return rv; /* no shapefile; probably postscript custom */
- }
- if (!strncasecmp(shapefile, "http://", 7)) {
- rv.x = rv.y = 0;
- return rv; /* punt on obvious web addresses */
- }
-
- suffix = strrchr(shapefile, '.');
- if (!suffix)
- suffix = shapefile;
- else
- suffix++;
- if (!strcasecmp(suffix, "wbmp")
-#ifdef HAVE_GD_GIF
- || !strcasecmp(suffix, "gif")
-#endif
-#ifdef HAVE_GD_JPEG
- || !strcasecmp(suffix, "jpeg") || !strcasecmp(suffix, "jpg")
-#endif
-#ifdef HAVE_GD_PNG
- || !strcasecmp(suffix, "png")
-#endif
-#ifdef HAVE_GD_XPM
- || !strcasecmp(suffix, "xbm")
-/* FIXME - is "xpm" also supported by gd for input ? */
-#endif
- ) {
- rv = gd_user_shape_size(n, shapefile);
- } else
-#ifdef QUARTZ_RENDER
- if (Output_lang == QPDF || Output_lang == QEPDF ||
- (Output_lang >= QBM_FIRST && Output_lang <= QBM_LAST))
- return quartz_user_shape_size(n, shapefile);
- else
-#endif
- if (!strcasecmp(suffix, "ps") || !strncasecmp(suffix, "eps", 3) ||
- !strcasecmp(suffix, "epi")) {
- rv = ps_user_shape_size(n, shapefile);
- } else if (!strcasecmp(suffix, "svg")) {
- rv = svg_user_shape_size(n, shapefile);
- } else {
- agerr(AGERR, "shapefile \"%s\" suffix not recognized\n",
- shapefile);
- rv.x = rv.y = 0;
- }
- return rv;
-}
-
-point image_size(graph_t * g, char *shapefile)
-{
- char *suffix;
- point rv;
-
- /* no shape file, no shape size */
- if (!shapefile) {
- rv.x = rv.y = -1;
- return rv;
- }
- if (*shapefile == '\0') {
- rv.x = rv.y = 0;
- return rv; /* no shapefile; probably postscript custom */
- }
- if (!strncasecmp(shapefile, "http://", 7)) {
- rv.x = rv.y = 0;
- return rv; /* punt on obvious web addresses */
- }
-
- suffix = strrchr(shapefile, '.');
- if (!suffix)
- suffix = shapefile;
- else
- suffix++;
- if (!strcasecmp(suffix, "wbmp")
-#ifdef HAVE_GD_GIF
- || !strcasecmp(suffix, "gif")
-#endif
-#ifdef HAVE_GD_JPEG
- || !strcasecmp(suffix, "jpeg") || !strcasecmp(suffix, "jpg")
-#endif
-#ifdef HAVE_GD_PNG
- || !strcasecmp(suffix, "png")
-#endif
-#ifdef HAVE_GD_XPM
- || !strcasecmp(suffix, "xbm")
-/* FIXME - is "xpm" also supported by gd for input ? */
-#endif
- ) {
- rv = gd_image_size(g, shapefile);
- } else
-#ifdef QUARTZ_RENDER
- if (Output_lang == QPDF || Output_lang == QEPDF ||
- (Output_lang >= QBM_FIRST && Output_lang <= QBM_LAST))
- return quartz_image_size(g, shapefile);
- else
-#endif
-
- if (!strcasecmp(suffix, "ps")) {
- rv = ps_image_size(g, shapefile);
- } else if (!strcasecmp(suffix, "svg")) {
- rv = svg_image_size(g, shapefile);
- } else {
- agerr(AGERR, "shapefile \"%s\" suffix not recognized\n",
- shapefile);
- rv.x = rv.y = -1;
- }
- return rv;
-}
-
/* addLabelBB:
*/
static box addLabelBB(box bb, textlabel_t * lp)
extern int gvusershape_select(GVC_t * gvc, char *name);
extern void * gvusershape_getshape(GVC_t * gvc, char *usershape);
- extern void gvusershape_freeeshapes(GVC_t * gvc);
- extern point gvusershape_imagesize(GVC_t * gvc, char *usershape);
+ extern void gvusershape_freeshapes(GVC_t * gvc);
+ extern point gvusershape_size(GVC_t * gvc, char *usershape);
/* device */
#include "config.h"
#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifndef HAVE_STRCASECMP
+ extern int strcasecmp(const char *s1, const char *s2);
+#endif
+#ifndef HAVE_STRNCASECMP
+ extern int strncasecmp(const char *s1, const char *s2, unsigned int n);
+#endif
+
#include <stdio.h>
#include "const.h"
#include "types.h"
#include "macros.h"
+#include "cdt.h"
+#include "graph.h"
#include "gvplugin_usershape.h"
#include "gvc.h"
+extern point gd_image_size(graph_t * g, char *shapeimagefile);
+extern point ps_image_size(graph_t * g, char *shapeimagefile);
+extern point svg_image_size(graph_t * g, char *shapeimagefile);
+extern point quartz_image_size(graph_t * g, char *shapeimagefile);
+
int gvusershape_select(GVC_t * gvc, char *usershape)
{
gvplugin_available_t *plugin;
}
return NO_SUPPORT;
}
+
+/*
+ * This routine extracts the usershape size from known filetypes,
+ * it does not check that the output renderer knows how to render
+ * this file type
+ * Returns the size required for the shape in points;
+ * returns (-1,-1) on error;
+ * returns (0,0) to indicate "don't care". For example, in
+ * postscript, a node can have a user-defined shape but no shapefile.
+ */
+point image_size(graph_t * g, char *shapefile)
+{
+ char *suffix;
+ point rv;
+
+ /* no shape file, no shape size */
+ if (!shapefile) {
+ rv.x = rv.y = -1;
+ return rv;
+ }
+ if (*shapefile == '\0') {
+ rv.x = rv.y = 0;
+ return rv; /* no shapefile; probably postscript custom */
+ }
+ if (!strncasecmp(shapefile, "http://", 7)) {
+ rv.x = rv.y = 0;
+ return rv; /* punt on obvious web addresses */
+ }
+
+ suffix = strrchr(shapefile, '.');
+ if (!suffix)
+ suffix = shapefile;
+ else
+ suffix++;
+ if (!strcasecmp(suffix, "wbmp")
+#ifdef HAVE_GD_GIF
+ || !strcasecmp(suffix, "gif")
+#endif
+#ifdef HAVE_GD_JPEG
+ || !strcasecmp(suffix, "jpeg") || !strcasecmp(suffix, "jpg")
+#endif
+#ifdef HAVE_GD_PNG
+ || !strcasecmp(suffix, "png")
+#endif
+#ifdef HAVE_GD_XPM
+ || !strcasecmp(suffix, "xbm")
+/* FIXME - is "xpm" also supported by gd for input ? */
+#endif
+ ) {
+ rv = gd_image_size(g, shapefile);
+ } else
+#ifdef QUARTZ_RENDER
+ if (Output_lang == QPDF || Output_lang == QEPDF ||
+ (Output_lang >= QBM_FIRST && Output_lang <= QBM_LAST))
+ return quartz_image_size(g, shapefile);
+ else
+#endif
+
+ if (!strcasecmp(suffix, "ps")) {
+ rv = ps_image_size(g, shapefile);
+ } else if (!strcasecmp(suffix, "svg")) {
+ rv = svg_image_size(g, shapefile);
+ } else {
+ agerr(AGERR, "shapefile \"%s\" suffix not recognized\n",
+ shapefile);
+ rv.x = rv.y = -1;
+ }
+ return rv;
+}
+