Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
gvrender_gd.c File Reference
#include "config.h"
#include "gdioctx_wrapper.h"
#include "gdgen_text.h"
#include "gd_psfontResolve.h"
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <fcntl.h>
#include <gvc/gvplugin_render.h>
#include <gvc/gvplugin_device.h>
#include <gvc/gvcint.h>
#include <gd.h>
#include <gdfontt.h>
#include <gdfonts.h>
#include <gdfontmb.h>
#include <gdfontl.h>
#include <gdfontg.h>
#include <util/alloc.h>
#include <util/unreachable.h>
Include dependency graph for gvrender_gd.c:

Go to the source code of this file.

Macros

#define BEZIERSUBDIVISION   10
 
#define GD_XYMAX   INT32_MAX
 
#define FONTSIZE_MUCH_TOO_SMALL   0.15
 
#define FONTSIZE_TOO_SMALL   1.5
 

Enumerations

enum  format_type {
  FORMAT_GIF , FORMAT_JPEG , FORMAT_PNG , FORMAT_WBMP ,
  FORMAT_GD , FORMAT_GD2 , FORMAT_XBM
}
 

Functions

bool mapbool (const char *)
 
pointf Bezier (pointf *V, double t, pointf *Left, pointf *Right)
 
static void gdgen_resolve_color (GVJ_t *job, gvcolor_t *color)
 
static void gdgen_begin_page (GVJ_t *job)
 
static void gdgen_end_page (GVJ_t *job)
 
void gdgen_text (gdImagePtr im, pointf spf, pointf epf, int fontcolor, double fontsize, int fontdpi, double fontangle, char *fontname, char *str)
 
static void gdgen_textspan (GVJ_t *job, pointf p, textspan_t *span)
 
static int gdgen_set_penstyle (GVJ_t *job, gdImagePtr im, gdImagePtr *brush)
 
static void gdgen_bezier (GVJ_t *job, pointf *A, size_t n, int filled)
 
static void gdgen_polygon (GVJ_t *job, pointf *A, size_t n, int filled)
 
static void gdgen_ellipse (GVJ_t *job, pointf *A, int filled)
 
static void gdgen_polyline (GVJ_t *job, pointf *A, size_t n)
 

Variables

static int transparent
 
static int basecolor
 
static gdPoint * points
 
static size_t points_allocated
 
static gvrender_engine_t gdgen_engine
 
static gvrender_features_t render_features_gd
 
static gvdevice_features_t device_features_gd_tc_no_writer
 
gvplugin_installed_t gvrender_gd_types []
 
gvplugin_installed_t gvdevice_gd_types2 []
 

Macro Definition Documentation

◆ BEZIERSUBDIVISION

#define BEZIERSUBDIVISION   10

Definition at line 48 of file gvrender_gd.c.

◆ FONTSIZE_MUCH_TOO_SMALL

#define FONTSIZE_MUCH_TOO_SMALL   0.15

Definition at line 242 of file gvrender_gd.c.

◆ FONTSIZE_TOO_SMALL

#define FONTSIZE_TOO_SMALL   1.5

Definition at line 244 of file gvrender_gd.c.

◆ GD_XYMAX

#define GD_XYMAX   INT32_MAX

Definition at line 74 of file gvrender_gd.c.

Enumeration Type Documentation

◆ format_type

Enumerator
FORMAT_GIF 
FORMAT_JPEG 
FORMAT_PNG 
FORMAT_WBMP 
FORMAT_GD 
FORMAT_GD2 
FORMAT_XBM 

Definition at line 35 of file gvrender_gd.c.

Function Documentation

◆ Bezier()

pointf Bezier ( pointf V,
double  t,
pointf Left,
pointf Right 
)
extern

Definition at line 168 of file utils.c.

References NULL, V, W_DEGREE, pointf_s::x, and pointf_s::y.

