On December 30th, 10:58: 05 All night, finally got it, the structure of the main program is almost set. The C program that generates the PNG format picture is also born after experiencing N times stupid low-level errors. The GCC is only because the correct parameters are not added, the correct use is: "GCC newgd.c -lgd -lpng", so that it can be compiled. These two parameters tell GCC to call the library. The program is temporarily as follows: #include
INTMAIN () {Int SX, Sy, SkyBlue; GDIMAGEPTR NEWIMG; File * PNGFP;
SX = 250; SY = 250; newimg = gdimagecreate (SX, SY); / * Create a variable storage blank image, pixel SX * SY * / PNGFP = FOPEN ("SkyBlue.png", "WB");
SkyBlue = GdImageColoralLocate (Newimg, 136, 193, 255); / * Match the color, parameter r, g, b is three primary color, value from 0 to 255 * / gdimagefill (newimg, 0, 0, skyblue); / * is Image fill above color * / gdimagePng (newimg, pngfp); / * Create a PNG image * / gdimageDestroy (newimg); / * Destroy the image stream to release memory * /
Close (PNGFP); EXIT (0);} Although it is simple, it can operate normally. Next, I want to add some decoration to him, he is too pale.