Graphviz 14.1.4~dev.20260320.0055
Loading...
Searching...
No Matches
gvplugin_ascii.c File Reference

Device that renders to ASCII art. More...

#include "config.h"
#include <aalib.h>
#include <assert.h>
#include <gvc/gvplugin.h>
#include <gvc/gvplugin_device.h>
#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
#include <util/gv_math.h>
Include dependency graph for gvplugin_ascii.c:

Go to the source code of this file.

Macros

#define GVPLUGIN_ASCII_API
 

Functions

static int rgb_to_grayscale (unsigned red, unsigned green, unsigned blue)
 convert an RGB color to grayscale
 
static bool is_space (const unsigned char *base, size_t size)
 does the given range only contain space characters?
 
static void process (GVJ_t *job)
 

Variables

static gvdevice_engine_t engine
 
static gvdevice_features_t device_features
 
static gvplugin_installed_t device_types []
 
static gvplugin_api_t apis [] = {{API_device, device_types}, {0}}
 
GVPLUGIN_ASCII_API gvplugin_library_t gvplugin_ascii_LTX_library
 

Detailed Description

This device does not attempt to examine your terminal dimensions. It simply assumes you want output of the dimensions of the renderer graph.

Definition in file gvplugin_ascii.c.

Macro Definition Documentation

◆ GVPLUGIN_ASCII_API

#define GVPLUGIN_ASCII_API

Definition at line 132 of file gvplugin_ascii.c.

Function Documentation

◆ is_space()

static bool is_space ( const unsigned char *  base,
size_t  size 
)
static

Definition at line 34 of file gvplugin_ascii.c.

References NULL.

Referenced by process().

Here is the caller graph for this function:

◆ process()

static void process ( GVJ_t job)
static

Definition at line 45 of file gvplugin_ascii.c.

References agerrorf(), BYTES_PER_PIXEL, GVJ_s::height, GVJ_s::imagedata, is_space(), NULL, rgb_to_grayscale(), and GVJ_s::width.

Here is the call graph for this function:

◆ rgb_to_grayscale()

static int rgb_to_grayscale ( unsigned  red,
unsigned  green,
unsigned  blue 
)
static

use “perceptual” scaling, https://en.wikipedia.org/wiki/Grayscale#Colorimetric_(perceptual_luminance-preserving)_conversion_to_grayscale

Definition at line 19 of file gvplugin_ascii.c.

Referenced by process().

Here is the caller graph for this function:

Variable Documentation

◆ apis

gvplugin_api_t apis[] = {{API_device, device_types}, {0}}
static

Definition at line 127 of file gvplugin_ascii.c.

Referenced by gvconfig_plugin_install_from_library(), and gvplugin_load().

◆ device_features

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

Definition at line 118 of file gvplugin_ascii.c.

◆ device_types

gvplugin_installed_t device_types[]
static
Initial value:
= {
{1, "ascii:cairo", 0, &engine, &device_features},
{0},
}
static gvdevice_features_t device_features
static gvdevice_engine_t engine

Definition at line 122 of file gvplugin_ascii.c.

◆ engine

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

Definition at line 114 of file gvplugin_ascii.c.

Referenced by gvLayout(), layout(), and tcldot_layout().

◆ gvplugin_ascii_LTX_library

GVPLUGIN_ASCII_API gvplugin_library_t gvplugin_ascii_LTX_library
Initial value:
= {"ascii",
static gvplugin_api_t apis[]

Definition at line 135 of file gvplugin_ascii.c.