Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
gvplugin_vt.c File Reference

Device that renders using ANSI terminal colors. More...

#include <assert.h>
#include <gvc/gvplugin.h>
#include <gvc/gvplugin_device.h>
#include <limits.h>
#include <stddef.h>
#include <gvc/gvio.h>
Include dependency graph for gvplugin_vt.c:

Go to the source code of this file.

Data Structures

struct  color_t
 an ANSI color More...
 

Macros

#define GVPLUGIN_VT_API
 

Functions

static unsigned distance (const color_t base, unsigned red, unsigned green, unsigned blue)
 a metric of “closeness” to a given color
 
static unsigned get_color (unsigned red, unsigned green, unsigned blue)
 find closest ANSI color
 
static void process (GVJ_t *job, int color_depth)
 
static void process3 (GVJ_t *job)
 
static void process24 (GVJ_t *job)
 

Variables

static const color_t COLORS []
 ANSI 3-bit colors.
 
static gvdevice_engine_t engine3
 
static gvdevice_engine_t engine24
 
static gvdevice_features_t device_features
 
static gvplugin_installed_t device_types []
 
static gvplugin_api_t apis []
 
GVPLUGIN_VT_API gvplugin_library_t gvplugin_vt_LTX_library = {"vt", apis}
 

Macro Definition Documentation

◆ GVPLUGIN_VT_API

#define GVPLUGIN_VT_API

Definition at line 146 of file gvplugin_vt.c.

Function Documentation

◆ distance()

static unsigned distance ( const color_t  base,
unsigned  red,
unsigned  green,
unsigned  blue 
)
static

Definition at line 34 of file gvplugin_vt.c.

References color_t::blue, color_t::green, and color_t::red.

Referenced by get_color().

Here is the caller graph for this function:

◆ get_color()

static unsigned get_color ( unsigned  red,
unsigned  green,
unsigned  blue 
)
static

Definition at line 44 of file gvplugin_vt.c.

References COLORS, distance(), and color_t::value.

Referenced by process().

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

◆ process()

static void process ( GVJ_t job,
int  color_depth 
)
static

Definition at line 57 of file gvplugin_vt.c.

References get_color(), gvprintf(), GVJ_s::height, GVJ_s::imagedata, offset, and GVJ_s::width.

Referenced by process24(), and process3().

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

◆ process24()

static void process24 ( GVJ_t job)
static

Definition at line 118 of file gvplugin_vt.c.

References process().

Here is the call graph for this function:

◆ process3()

static void process3 ( GVJ_t job)
static

Definition at line 116 of file gvplugin_vt.c.

References process().

Here is the call graph for this function:

Variable Documentation

◆ apis

gvplugin_api_t apis[]
static
Initial value:
= {
{API_device, device_types},
{(api_t)0, 0},
}
api_t
Definition gvcext.h:32
static gvplugin_installed_t device_types[]

Definition at line 138 of file gvplugin_vt.c.

◆ COLORS

const color_t COLORS[]
static
Initial value:
= {
{0, 0x00, 0x00, 0x00},
{1, 0xff, 0x00, 0x00},
{2, 0x00, 0xff, 0x00},
{3, 0xff, 0xff, 0x00},
{4, 0x00, 0x00, 0xff},
{5, 0xff, 0x00, 0xff},
{6, 0x00, 0xff, 0xff},
{7, 0xff, 0xff, 0xff},
}

Definition at line 22 of file gvplugin_vt.c.

Referenced by get_color().

◆ device_features

gvdevice_features_t device_features
static
Initial value:
= {
.default_dpi = {96, 96},
}

Definition at line 128 of file gvplugin_vt.c.

◆ device_types

gvplugin_installed_t device_types[]
static
Initial value:
= {
{8, "vt:cairo", 0, &engine3, &device_features},
{1 << 24, "vt-24bit:cairo", 0, &engine24, &device_features},
{0},
}
static gvdevice_features_t device_features
static gvdevice_engine_t engine24
static gvdevice_engine_t engine3

Definition at line 132 of file gvplugin_vt.c.

◆ engine24

gvdevice_engine_t engine24
static
Initial value:
= {
.format = process24,
}
static void process24(GVJ_t *job)

Definition at line 124 of file gvplugin_vt.c.

◆ engine3

gvdevice_engine_t engine3
static
Initial value:
= {
.format = process3,
}
static void process3(GVJ_t *job)

Definition at line 120 of file gvplugin_vt.c.

◆ gvplugin_vt_LTX_library

GVPLUGIN_VT_API gvplugin_library_t gvplugin_vt_LTX_library = {"vt", apis}

Definition at line 149 of file gvplugin_vt.c.