Graphviz 14.1.5~dev.20260409.1203
Loading...
Searching...
No Matches
gvrender_core_pic.c File Reference
#include "config.h"
#include <math.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <gvc/gvplugin_render.h>
#include <gvc/gvplugin_device.h>
#include <gvc/gvio.h>
#include <common/utils.h>
#include <common/color.h>
#include <common/colorprocs.h>
#include <common/const.h>
#include <util/agxbuf.h>
#include <util/gv_math.h>
#include <util/strview.h>
Include dependency graph for gvrender_core_pic.c:

Go to the source code of this file.

Data Structures

struct  fontinfo
 
struct  font_t
 font characteristics More...
 

Macros

#define BEZIERSUBDIVISION   6
 

Enumerations

enum  { FORMAT_PIC }
 

Functions

static double get_fontscale (const GVJ_t *job, double *height, double *width)
 
static void unsupported (char *s)
 
static const void * memrchr (const void *s, int c, size_t n)
 
static const char * picfontname (strview_t psname)
 
static void picptarray (GVJ_t *job, pointf *A, size_t n, int close)
 
static void pic_comment (GVJ_t *job, char *str)
 
static void pic_begin_graph (GVJ_t *job)
 
static void pic_end_graph (GVJ_t *job)
 
static void pic_begin_page (GVJ_t *job)
 
static void pic_end_page (GVJ_t *job)
 
static bool font_name_eq (const font_t *font, const char *name)
 does a font have the given name?
 
static bool font_size_eq (const font_t *font, double size)
 does a font have the given size?
 
static void pic_textspan (GVJ_t *job, pointf p, textspan_t *span)
 
static void pic_ellipse (GVJ_t *job, pointf *A, int filled)
 
static void pic_bezier (GVJ_t *job, pointf *A, size_t n, int filled)
 
static void pic_polygon (GVJ_t *job, pointf *A, size_t n, int filled)
 
static void pic_polyline (GVJ_t *job, pointf *A, size_t n)
 

Variables

static const char pic_comments [] = "# "
 
static const char troff_comments [] = ".\\\" "
 
static const char picgen_msghdr [] = "dot pic plugin: "
 
static const fontinfo fonttab []
 
static const size_t fonttab_size = sizeof(fonttab) / sizeof(fonttab[0])
 
static gvrender_engine_t pic_engine
 
static gvrender_features_t render_features_pic
 
static gvdevice_features_t device_features_pic
 
gvplugin_installed_t gvrender_pic_types []
 
gvplugin_installed_t gvdevice_pic_types []
 

Macro Definition Documentation

◆ BEZIERSUBDIVISION

#define BEZIERSUBDIVISION   6

Definition at line 33 of file gvrender_core_pic.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FORMAT_PIC 

Definition at line 35 of file gvrender_core_pic.c.

Function Documentation

◆ font_name_eq()

static bool font_name_eq ( const font_t font,
const char *  name 
)
static

Definition at line 321 of file gvrender_core_pic.c.

References font, and NULL.

Referenced by pic_textspan().

Here is the caller graph for this function:

◆ font_size_eq()

static bool font_size_eq ( const font_t font,
double  size 
)
static

Definition at line 333 of file gvrender_core_pic.c.

References font, and NULL.

Referenced by pic_textspan().

Here is the caller graph for this function:

◆ get_fontscale()

static double get_fontscale ( const GVJ_t job,
double *  height,
double *  width 
)
static

derive the scale factor to apply to fonts

Parameters
jobJob being processed
height[out] Bounding box height
width[out] Bounding box width
Returns
Font scale to apply

Definition at line 43 of file gvrender_core_pic.c.

References box::LL, NULL, GVJ_s::pageBoundingBox, PS2INCH, GVJ_s::rotation, SWAP, box::UR, point::x, and point::y.

Referenced by pic_begin_page(), and pic_textspan().

Here is the caller graph for this function:

◆ memrchr()

static const void * memrchr ( const void *  s,
int  c,
size_t  n 
)
static

Definition at line 140 of file gvrender_core_pic.c.

References NULL, SIZE_MAX, and str.

Referenced by picfontname().

Here is the caller graph for this function:

◆ pic_begin_graph()

static void pic_begin_graph ( GVJ_t job)
static

Definition at line 186 of file gvrender_core_pic.c.

References agnameof(), GVJ_s::common, obj_state_s::g, gvprintf(), GVCOMMON_s::info, GVJ_s::obj, troff_comments, and obj_state_s::u.

Here is the call graph for this function:

◆ pic_begin_page()

static void pic_begin_page ( GVJ_t job)
static

Definition at line 219 of file gvrender_core_pic.c.

References get_fontscale(), gvprintf(), pic_comments, GVJ_s::rotation, and unsupported().

Here is the call graph for this function:

◆ pic_bezier()

static void pic_bezier ( GVJ_t job,
pointf A,
size_t  n,
int  filled 
)
static

Definition at line 404 of file gvrender_core_pic.c.

References A, Bezier(), BEZIERSUBDIVISION, gvprintf(), gvputs(), NULL, V, and pointf_s::x.

Here is the call graph for this function:

