28 const size_t result =
gvwrite(gd_context->
job, buffer, (
size_t)
len);
29 assert(result <= (
size_t)
len);
52static void gd_format(
GVJ_t * job)
57 unsigned int width = job->
width;
58 unsigned int height = job->
height;
60 memset(&gd_context, 0,
sizeof(gd_context));
66 assert(width <= INT_MAX);
67 assert(height <= INT_MAX);
68 im = gdImageCreateTrueColor((
int)width, (
int)height);
72 for (y = 0; y < height; y++) {
73 for (x = 0; x < width; x++) {
74 const int r = *
data++;
75 const int g = *
data++;
76 const int b = *
data++;
79 const int color = r | (g << 8) | (b << 16) | ((0x7f -
alpha) << 24);
80 im->tpixels[y][x] =
color;
87#define TRANSPARENT 0x7ffffffe
89 gdImageColorTransparent(im, TRANSPARENT);
90 gdImageAlphaBlending(im,
false);
91 for (y = 0; y < height; y++) {
92 for (x = 0; x < width; x++) {
93 const int r = *
data++;
94 const int g = *
data++;
95 const int b = *
data++;
98 const int color = r | (g << 8) | (b << 16) | ((0x7f -
alpha) << 24);
101 im->tpixels[y][x] =
color;
103 im->tpixels[y][x] = TRANSPARENT;
112 gdImageTrueColorToPalette(im, 0, 256);
113 gdImageGifCtx(im, &gd_context.
ctx);
128#define JPEG_QUALITY -1
129 gdImageJpegCtx(im, &gd_context.
ctx, JPEG_QUALITY);
135 gdImageTrueColorToPalette(im, 0, 256);
136 gdImagePngCtx(im, &gd_context.
ctx);
145#define GD2_CHUNKSIZE 128
147#define GD2_COMPRESSED 2
148 gdImageGd2(im, job->
output_file, GD2_CHUNKSIZE, GD2_COMPRESSED);
155 int black = gdImageColorResolveAlpha(im, 0, 0, 0, gdAlphaOpaque);
156 gdImageWBMPCtx(im,
black, &gd_context.
ctx);
194#ifdef HAVE_PANGOCAIRO
197 {
FORMAT_GIF,
"gif:cairo", 10, &gd_engine, &device_features_gd},
198 {
FORMAT_WBMP,
"wbmp:cairo", 5, &gd_engine, &device_features_gd},
202 {
FORMAT_JPEG,
"jpe:cairo", 5, &gd_engine, &device_features_gd},
203 {
FORMAT_JPEG,
"jpeg:cairo", 5, &gd_engine, &device_features_gd},
204 {
FORMAT_JPEG,
"jpg:cairo", 5, &gd_engine, &device_features_gd},
208 {
FORMAT_PNG,
"png:cairo", 5, &gd_engine, &device_features_gd},
211 {
FORMAT_GD,
"gd:cairo", 5, &gd_engine, &device_features_gd_no_writer},
212 {
FORMAT_GD2,
"gd2:cairo", 5, &gd_engine, &device_features_gd_no_writer},
static gd_context_t * get_containing_context(gdIOCtx *ctx)
static double len(glCompPoint p)
#define GVDEVICE_NO_WRITER
#define GVDEVICE_DOES_TRUECOLOR
#define GVDEVICE_BINARY_FORMAT
static void color(Agraph_t *g)
size_t gvwrite(GVJ_t *job, const char *s, size_t len)
int gvdevice_gd_putBuf(gdIOCtx *context, const void *buffer, int len)
void gvdevice_gd_putC(gdIOCtx *context, int C)
gvplugin_installed_t gvdevice_gd_types[]
static const char black[]
gvplugin_active_device_t device
unsigned char * imagedata
location of imagedata