From d577d991b97ae2b5ee1af23641bcffc3f83af5b2 Mon Sep 17 00:00:00 2001 From: Pixel Date: Wed, 4 Nov 2009 11:56:41 -0800 Subject: Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux. --- cd/test/screencapture.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 cd/test/screencapture.c (limited to 'cd/test/screencapture.c') diff --git a/cd/test/screencapture.c b/cd/test/screencapture.c new file mode 100755 index 0000000..1ac8d2c --- /dev/null +++ b/cd/test/screencapture.c @@ -0,0 +1,36 @@ +#include +#include +#include +#include +#include + +void main() +{ + cdCanvas *cd_canvas; + unsigned char *red, *green, *blue; + int width, height, size; + + cd_canvas = cdCreateCanvas(CD_NATIVEWINDOW, NULL); + if (!cd_canvas) + { + printf("Error creating canvas.\n"); + return; + } + + cdActivate(cd_canvas); + + cdGetCanvasSize(&width, &height, NULL, NULL); + size = width * height; + red = (unsigned char*)calloc(size, 1); + green = (unsigned char*)calloc(size, 1); + blue = (unsigned char*)calloc(size, 1); + + cdGetImageRGB(red, green, blue, 0, 0, width, height); + imSaveRGB(width, height, IM_JPG|IM_COMPRESSED, red, green, blue, "scap.jpg"); + + cdKillCanvas(cd_canvas); + + free(red); + free(green); + free(blue); +} -- cgit v1.2.3