#include "gd.h"
#include "gdfontl.h"
#include <string.h>
#include <stdio.h>int main(int argv, char** argc)
{
/* Declare the image */
gdImagePtr im;
/* Declare output files */
FILE *pngout, *jpegout;
/* Declare color indexes */
int black; int white;
/* Allocate the image: 64 pixels across by 64 pixels tall */
im = gdImageCreate(64, 64);
/* Allocate the color black (red, green and blue all minimum). Since this is the first color in a new image, it will be the background color. */
black = gdImageColorAllocate(im, 0, 0, 0);
/* Allocate the color white (red, green and blue all maximum). */
white = gdImageColorAllocate(im, 255, 255, 255);
/* Draw a line from the upper left to the lower right, using white color index. */
gdImageLine(im, 0, 0, 63, 63, white);
/* Open a file for writing. "wb" means "write binary", important under MSDOS, harmless under Unix. */
pngout = fopen("test.png", "wb");
/* Do the same for a JPEG-format file. */
jpegout = fopen("test.jpg", "wb");
/* Output the image to the disk file in PNG format. */
gdImagePng(im, pngout);
/* Output the same image in JPEG format, using the default JPEG quality setting. */
gdImageJpeg(im, jpegout, -1); /* Close the files. */
fclose(pngout);
fclose(jpegout);
/* Destroy the image in memory. */
gdImageDestroy(im);
}
发布评论
评论(3)
n年以前上大学瞎折腾的东西早就忘干净了,这个版多数都是做系统的,虽然不敢说没有编程高手,不过还是建议到编程的论坛问问看。从系统的角度偶觉得能做的也就是更新显卡驱动
从代码吗?那你觉得上面的代码哪里有问题呢?还是编译的时候要针对机器加一些编译选项?
这类图形库的东西经常和显卡是有关的,以前上学的时候学opengl编程经常在一台机器上好了换一台不同显卡的就有问题,还是要从代码上找原因