Referenced by approx_bezier(), arrow_type_curve(), bezier_clip(), dotneato_closest(), fig_bezier(), findHorizontal(), findVertical(), gdgen_bezier(), pathtolines(), pic_bezier(), place_portlabel(), splineIntersectf(), splitBSpline(), and update_bb_bz().

Here is the caller graph for this function:

◆ gdgen_begin_page()

static void gdgen_begin_page ( GVJ_t job)
static

Definition at line 76 of file gvrender_gd.c.

References agget(), GVCOMMON_s::cmdname, GVJ_s::common, GVJ_s::context, GVCOMMON_s::errorfn, GVJ_s::external_context, gvplugin_active_render_s::features, gvrender_features_t::flags, GVC_s::g, GD_has_images, GD_XYMAX, GVJ_s::gvc, GVDEVICE_DOES_TRUECOLOR, GVJ_s::height, mapbool(), NULL, GVJ_s::render, scale(), transparent, GVCOMMON_s::verbose, GVJ_s::width, and GVJ_s::zoom.

Here is the call graph for this function:

◆ gdgen_bezier()

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

Definition at line 407 of file gvrender_gd.c.

References A, Bezier(), BEZIERSUBDIVISION, GVJ_s::context, F, obj_state_s::fillcolor, gdgen_set_penstyle(), color_s::index, NULL, GVJ_s::obj, PF2P, color_s::u, and V.

Here is the call graph for this function:

◆ gdgen_ellipse()

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

Definition at line 485 of file gvrender_gd.c.

References A, GVJ_s::context, dx, dy, obj_state_s::fillcolor, gdgen_set_penstyle(), color_s::index, NULL, GVJ_s::obj, ROUND, and color_s::u.

Here is the call graph for this function:

◆ gdgen_end_page()

static void gdgen_end_page ( GVJ_t job)
static

Definition at line 154 of file gvrender_gd.c.

References basecolor, black, GVJ_s::context, gd_context_t::ctx, GVJ_s::external_context, FORMAT_GD, FORMAT_GD2, FORMAT_GIF, FORMAT_JPEG, FORMAT_PNG, FORMAT_WBMP, FORMAT_XBM, gvdevice_gd_putBuf(), gvdevice_gd_putC(), gvplugin_active_render_s::id, gd_context_t::job, NULL, GVJ_s::output_file, GVJ_s::render, transparent, and UNREACHABLE.

Here is the call graph for this function:

◆ gdgen_polygon()

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

Definition at line 451 of file gvrender_gd.c.

References A, GVJ_s::context, obj_state_s::fillcolor, gdgen_set_penstyle(), gv_recalloc(), color_s::index, NULL, GVJ_s::obj, points, points_allocated, ROUND, and color_s::u.

Here is the call graph for this function:

◆ gdgen_polyline()

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

Definition at line 515 of file gvrender_gd.c.

References A, GVJ_s::context, gdgen_set_penstyle(), NULL, ROUND, pointf_s::x, and pointf_s::y.

Here is the call graph for this function:

◆ gdgen_resolve_color()

static void gdgen_resolve_color ( GVJ_t job,
gvcolor_t color 
)
static

Definition at line 50 of file gvrender_gd.c.

References alpha, color(), COLOR_INDEX, and GVJ_s::context.

Here is the call graph for this function:

◆ gdgen_set_penstyle()

static int gdgen_set_penstyle ( GVJ_t job,
gdImagePtr  im,
gdImagePtr *  brush 
)
static

Definition at line 359 of file gvrender_gd.c.

References color_s::index, GVJ_s::obj, obj_state_s::pen, PEN_DASHED, PEN_DOTTED, obj_state_s::pencolor, obj_state_s::penwidth, PENWIDTH_NORMAL, color_s::u, and GVJ_s::zoom.

Referenced by gdgen_bezier(), gdgen_ellipse(), gdgen_polygon(), and gdgen_polyline().

Here is the caller graph for this function:

