36 if ((
in = fopen(name,
"rb")) == NULL) {
41 for (ext = name + strlen(name); *ext !=
'.' && ext >= name; ext--) {
44 if (ext < name || ext == name + strlen(name)) {
55 if ((strcmp(ext,
"jpg") == 0) || (strcmp(ext,
"JPG") == 0) ||
56 (strcmp(ext,
"jpeg") == 0) || (strcmp(ext,
"JPEG") == 0))
57 im = gdImageCreateFromJpeg(
in);
61 if ((strcmp(ext,
"png") == 0) || (strcmp(ext,
"PNG") == 0))
62 im = gdImageCreateFromPng(
in);
66 if ((strcmp(ext,
"gif") == 0) || (strcmp(ext,
"GIF") == 0))
67 im = gdImageCreateFromGif(
in);
75int gdlib_image_sx(
const gdImagePtr *im) {
78 return gdImageSX(*im);
81int gdlib_image_sy(
const gdImagePtr *im) {
84 return gdImageSY(*im);
87void gdlib_image_get_pixel_rgb(
const gdImagePtr *im,
const int *x,
const int *y,
88 int *r,
int *g,
int *b) {
93 if (gdImageBoundsSafe(*im, *x, *y)) {
94 color = gdImageGetPixel(*im, *x, *y);
95 *r = gdImageRed(*im, color);
96 *g = gdImageGreen(*im, color);
97 *b = gdImageBlue(*im, color);
int fclose(FILE *__stream)
type(c_ptr) function, public gdlib_image_create_from(filename)