Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,2 @@
/* interface */
void print_jpg(image img, int qual);

View file

@ -0,0 +1,17 @@
#define MAXCMDBUF 100
void print_jpg(image img, int qual)
{
char buf[MAXCMDBUF];
unsigned int n;
FILE *pipe;
snprintf(buf, MAXCMDBUF, "convert ppm:- -quality %d jpg:-", qual);
pipe = popen(buf, "w");
if ( pipe != NULL )
{
fprintf(pipe, "P6\n%d %d\n255\n", img->width, img->height);
n = img->width * img->height;
fwrite(img->buf, sizeof(pixel), n, pipe);
pclose(pipe);
}
}

View file

@ -0,0 +1,12 @@
#include "imglib.h"
int main()
{
image img;
img = alloc_img(100,100);
fill_img(img, 50, 20, 200);
draw_line(img, 0, 0, 80, 80, 255, 0, 0);
print_jpg(img, 75);
free_img(img);
}