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>
Go to the source code of this file.
|
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) |
|
static unsigned | rgb_to_grayscale (unsigned red, unsigned green, unsigned blue) |
| convert an RGB color to grayscale
|
|
static void | processNup (GVJ_t *job, unsigned y_stride, unsigned x_stride, const char **tiles) |
|
static void | process4up (GVJ_t *job) |
| draw a 4-pixels-per-character monochrome image
|
|
static void | process6up (GVJ_t *job) |
| draw a 6-pixels-per-character monochrome image
|
|
static void | process8up (GVJ_t *job) |
| draw a 8-pixels-per-character monochrome image
|
|
◆ GVPLUGIN_VT_API
◆ distance()
static unsigned distance |
( |
const color_t |
base, |
|
|
unsigned |
red, |
|
|
unsigned |
green, |
|
|
unsigned |
blue |
|
) |
| |
|
static |
◆ get_color()
static unsigned get_color |
( |
unsigned |
red, |
|
|
unsigned |
green, |
|
|
unsigned |
blue |
|
) |
| |
|
static |
◆ process()
static void process |
( |
GVJ_t * |
job, |
|
|
int |
color_depth |
|
) |
| |
|
static |
◆ process24()
static void process24 |
( |
GVJ_t * |
job | ) |
|
|
static |
◆ process3()
static void process3 |
( |
GVJ_t * |
job | ) |
|
|
static |
◆ process4up()
static void process4up |
( |
GVJ_t * |
job | ) |
|
|
static |
◆ process6up()
static void process6up |
( |
GVJ_t * |
job | ) |
|
|
static |
◆ process8up()
static void process8up |
( |
GVJ_t * |
job | ) |
|
|
static |
◆ processNup()
static void processNup |
( |
GVJ_t * |
job, |
|
|
unsigned |
y_stride, |
|
|
unsigned |
x_stride, |
|
|
const char ** |
tiles |
|
) |
| |
|
static |
draw a y_stride×x_stride-pixels-per-character monochrome image
- Parameters
-
job | GVC job to operate on |
y_stride | How many Y pixels fit in a character |
x_stride | How many X pixels fit in a character |
tiles | In-order list of characters for each representation |
Definition at line 141 of file gvplugin_vt.c.
References BPP, gvputc(), gvputs(), GVJ_s::height, GVJ_s::imagedata, NULL, offset, rgb_to_grayscale(), and GVJ_s::width.
Referenced by process4up(), process6up(), and process8up().
◆ rgb_to_grayscale()
static unsigned rgb_to_grayscale |
( |
unsigned |
red, |
|
|
unsigned |
green, |
|
|
unsigned |
blue |
|
) |
| |
|
static |
◆ apis
Initial value:= {
}
static gvplugin_installed_t device_types[]
Definition at line 275 of file gvplugin_vt.c.
◆ BPP
◆ COLORS
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
Initial value:= {
.default_dpi = {96, 96},
}
Definition at line 262 of file gvplugin_vt.c.
◆ device_types
Initial value:= {
{0},
}
static gvdevice_engine_t engine8up
static gvdevice_features_t device_features
static gvdevice_engine_t engine24
static gvdevice_engine_t engine3
static gvdevice_engine_t engine4up
static gvdevice_engine_t engine6up
Definition at line 266 of file gvplugin_vt.c.
◆ engine24
Initial value:= {
}
static void process24(GVJ_t *job)
Definition at line 246 of file gvplugin_vt.c.
◆ engine3
Initial value:= {
}
static void process3(GVJ_t *job)
Definition at line 242 of file gvplugin_vt.c.
◆ engine4up
Initial value:= {
}
static void process4up(GVJ_t *job)
draw a 4-pixels-per-character monochrome image
Definition at line 250 of file gvplugin_vt.c.
◆ engine6up
Initial value:= {
}
static void process6up(GVJ_t *job)
draw a 6-pixels-per-character monochrome image
Definition at line 254 of file gvplugin_vt.c.
◆ engine8up
Initial value:= {
}
static void process8up(GVJ_t *job)
draw a 8-pixels-per-character monochrome image
Definition at line 258 of file gvplugin_vt.c.
◆ gvplugin_vt_LTX_library