Update gdpp.* to use HAVE_LIBPNG vs HAVE_PNG, etc.- should honor the same feature support flags as the rest of gd,
parent
40c6129986
commit
c7bf3794b6
12
src/gdpp.cxx
12
src/gdpp.cxx
|
@ -40,7 +40,7 @@ namespace GD
|
||||||
0x89 0x50 0x4E 0x47 0x0D 0x0A 0x1A 0x0A
|
0x89 0x50 0x4E 0x47 0x0D 0x0A 0x1A 0x0A
|
||||||
== .PNG\r\n.\n
|
== .PNG\r\n.\n
|
||||||
*/
|
*/
|
||||||
#if HAVE_PNG
|
#ifdef HAVE_LIBPNG
|
||||||
case 0x89: // PNG
|
case 0x89: // PNG
|
||||||
rtn = CreateFromPng(in);
|
rtn = CreateFromPng(in);
|
||||||
break;
|
break;
|
||||||
|
@ -51,7 +51,7 @@ namespace GD
|
||||||
case 0x47: // GIF
|
case 0x47: // GIF
|
||||||
rtn = CreateFromGif(in);
|
rtn = CreateFromGif(in);
|
||||||
break;
|
break;
|
||||||
#if HAVE_JPEG
|
#ifdef HAVE_LIBJPEG
|
||||||
/* JPEG
|
/* JPEG
|
||||||
A JFIF-standard file will start with the four bytes (hex) FF D8 FF E0,
|
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'.
|
followed by two variable bytes (often hex 00 10), followed by 'JFIF'.
|
||||||
|
@ -122,7 +122,7 @@ namespace GD
|
||||||
bool rtn;
|
bool rtn;
|
||||||
switch (in.peek())
|
switch (in.peek())
|
||||||
{
|
{
|
||||||
#if HAVE_PNG
|
#ifdef HAVE_LIBPNG
|
||||||
/* PNG
|
/* PNG
|
||||||
The first eight bytes of a PNG file always contain the following (decimal) values:
|
The first eight bytes of a PNG file always contain the following (decimal) values:
|
||||||
0x89 0x50 0x4E 0x47 0x0D 0x0A 0x1A 0x0A
|
0x89 0x50 0x4E 0x47 0x0D 0x0A 0x1A 0x0A
|
||||||
|
@ -140,7 +140,7 @@ namespace GD
|
||||||
rtn = CreateFromGif(in);
|
rtn = CreateFromGif(in);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if HAVE_JPEG
|
#ifdef HAVE_LIBJPEG
|
||||||
/* JPEG
|
/* JPEG
|
||||||
A JFIF-standard file will start with the four bytes (hex) FF D8 FF E0,
|
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'.
|
followed by two variable bytes (often hex 00 10), followed by 'JFIF'.
|
||||||
|
@ -193,7 +193,7 @@ namespace GD
|
||||||
switch (((unsigned char * )data)[0])
|
switch (((unsigned char * )data)[0])
|
||||||
{
|
{
|
||||||
|
|
||||||
#if HAVE_PNG
|
#ifdef HAVE_LIBPNG
|
||||||
/* PNG
|
/* PNG
|
||||||
The first eight bytes of a PNG file always contain the following (decimal) values:
|
The first eight bytes of a PNG file always contain the following (decimal) values:
|
||||||
0x89 0x50 0x4E 0x47 0x0D 0x0A 0x1A 0x0A
|
0x89 0x50 0x4E 0x47 0x0D 0x0A 0x1A 0x0A
|
||||||
|
@ -210,7 +210,7 @@ namespace GD
|
||||||
rtn = CreateFromGif(size, data);
|
rtn = CreateFromGif(size, data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if HAVE_JPEG
|
#ifdef HAVE_LIBJPEG
|
||||||
/* JPEG
|
/* JPEG
|
||||||
A JFIF-standard file will start with the four bytes (hex) FF D8 FF E0,
|
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'.
|
followed by two variable bytes (often hex 00 10), followed by 'JFIF'.
|
||||||
|
|
16
src/gdpp.h
16
src/gdpp.h
|
@ -24,6 +24,10 @@
|
||||||
#ifndef _gdpp_h
|
#ifndef _gdpp_h
|
||||||
#define _gdpp_h
|
#define _gdpp_h
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "gd_io_stream.h"
|
#include "gd_io_stream.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -288,7 +292,7 @@ public:
|
||||||
:im(0) {
|
:im(0) {
|
||||||
CreateFrom(size, data);
|
CreateFrom(size, data);
|
||||||
}
|
}
|
||||||
#if HAVE_PNG
|
#ifdef HAVE_LIBPNG
|
||||||
/** Construct an image by reading from \p in.
|
/** 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.
|
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
|
e.g. GD::Image img(input, GD::Png_tag()); // read a png file from input
|
||||||
|
@ -404,7 +408,7 @@ public:
|
||||||
CreateFromWBMP(size, data);
|
CreateFromWBMP(size, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_JPEG
|
#ifdef HAVE_LIBJPEG
|
||||||
/** Construct an image by reading from \p in.
|
/** 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.
|
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
|
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
|
/// Read an image from a memory block, after determining the image format
|
||||||
bool CreateFrom(int size, void * data);
|
bool CreateFrom(int size, void * data);
|
||||||
|
|
||||||
#if HAVE_PNG
|
#ifdef HAVE_LIBPNG
|
||||||
// Png
|
// Png
|
||||||
bool CreateFromPng(FILE * in) {
|
bool CreateFromPng(FILE * in) {
|
||||||
clear();
|
clear();
|
||||||
|
@ -662,7 +666,7 @@ public:
|
||||||
return ((im = gdImageCreateFromWBMPCtx( & _in_ctx)) != 0);
|
return ((im = gdImageCreateFromWBMPCtx( & _in_ctx)) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_JPEG
|
#ifdef HAVE_LIBJPEG
|
||||||
// Jpeg
|
// Jpeg
|
||||||
/**
|
/**
|
||||||
Load a truecolor image from a JPEG format file.
|
Load a truecolor image from a JPEG format file.
|
||||||
|
@ -1085,7 +1089,7 @@ public:
|
||||||
gdImageGifCtx(im, & _out_ctx);
|
gdImageGifCtx(im, & _out_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_PNG
|
#ifdef HAVE_LIBPNG
|
||||||
/**
|
/**
|
||||||
Write out this image in PNG file format to \p out.
|
Write out this image in PNG file format to \p out.
|
||||||
\param out A FILE * handle
|
\param out A FILE * handle
|
||||||
|
@ -1187,7 +1191,7 @@ public:
|
||||||
gdImageWBMPCtx(im, fg, & _out_ctx);
|
gdImageWBMPCtx(im, fg, & _out_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_JPEG
|
#ifdef HAVE_LIBJPEG
|
||||||
/**
|
/**
|
||||||
Write out this image in JPEG file format to \p out.
|
Write out this image in JPEG file format to \p out.
|
||||||
\param out A FILE * handle
|
\param out A FILE * handle
|
||||||
|
|
Loading…
Reference in New Issue