◆ pic_comment()

static void pic_comment ( GVJ_t job,
char *  str 
)
static

Definition at line 181 of file gvrender_core_pic.c.

References gvprintf(), pic_comments, and str.

Here is the call graph for this function:

◆ pic_ellipse()

static void pic_ellipse ( GVJ_t job,
pointf A,
int  filled 
)
static

Definition at line 391 of file gvrender_core_pic.c.

References A, gvprintf(), and PS2INCH.

Here is the call graph for this function:

◆ pic_end_graph()

static void pic_end_graph ( GVJ_t job)
static

Definition at line 204 of file gvrender_core_pic.c.

References free(), gvprintf(), font_t::name, NULL, troff_comments, and GVJ_s::window.

Here is the call graph for this function:

◆ pic_end_page()

static void pic_end_page ( GVJ_t job)
static

Definition at line 314 of file gvrender_core_pic.c.

References gvprintf().

Here is the call graph for this function:

◆ pic_polygon()

static void pic_polygon ( GVJ_t job,
pointf A,
size_t  n,
int  filled 
)
static

Definition at line 429 of file gvrender_core_pic.c.

References A, and picptarray().

Here is the call graph for this function:

◆ pic_polyline()

static void pic_polyline ( GVJ_t job,
pointf A,
size_t  n 
)
static

Definition at line 434 of file gvrender_core_pic.c.

References A, and picptarray().

Here is the call graph for this function:

◆ pic_textspan()

static void pic_textspan ( GVJ_t job,
pointf  p,
textspan_t span 
)
static

Definition at line 340 of file gvrender_core_pic.c.

References textspan_t::font, font_name_eq(), font_size_eq(), free(), get_fontscale(), gvprintf(), gvputc(), gvputs_nonascii(), textspan_t::just, textfont_t::name, font_t::name, NULL, picfontname(), POINTS_PER_INCH, textfont_t::size, textspan_t::size, font_t::size, textspan_t::str, strview(), GVJ_s::window, pointf_s::x, and pointf_s::y.

Here is the call graph for this function:

◆ picfontname()

static const char * picfontname ( strview_t  psname)
static

Definition at line 151 of file gvrender_core_pic.c.

References agerrorf(), strview_t::data, fonttab, fonttab_size, memrchr(), NULL, picfontname(), picgen_msghdr, prefix, strview_t::size, strview_str_eq(), and fontinfo::trname.

Referenced by pic_textspan(), and picfontname().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ picptarray()

static void picptarray ( GVJ_t job,
pointf A,
size_t  n,
int  close 
)
static

Definition at line 167 of file gvrender_core_pic.c.

References A, gvprintf(), and gvputs().

Referenced by pic_polygon(), and pic_polyline().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unsupported()

static void unsupported ( char *  s)
static

Definition at line 90 of file gvrender_core_pic.c.

References agwarningf(), and picgen_msghdr.

Referenced by pic_begin_page().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ device_features_pic

gvdevice_features_t device_features_pic
static
Initial value:
= {
0,
{0.,0.},
{0.,0.},
{72.,72.},
}

Definition at line 480 of file gvrender_core_pic.c.

◆ fonttab

const fontinfo fonttab[]
static

Definition at line 100 of file gvrender_core_pic.c.

Referenced by picfontname().

◆ fonttab_size

const size_t fonttab_size = sizeof(fonttab) / sizeof(fonttab[0])
static

Definition at line 135 of file gvrender_core_pic.c.

Referenced by picfontname().

◆ gvdevice_pic_types

gvplugin_installed_t gvdevice_pic_types[]
Initial value:
= {
{FORMAT_PIC, "pic:pic", -1, NULL, &device_features_pic},
{0, NULL, 0, NULL, NULL}
}
node NULL
Definition grammar.y:181
@ FORMAT_PIC
static gvdevice_features_t device_features_pic

Definition at line 492 of file gvrender_core_pic.c.

◆ gvrender_pic_types

gvplugin_installed_t gvrender_pic_types[]
Initial value:
= {
{0, NULL, 0, NULL, NULL}
}
static gvrender_engine_t pic_engine
static gvrender_features_t render_features_pic

Definition at line 487 of file gvrender_core_pic.c.

◆ pic_comments

const char pic_comments[] = "# "
static

Definition at line 86 of file gvrender_core_pic.c.

Referenced by pic_begin_page(), and pic_comment().

◆ pic_engine

gvrender_engine_t pic_engine
static

Definition at line 438 of file gvrender_core_pic.c.

◆ picgen_msghdr

const char picgen_msghdr[] = "dot pic plugin: "
static

Definition at line 88 of file gvrender_core_pic.c.

Referenced by picfontname(), and unsupported().

◆ render_features_pic

gvrender_features_t render_features_pic
static
Initial value:
= {
0,
4.,
NULL,
0,
}
@ HSVA_DOUBLE
Definition color.h:26

Definition at line 472 of file gvrender_core_pic.c.

◆ troff_comments

const char troff_comments[] = ".\\\" "
static

Definition at line 87 of file gvrender_core_pic.c.

Referenced by pic_begin_graph(), and pic_end_graph().