◆ gdgen_text()

void gdgen_text ( gdImagePtr  im,
pointf  spf,
pointf  epf,
int  fontcolor,
double  fontsize,
int  fontdpi,
double  fontangle,
char *  fontname,
char *  str 
)

Definition at line 246 of file gvrender_gd.c.

References err, font, FONTSIZE_MUCH_TOO_SMALL, FONTSIZE_TOO_SMALL, free(), PF2P, str, point::x, and point::y.

Referenced by gdgen_textspan().

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

◆ gdgen_textspan()

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

Definition at line 304 of file gvrender_gd.c.

References GVJ_s::context, GVJ_s::dpi, textspan_t::font, gd_psfontResolve(), gdgen_text(), color_s::index, textspan_t::just, M_PI, textfont_t::name, GVJ_s::obj, obj_state_s::pencolor, POINTS_PER_INCH, textfont_t::postscript_alias, GVJ_s::rotation, textfont_t::size, textspan_t::size, textspan_t::str, color_s::u, pointf_s::x, pointf_s::y, textspan_t::yoffset_centerline, and GVJ_s::zoom.

Here is the call graph for this function:

◆ mapbool()

bool mapbool ( const char *  p)
extern

Definition at line 335 of file utils.c.

References mapBool().

Referenced by angleSet(), circularLayout(), common_init_edge(), dot_mincross(), dot_rank(), dotLayout(), emit_begin_edge(), emit_end_edge(), findRootNode(), gdgen_begin_page(), getAdjustMode(), graph_init(), init_nop(), initialPositions(), is_a_cluster(), is_a_strong_cluster(), is_nonconstraint(), late_bool(), majorization(), neato_layout(), noClip(), nonconstraint_edge(), poly_init(), record_init(), tuneControl(), user_pos(), and visible().

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

Variable Documentation

◆ basecolor

int basecolor
static

Definition at line 72 of file gvrender_gd.c.

Referenced by gdgen_end_page().

◆ device_features_gd_tc_no_writer

gvdevice_features_t device_features_gd_tc_no_writer
static
Initial value:
= {
{0.,0.},
{0.,0.},
{96.,96.},
}
#define GVDEVICE_NO_WRITER
Definition gvcjob.h:93
#define GVDEVICE_DOES_TRUECOLOR
Definition gvcjob.h:90
#define GVDEVICE_BINARY_FORMAT
Definition gvcjob.h:91

Definition at line 601 of file gvrender_gd.c.

◆ gdgen_engine

gvrender_engine_t gdgen_engine
static

Definition at line 541 of file gvrender_gd.c.

◆ gvdevice_gd_types2

gvplugin_installed_t gvdevice_gd_types2[]
Initial value:
= {
{0, NULL, 0, NULL, NULL}
}
node NULL
Definition grammar.y:163
static gvdevice_features_t device_features_gd_tc_no_writer
@ FORMAT_GD
Definition gvrender_gd.c:40

Definition at line 615 of file gvrender_gd.c.

◆ gvrender_gd_types

gvplugin_installed_t gvrender_gd_types[]
Initial value:
= {
{0, NULL, 0, NULL, NULL}
}
static gvrender_features_t render_features_gd
static gvrender_engine_t gdgen_engine

Definition at line 610 of file gvrender_gd.c.

◆ points

◆ points_allocated

size_t points_allocated
static

Definition at line 449 of file gvrender_gd.c.

Referenced by gdgen_polygon().

◆ render_features_gd

gvrender_features_t render_features_gd
static
Initial value:
= {
4.,
NULL,
0,
}
@ RGBA_BYTE
Definition color.h:26
#define GVRENDER_Y_GOES_DOWN
Definition gvcjob.h:94

Definition at line 574 of file gvrender_gd.c.

◆ transparent

int transparent
static

Definition at line 72 of file gvrender_gd.c.

Referenced by gdgen_begin_page(), and gdgen_end_page().