Graphviz 13.0.0~dev.20241220.2304
|
#include "config.h"
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <util/gv_fopen.h>
#include <common/types.h>
#include <common/usershape.h>
#include <common/utils.h>
#include <gvc/gvplugin_loadimage.h>
#include <gvc/gvplugin.h>
#include <gvc/gvcint.h>
#include <gvc/gvcproc.h>
#include <util/agxbuf.h>
#include <util/alloc.h>
#include <util/gv_ctype.h>
#include <util/strview.h>
Go to the source code of this file.
Data Structures | |
struct | knowntype_t |
struct | match_t |
struct | stream_t |
Macros | |
#define | HDRLEN 20 |
#define | PNG_MAGIC "\x89PNG\x0D\x0A\x1A\x0A" |
#define | PS_MAGIC "%!PS-Adobe-" |
#define | BMP_MAGIC "BM" |
#define | GIF_MAGIC "GIF8" |
#define | JPEG_MAGIC "\xFF\xD8\xFF" |
#define | PDF_MAGIC "%PDF-" |
#define | EPS_MAGIC "\xC5\xD0\xD3\xC6" |
#define | XML_MAGIC "<?xml" |
#define | SVG_MAGIC "<svg" |
#define | RIFF_MAGIC "RIFF" |
#define | WEBP_MAGIC "WEBP" |
#define | ICO_MAGIC "\x00\x00\x01\x00" |
#define | KEY "/MediaBox" |
#define | strc(x) (*(x->s)?*(x->s):nxtc(x)) |
#define | stradv(x) (x->s++) |
#define | MAX_USERSHAPE_FILES_OPEN 50 |
Functions | |
shape_desc * | find_user_shape (const char *) |
static imagetype_t | imagetype (usershape_t *us) |
static bool | get_int_lsb_first (FILE *f, size_t sz, int *val) |
static bool | get_int_msb_first (FILE *f, size_t sz, int *val) |
static double | svg_units_convert (double n, char *u) |
static int | find_attribute (const char *s, match_t *result) |
static void | svg_size (usershape_t *us) |
static void | png_size (usershape_t *us) |
static void | ico_size (usershape_t *us) |
static void | webp_size (usershape_t *us) |
static void | gif_size (usershape_t *us) |
static void | bmp_size (usershape_t *us) |
static void | jpeg_size (usershape_t *us) |
static void | ps_size (usershape_t *us) |
static char | nxtc (stream_t *str) |
static void | skipWS (stream_t *str) |
static int | scanNum (char *tok, double *dp) |
static void | getNum (stream_t *str, char *buf) |
static int | boxof (stream_t *str, boxf *bp) |
static int | bboxPDF (FILE *fp, boxf *bp) |
static void | pdf_size (usershape_t *us) |
static void | usershape_close (void *p) |
usershape_t * | gvusershape_find (const char *name) |
bool | gvusershape_file_access (usershape_t *us) |
void | gvusershape_file_release (usershape_t *us) |
static void | freeUsershape (usershape_t *us) |
static usershape_t * | gvusershape_open (const char *name) |
point | gvusershape_size_dpi (usershape_t *us, pointf dpi) |
point | gvusershape_size (graph_t *g, char *name) |
Variables | |
char * | Gvimagepath |
char * | HTTPServerEnVar |
static Dict_t * | ImageDict |
static knowntype_t | knowntypes [] |
static Dtdisc_t | ImageDictDisc |
#define BMP_MAGIC "BM" |
Definition at line 59 of file gvusershape.c.
#define EPS_MAGIC "\xC5\xD0\xD3\xC6" |
Definition at line 63 of file gvusershape.c.
#define GIF_MAGIC "GIF8" |
Definition at line 60 of file gvusershape.c.
#define HDRLEN 20 |
Definition at line 55 of file gvusershape.c.
#define ICO_MAGIC "\x00\x00\x01\x00" |
Definition at line 68 of file gvusershape.c.
#define JPEG_MAGIC "\xFF\xD8\xFF" |
Definition at line 61 of file gvusershape.c.
#define KEY "/MediaBox" |
Definition at line 486 of file gvusershape.c.
#define MAX_USERSHAPE_FILES_OPEN 50 |
Definition at line 623 of file gvusershape.c.
#define PDF_MAGIC "%PDF-" |
Definition at line 62 of file gvusershape.c.
#define PNG_MAGIC "\x89PNG\x0D\x0A\x1A\x0A" |
Definition at line 57 of file gvusershape.c.
#define PS_MAGIC "%!PS-Adobe-" |
Definition at line 58 of file gvusershape.c.
#define RIFF_MAGIC "RIFF" |
Definition at line 66 of file gvusershape.c.
#define stradv | ( | x | ) | (x->s++) |
Definition at line 504 of file gvusershape.c.
Definition at line 503 of file gvusershape.c.
#define SVG_MAGIC "<svg" |
Definition at line 65 of file gvusershape.c.
#define WEBP_MAGIC "WEBP" |
Definition at line 67 of file gvusershape.c.
#define XML_MAGIC "<?xml" |
Definition at line 64 of file gvusershape.c.
|
static |
Definition at line 563 of file gvusershape.c.
References boxof(), KEY, and str.
Referenced by pdf_size().
|
static |
Definition at line 365 of file gvusershape.c.
References usershape_s::dpi, usershape_s::f, get_int_lsb_first(), usershape_s::h, and usershape_s::w.
Referenced by gvusershape_open().
Definition at line 544 of file gvusershape.c.
References getNum(), boxf::LL, scanNum(), skipWS(), str, stradv, strc, tok(), boxf::UR, pointf_s::x, and pointf_s::y.
Referenced by bboxPDF().
|
static |
Definition at line 195 of file gvusershape.c.
References strview_t::data, match_t::key, strview_t::size, and match_t::value.
Referenced by svg_size().
|
extern |
Definition at line 3962 of file shapes.c.
Referenced by gvusershape_open(), and user_shape().
|
static |
Definition at line 664 of file gvusershape.c.
References agstrfree(), free(), and usershape_s::name.
Referenced by gvusershape_open().
|
static |
Definition at line 139 of file gvusershape.c.
Referenced by bmp_size(), gif_size(), and webp_size().
|
static |
Definition at line 156 of file gvusershape.c.
Referenced by ico_size(), jpeg_size(), and png_size().
|
static |
Definition at line 528 of file gvusershape.c.
References gv_isdigit(), len(), skipWS(), str, stradv, and strc.
Referenced by boxof().
|
static |
Definition at line 353 of file gvusershape.c.
References usershape_s::dpi, usershape_s::f, get_int_lsb_first(), usershape_s::h, and usershape_s::w.
Referenced by gvusershape_open().
void gvusershape_file_release | ( | usershape_t * | us | ) |
Definition at line 654 of file gvusershape.c.
References usershape_s::f, usershape_s::nocache, and NULL.
Referenced by cairo_loadimage(), core_loadimage_ps(), gd_loadimage(), gdiplus_loadimage(), gvloadimage_rsvg_load(), gvusershape_open(), lasi_loadimage_ps(), and quartz_loadimage().
usershape_t * gvusershape_find | ( | const char * | name | ) |
Definition at line 609 of file gvusershape.c.
References dtmatch, ImageDict, and NULL.
Referenced by gvrender_usershape(), and gvusershape_open().
|
static |
Definition at line 670 of file gvusershape.c.
References agstrdup(), agwarningf(), bmp_size(), usershape_s::data, dtinsert, dtopen(), Dttree, usershape_s::f, find_user_shape(), freeUsershape(), FT_BMP, FT_EPS, FT_GIF, FT_ICO, FT_JPEG, FT_NULL, FT_PDF, FT_PNG, FT_PS, FT_SVG, FT_WEBP, gif_size(), gv_alloc(), gvusershape_file_access(), gvusershape_file_release(), gvusershape_find(), ico_size(), ImageDict, ImageDictDisc, imagetype(), jpeg_size(), usershape_s::name, NULL, pdf_size(), png_size(), ps_size(), svg_size(), and webp_size().
Referenced by gvusershape_size().
Definition at line 762 of file gvusershape.c.
References dtclose(), GD_drawing, Gvimagepath, gvusershape_open(), gvusershape_size_dpi(), HTTPServerEnVar, ImageDict, NULL, point::x, pointf_s::x, point::y, and pointf_s::y.
Referenced by poly_init(), and size_html_img().
point gvusershape_size_dpi | ( | usershape_t * | us, |
pointf | dpi | ||
) |
Definition at line 741 of file gvusershape.c.
References usershape_s::dpi, usershape_s::h, POINTS_PER_INCH, usershape_s::w, point::x, pointf_s::x, point::y, and pointf_s::y.
Referenced by gvrender_usershape(), and gvusershape_size().
|
static |
Definition at line 319 of file gvusershape.c.
References usershape_s::dpi, usershape_s::f, get_int_msb_first(), usershape_s::h, and usershape_s::w.
Referenced by gvusershape_open().
|
static |
Definition at line 83 of file gvusershape.c.
References usershape_s::f, FT_NULL, FT_RIFF, FT_SVG, FT_WEBP, FT_XML, HDRLEN, knowntypes, NULL, usershape_s::stringtype, knowntype_t::stringtype, SVG_MAGIC, usershape_s::type, knowntype_t::type, and WEBP_MAGIC.
Referenced by gvusershape_open().
|
static |
Definition at line 379 of file gvusershape.c.
References usershape_s::dpi, usershape_s::f, get_int_msb_first(), usershape_s::h, and usershape_s::w.
Referenced by gvusershape_open().
|
static |
Definition at line 494 of file gvusershape.c.
References stream_t::s, and str.
|
static |
Definition at line 579 of file gvusershape.c.
References bboxPDF(), usershape_s::dpi, usershape_s::f, usershape_s::h, boxf::LL, boxf::UR, usershape_s::w, pointf_s::x, usershape_s::x, pointf_s::y, and usershape_s::y.
Referenced by gvusershape_open().
|
static |
Definition at line 307 of file gvusershape.c.
References usershape_s::dpi, usershape_s::f, get_int_msb_first(), usershape_s::h, and usershape_s::w.
Referenced by gvusershape_open().
|
static |
Definition at line 453 of file gvusershape.c.
References usershape_s::dpi, usershape_s::f, usershape_s::h, usershape_s::w, usershape_s::x, and usershape_s::y.
Referenced by gvusershape_open().
|
static |
Definition at line 517 of file gvusershape.c.
References tok().
Referenced by boxof().
|
static |
Definition at line 507 of file gvusershape.c.
References gv_isspace(), str, stradv, and strc.
Referenced by boxof(), and getNum().
|
static |
Definition at line 229 of file gvusershape.c.
References agxbfree(), agxbputc(), agxbuse(), strview_t::data, usershape_s::dpi, usershape_s::f, find_attribute(), free(), usershape_s::h, match(), strview_str(), strview_str_eq(), svg_units_convert(), match_t::value, and usershape_s::w.
Referenced by gvusershape_open().
|
static |
Definition at line 174 of file gvusershape.c.
References POINTS_PER_CM, POINTS_PER_INCH, and POINTS_PER_MM.
Referenced by svg_size().
|
static |
Definition at line 593 of file gvusershape.c.
References usershape_s::data, usershape_s::datafree, usershape_s::f, and free().
|
static |
Definition at line 331 of file gvusershape.c.
References usershape_s::dpi, usershape_s::f, get_int_lsb_first(), usershape_s::h, and usershape_s::w.
Referenced by gvusershape_open().
|
extern |
Definition at line 48 of file globals.h.
Referenced by graph_init(), gvusershape_size(), and safefile().
|
extern |
Definition at line 52 of file globals.h.
Referenced by dotneato_args_initialize(), graph_init(), gvusershape_size(), and safefile().
|
static |
Definition at line 46 of file gvusershape.c.
Referenced by gvusershape_find(), gvusershape_open(), and gvusershape_size().
|
static |
Definition at line 603 of file gvusershape.c.
Referenced by gvusershape_open().
|
static |