Update gdpp.* to use HAVE_LIBPNG vs HAVE_PNG, etc.- should honor the same feature support flags as the rest of gd,

master
Nathanael Jones 2015-01-07 02:01:53 -05:00
parent 40c6129986
commit c7bf3794b6
2 changed files with 16 additions and 12 deletions

View File

@ -40,7 +40,7 @@ namespace GD
0x89 0x50 0x4E 0x47 0x0D 0x0A 0x1A 0x0A
== .PNG\r\n.\n
*/
#if HAVE_PNG
#ifdef HAVE_LIBPNG
case 0x89: // PNG
rtn = CreateFromPng(in);
break;
@ -51,7 +51,7 @@ namespace GD
case 0x47: // GIF
rtn = CreateFromGif(in);
break;
#if HAVE_JPEG
#ifdef HAVE_LIBJPEG
/* JPEG
A JFIF-standard file will start with the four bytes (hex) FF D8 FF E0,
followed by two variable bytes (often hex 00 10), followed by 'JFIF'.
@ -122,7 +122,7 @@ namespace GD
bool rtn;
switch (in.peek())
{
#if HAVE_PNG
#ifdef HAVE_LIBPNG
/* PNG
The first eight bytes of a PNG file always contain the following (decimal) values:
0x89 0x50 0x4E 0x47 0x0D 0x0A 0x1A 0x0A
@ -140,7 +140,7 @@ namespace GD
rtn = CreateFromGif(in);
break;
#if HAVE_JPEG
#ifdef HAVE_LIBJPEG
/* JPEG
A JFIF-standard file will start with the four bytes (hex) FF D8 FF E0,
followed by two variable bytes (often hex 00 10), followed by 'JFIF'.
@ -193,7 +193,7 @@ namespace GD
switch (((unsigned char * )data)[0])
{
#if HAVE_PNG
#ifdef HAVE_LIBPNG
/* PNG
The first eight bytes of a PNG file always contain the following (decimal) values:
0x89 0x50 0x4E 0x47 0x0D 0x0A 0x1A 0x0A
@ -210,7 +210,7 @@ namespace GD
rtn = CreateFromGif(size, data);
break;
#if HAVE_JPEG
#ifdef HAVE_LIBJPEG
/* JPEG
A JFIF-standard file will start with the four bytes (hex) FF D8 FF E0,
followed by two variable bytes (often hex 00 10), followed by 'JFIF'.

View File

@ -24,6 +24,10 @@
#ifndef _gdpp_h
#define _gdpp_h
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gd_io_stream.h"
#include <string>
@ -288,7 +292,7 @@ public:
:im(0) {
CreateFrom(size, data);
}
#if HAVE_PNG
#ifdef HAVE_LIBPNG
/** Construct an image by reading from \p in.
The tag is an empty struct which simply tells the compiler which image read function to use.
e.g. GD::Image img(input, GD::Png_tag()); // read a png file from input
@ -404,7 +408,7 @@ public:
CreateFromWBMP(size, data);
}
#if HAVE_JPEG
#ifdef HAVE_LIBJPEG
/** Construct an image by reading from \p in.
The tag is an empty struct which simply tells the compiler which image read function to use.
e.g. GD::Image img(input, GD::Jpeg_tag()); // read a jpeg file from input
@ -604,7 +608,7 @@ public:
/// Read an image from a memory block, after determining the image format
bool CreateFrom(int size, void * data);
#if HAVE_PNG
#ifdef HAVE_LIBPNG
// Png
bool CreateFromPng(FILE * in) {
clear();
@ -662,7 +666,7 @@ public:
return ((im = gdImageCreateFromWBMPCtx( & _in_ctx)) != 0);
}
#if HAVE_JPEG
#ifdef HAVE_LIBJPEG
// Jpeg
/**
Load a truecolor image from a JPEG format file.
@ -1085,7 +1089,7 @@ public:
gdImageGifCtx(im, & _out_ctx);
}
#if HAVE_PNG
#ifdef HAVE_LIBPNG
/**
Write out this image in PNG file format to \p out.
\param out A FILE * handle
@ -1187,7 +1191,7 @@ public:
gdImageWBMPCtx(im, fg, & _out_ctx);
}
#if HAVE_JPEG
#ifdef HAVE_LIBJPEG
/**
Write out this image in JPEG file format to \p out.
\param out A FILE * handle