Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../proc/self/root/usr/include
File: gdpp.h
/* *****************************************************************************
[0] Fix | Delete
** $Id$
[1] Fix | Delete
** Initial file written and documented by:
[2] Fix | Delete
** Kevin Shepherd <kshepherd@php.net> December 2007
[3] Fix | Delete
** of Scarlet Line http://www.scarletline.com/
[4] Fix | Delete
** with contributions from Torben Nielsen.
[5] Fix | Delete
*******************************************************************************/
[6] Fix | Delete
/** \file gdpp.h
[7] Fix | Delete
\brief Object Oriented C++ wrappers around libgd functionality.
[8] Fix | Delete
[9] Fix | Delete
Example usage, convert png to gif:
[10] Fix | Delete
#include <fstream>
[11] Fix | Delete
#include <gdpp.h>
[12] Fix | Delete
[13] Fix | Delete
std::ifstream in("image.png", std::ios_base::in | std::ios_base::binary );
[14] Fix | Delete
GD::Image im(in, GD::Png_tag());
[15] Fix | Delete
if (im.good())
[16] Fix | Delete
{
[17] Fix | Delete
std::ofstream out("image.gif", std::ios_base::out | std::ios_base::binary );
[18] Fix | Delete
im.Gif(out);
[19] Fix | Delete
}
[20] Fix | Delete
*/
[21] Fix | Delete
#ifdef __cplusplus
[22] Fix | Delete
#ifndef _gdpp_h
[23] Fix | Delete
#define _gdpp_h
[24] Fix | Delete
[25] Fix | Delete
#ifdef HAVE_CONFIG_H
[26] Fix | Delete
#include "config.h"
[27] Fix | Delete
#endif
[28] Fix | Delete
[29] Fix | Delete
#include "gd_io_stream.h"
[30] Fix | Delete
#include <string>
[31] Fix | Delete
[32] Fix | Delete
/// namespace GD:: contains the C++ wrapper classes for libgd
[33] Fix | Delete
/** This namespace is primarily to avoid name clashes, and to
[34] Fix | Delete
contain all of the gd classes within one namespace.
[35] Fix | Delete
It is not recommended to use the "using namespace" directive with this namespace.
[36] Fix | Delete
Example usage:
[37] Fix | Delete
GD::Image im(64, 32, true); // Create a truecolor image 64 pixels wide by 32 pixels high
[38] Fix | Delete
GD::Point pt(10, 8); // The point at x=10, y=8.
[39] Fix | Delete
GD::Size sz(16, 8); // The size width=16, height=8.
[40] Fix | Delete
GD::TrueColor col(0xFF, 0, 0); // The colour red; R=255, G=0, B=0.
[41] Fix | Delete
im.Rectangle(pt, sz, col.Int()); // Draw a red rectangle with top left corner at pt, of size sz.
[42] Fix | Delete
*/
[43] Fix | Delete
namespace GD
[44] Fix | Delete
{
[45] Fix | Delete
/** This class GD::Point stores a point in two dimensions, somewhere
[46] Fix | Delete
on the plane of an image.
[47] Fix | Delete
*/
[48] Fix | Delete
class BGD_EXPORT_DATA_PROT Point
[49] Fix | Delete
{
[50] Fix | Delete
public:
[51] Fix | Delete
// Constructors
[52] Fix | Delete
Point(int x, int y)
[53] Fix | Delete
:_x(x), _y(y) {}
[54] Fix | Delete
Point(const Point & p)
[55] Fix | Delete
:_x(p._x), _y(p._y) {}
[56] Fix | Delete
Point()
[57] Fix | Delete
:_x(0), _y(0) {}
[58] Fix | Delete
Point & operator=(const Point & p) {
[59] Fix | Delete
_x = p._x;
[60] Fix | Delete
_y = p._y;
[61] Fix | Delete
return (* this);
[62] Fix | Delete
}
[63] Fix | Delete
// Accessors
[64] Fix | Delete
int X() const {
[65] Fix | Delete
return _x;
[66] Fix | Delete
}
[67] Fix | Delete
int Y() const {
[68] Fix | Delete
return _y;
[69] Fix | Delete
}
[70] Fix | Delete
// Updaters
[71] Fix | Delete
void X(int x) {
[72] Fix | Delete
_x = x;
[73] Fix | Delete
}
[74] Fix | Delete
void Y(int y) {
[75] Fix | Delete
_y = y;
[76] Fix | Delete
}
[77] Fix | Delete
void set(int x, int y) {
[78] Fix | Delete
_x = x;
[79] Fix | Delete
_y = y;
[80] Fix | Delete
}
[81] Fix | Delete
int & lhsX() {
[82] Fix | Delete
return _x;
[83] Fix | Delete
}
[84] Fix | Delete
int & lhsY() {
[85] Fix | Delete
return _y;
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
gdPointPtr as_gdPointPtr() {
[89] Fix | Delete
return (gdPointPtr) this;
[90] Fix | Delete
}
[91] Fix | Delete
protected:
[92] Fix | Delete
int _x, _y;
[93] Fix | Delete
};
[94] Fix | Delete
typedef Point * PointPtr;
[95] Fix | Delete
/** This class GD::Size stores length in two dimensions.
[96] Fix | Delete
Giving the size of an area as width and height.
[97] Fix | Delete
*/
[98] Fix | Delete
class BGD_EXPORT_DATA_PROT Size
[99] Fix | Delete
{
[100] Fix | Delete
public:
[101] Fix | Delete
// Constructors
[102] Fix | Delete
Size(int w, int h)
[103] Fix | Delete
:_w(w), _h(h) {}
[104] Fix | Delete
Size(const Size & p)
[105] Fix | Delete
:_w(p._w), _h(p._h) {}
[106] Fix | Delete
Size()
[107] Fix | Delete
:_w(0), _h(0) {}
[108] Fix | Delete
Size & operator=(const Size & p) {
[109] Fix | Delete
_w = p._w;
[110] Fix | Delete
_h = p._h;
[111] Fix | Delete
return (* this);
[112] Fix | Delete
}
[113] Fix | Delete
// Accessors
[114] Fix | Delete
int W() const {
[115] Fix | Delete
return _w;
[116] Fix | Delete
}
[117] Fix | Delete
int H() const {
[118] Fix | Delete
return _h;
[119] Fix | Delete
}
[120] Fix | Delete
// Updaters
[121] Fix | Delete
void W(int w) {
[122] Fix | Delete
_w = w;
[123] Fix | Delete
}
[124] Fix | Delete
void H(int h) {
[125] Fix | Delete
_h = h;
[126] Fix | Delete
}
[127] Fix | Delete
void set(int w, int h) {
[128] Fix | Delete
_w = w;
[129] Fix | Delete
_h = h;
[130] Fix | Delete
}
[131] Fix | Delete
int & lhsW() {
[132] Fix | Delete
return _w;
[133] Fix | Delete
}
[134] Fix | Delete
int & lhsH() {
[135] Fix | Delete
return _h;
[136] Fix | Delete
}
[137] Fix | Delete
protected:
[138] Fix | Delete
int _w, _h;
[139] Fix | Delete
};
[140] Fix | Delete
typedef Size * SizePtr;
[141] Fix | Delete
[142] Fix | Delete
/** This class GD::TrueColor stores a colour as an RGBA quadruplet.
[143] Fix | Delete
It can also be read as an integer, and in other colour formats.
[144] Fix | Delete
*/
[145] Fix | Delete
class BGD_EXPORT_DATA_PROT TrueColor
[146] Fix | Delete
{
[147] Fix | Delete
public:
[148] Fix | Delete
union as_types {
[149] Fix | Delete
int as_int;
[150] Fix | Delete
struct uchars {
[151] Fix | Delete
unsigned char blue, green, red, alpha;
[152] Fix | Delete
} as_uchar;
[153] Fix | Delete
};
[154] Fix | Delete
TrueColor() {
[155] Fix | Delete
internal.as_int = 0;
[156] Fix | Delete
}
[157] Fix | Delete
TrueColor(int c) {
[158] Fix | Delete
internal.as_int = c;
[159] Fix | Delete
}
[160] Fix | Delete
TrueColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 0) {
[161] Fix | Delete
internal.as_uchar.alpha = a;
[162] Fix | Delete
internal.as_uchar.red = r;
[163] Fix | Delete
internal.as_uchar.green = g;
[164] Fix | Delete
internal.as_uchar.blue = b;
[165] Fix | Delete
}
[166] Fix | Delete
// Accessors
[167] Fix | Delete
int Int() const {
[168] Fix | Delete
return internal.as_int;
[169] Fix | Delete
}
[170] Fix | Delete
unsigned char Red() const {
[171] Fix | Delete
return internal.as_uchar.red;
[172] Fix | Delete
}
[173] Fix | Delete
unsigned char Green() const {
[174] Fix | Delete
return internal.as_uchar.green;
[175] Fix | Delete
}
[176] Fix | Delete
unsigned char Blue() const {
[177] Fix | Delete
return internal.as_uchar.blue;
[178] Fix | Delete
}
[179] Fix | Delete
unsigned char Alpha() const {
[180] Fix | Delete
return internal.as_uchar.alpha;
[181] Fix | Delete
}
[182] Fix | Delete
// Updaters
[183] Fix | Delete
void set(int c) {
[184] Fix | Delete
internal.as_int = c;
[185] Fix | Delete
}
[186] Fix | Delete
void set(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 0) {
[187] Fix | Delete
internal.as_uchar.alpha = a;
[188] Fix | Delete
internal.as_uchar.red = r;
[189] Fix | Delete
internal.as_uchar.green = g;
[190] Fix | Delete
internal.as_uchar.blue = b;
[191] Fix | Delete
}
[192] Fix | Delete
void Red(unsigned char c) {
[193] Fix | Delete
internal.as_uchar.red = c;
[194] Fix | Delete
}
[195] Fix | Delete
void Green(unsigned char c) {
[196] Fix | Delete
internal.as_uchar.green = c;
[197] Fix | Delete
}
[198] Fix | Delete
void Blue(unsigned char c) {
[199] Fix | Delete
internal.as_uchar.blue = c;
[200] Fix | Delete
}
[201] Fix | Delete
void Alpha(unsigned char c) {
[202] Fix | Delete
internal.as_uchar.alpha = c;
[203] Fix | Delete
}
[204] Fix | Delete
protected:
[205] Fix | Delete
as_types internal;
[206] Fix | Delete
};
[207] Fix | Delete
/* The following tags are simply empty structures which are used
[208] Fix | Delete
to tell the compiler which constructor we want when we know
[209] Fix | Delete
the image file format.
[210] Fix | Delete
*/
[211] Fix | Delete
struct BGD_EXPORT_DATA_PROT Png_tag {};
[212] Fix | Delete
struct BGD_EXPORT_DATA_PROT Gif_tag {};
[213] Fix | Delete
struct BGD_EXPORT_DATA_PROT WBMP_tag {};
[214] Fix | Delete
struct BGD_EXPORT_DATA_PROT Jpeg_tag {};
[215] Fix | Delete
struct BGD_EXPORT_DATA_PROT Gd_tag {};
[216] Fix | Delete
struct BGD_EXPORT_DATA_PROT Gd2_tag {};
[217] Fix | Delete
struct BGD_EXPORT_DATA_PROT Xbm_tag {};
[218] Fix | Delete
[219] Fix | Delete
/** This class GD::Image wraps all of the 'C' libgd functionality
[220] Fix | Delete
for the convenience of C++ users. An instance of this class
[221] Fix | Delete
corresponds to a single image.
[222] Fix | Delete
*/
[223] Fix | Delete
class BGD_EXPORT_DATA_PROT Image
[224] Fix | Delete
{
[225] Fix | Delete
public:
[226] Fix | Delete
/** Construct a null image
[227] Fix | Delete
*/
[228] Fix | Delete
Image()
[229] Fix | Delete
:im(0)
[230] Fix | Delete
{}
[231] Fix | Delete
/** Construct a blank image, of the given size and colour format type.
[232] Fix | Delete
\param[in] sx Width of the image
[233] Fix | Delete
\param[in] sy Height of the image
[234] Fix | Delete
\param[in] istruecolor Create a true colour image, defaults to false, i.e. create an indexed palette image.
[235] Fix | Delete
*/
[236] Fix | Delete
Image(int sx, int sy, bool istruecolor = false)
[237] Fix | Delete
:im(0) {
[238] Fix | Delete
if (istruecolor)
[239] Fix | Delete
CreateTrueColor(sx, sy);
[240] Fix | Delete
else
[241] Fix | Delete
Create(sx, sy);
[242] Fix | Delete
}
[243] Fix | Delete
/** Construct a blank image, of the given size and colour format type.
[244] Fix | Delete
\param[in] s Width and height of the image
[245] Fix | Delete
\param[in] istruecolor Create a true colour image, defaults to false, i.e. create an indexed palette image.
[246] Fix | Delete
*/
[247] Fix | Delete
Image(const Size & s, bool istruecolor = false)
[248] Fix | Delete
:im(0) {
[249] Fix | Delete
if (istruecolor)
[250] Fix | Delete
CreateTrueColor(s);
[251] Fix | Delete
else
[252] Fix | Delete
Create(s);
[253] Fix | Delete
}
[254] Fix | Delete
/** Construct an instance of the GD::Image class, given the internal gdImage poimter.
[255] Fix | Delete
Note that gdImageDestroy will be called on the image pointer in the destructor.
[256] Fix | Delete
\param[in] i Pointer to the internal gdImage
[257] Fix | Delete
*/
[258] Fix | Delete
Image(gdImagePtr i)
[259] Fix | Delete
:im(i) {}
[260] Fix | Delete
/** Copy constructor. Construct an instance of the GD::Image class,
[261] Fix | Delete
by making a copy of the GD::Image provided.
[262] Fix | Delete
\param[in] i Reference to the image to be copied
[263] Fix | Delete
*/
[264] Fix | Delete
Image(const GD::Image & i)
[265] Fix | Delete
:im(0) {
[266] Fix | Delete
Copy(i);
[267] Fix | Delete
}
[268] Fix | Delete
/** Construct an image by reading from \p in. This constructor
[269] Fix | Delete
will first attempt to determine the file format.
[270] Fix | Delete
\param[in] in The stream containing the image data
[271] Fix | Delete
*/
[272] Fix | Delete
Image(std::istream & in)
[273] Fix | Delete
:im(0) {
[274] Fix | Delete
CreateFrom(in);
[275] Fix | Delete
}
[276] Fix | Delete
/** Construct an image by reading from \p in. This constructor
[277] Fix | Delete
will first attempt to determine the file format.
[278] Fix | Delete
\param[in] in An opened FILE * handle to a file containing the image data
[279] Fix | Delete
*/
[280] Fix | Delete
Image(FILE * in)
[281] Fix | Delete
:im(0) {
[282] Fix | Delete
CreateFrom(in);
[283] Fix | Delete
}
[284] Fix | Delete
/** Construct an image by reading from memory block \p data. This constructor
[285] Fix | Delete
will first attempt to determine the image formatting.
[286] Fix | Delete
\param[in] size The byte count of the memory block
[287] Fix | Delete
\param[in] data Pointer to the memory block
[288] Fix | Delete
*/
[289] Fix | Delete
Image(int size, void * data)
[290] Fix | Delete
:im(0) {
[291] Fix | Delete
CreateFrom(size, data);
[292] Fix | Delete
}
[293] Fix | Delete
#ifdef HAVE_LIBPNG
[294] Fix | Delete
/** Construct an image by reading from \p in.
[295] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[296] Fix | Delete
e.g. GD::Image img(input, GD::Png_tag()); // read a png file from input
[297] Fix | Delete
\param[in] in The stream containing the image data
[298] Fix | Delete
*/
[299] Fix | Delete
Image(std::istream & in, Png_tag)
[300] Fix | Delete
:im(0) {
[301] Fix | Delete
CreateFromPng(in);
[302] Fix | Delete
}
[303] Fix | Delete
/** Construct an image by reading from \p in.
[304] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[305] Fix | Delete
e.g. GD::Image img(input, GD::Png_tag()); // read a png file from input
[306] Fix | Delete
\param[in] in An opened FILE * handle to a file containing the image data
[307] Fix | Delete
*/
[308] Fix | Delete
Image(FILE * in, Png_tag)
[309] Fix | Delete
:im(0) {
[310] Fix | Delete
CreateFromPng(in);
[311] Fix | Delete
}
[312] Fix | Delete
/** Construct an image by reading from \p in.
[313] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[314] Fix | Delete
e.g. GD::Image img(input, GD::Png_tag()); // read a png file from input
[315] Fix | Delete
\param[in] in The io context from which to read the image data
[316] Fix | Delete
*/
[317] Fix | Delete
Image(gdIOCtx * in, Png_tag)
[318] Fix | Delete
:im(0) {
[319] Fix | Delete
CreateFromPng(in);
[320] Fix | Delete
}
[321] Fix | Delete
/** Construct an image by reading from memory block \p data.
[322] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[323] Fix | Delete
e.g. GD::Image img(sz, dat, GD::Png_tag()); // read a png file from dat
[324] Fix | Delete
\param[in] size The byte count of the memory block
[325] Fix | Delete
\param[in] data Pointer to the memory block
[326] Fix | Delete
*/
[327] Fix | Delete
Image(int size, void * data, Png_tag)
[328] Fix | Delete
:im(0) {
[329] Fix | Delete
CreateFromPng(size, data);
[330] Fix | Delete
}
[331] Fix | Delete
#endif
[332] Fix | Delete
[333] Fix | Delete
/** Construct an image by reading from \p in.
[334] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[335] Fix | Delete
e.g. GD::Image img(input, GD::Gif_tag()); // read a gif file from input
[336] Fix | Delete
\param[in] in The stream containing the image data
[337] Fix | Delete
*/
[338] Fix | Delete
Image(std::istream & in, Gif_tag)
[339] Fix | Delete
:im(0) {
[340] Fix | Delete
CreateFromGif(in);
[341] Fix | Delete
}
[342] Fix | Delete
/** Construct an image by reading from \p in.
[343] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[344] Fix | Delete
e.g. GD::Image img(input, GD::Gif_tag()); // read a gif file from input
[345] Fix | Delete
\param[in] in An opened FILE * handle to a file containing the image data
[346] Fix | Delete
*/
[347] Fix | Delete
Image(FILE * in, Gif_tag)
[348] Fix | Delete
:im(0) {
[349] Fix | Delete
CreateFromGif(in);
[350] Fix | Delete
}
[351] Fix | Delete
/** Construct an image by reading from \p in.
[352] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[353] Fix | Delete
e.g. GD::Image img(input, GD::Gif_tag()); // read a gif file from input
[354] Fix | Delete
\param[in] in The io context from which to read the image data
[355] Fix | Delete
*/
[356] Fix | Delete
Image(gdIOCtx * in, Gif_tag)
[357] Fix | Delete
:im(0) {
[358] Fix | Delete
CreateFromGif(in);
[359] Fix | Delete
}
[360] Fix | Delete
/** Construct an image by reading from memory block \p data.
[361] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[362] Fix | Delete
e.g. GD::Image img(sz, dat, GD::Gif_tag()); // read a gif file from dat
[363] Fix | Delete
\param[in] size The byte count of the memory block
[364] Fix | Delete
\param[in] data Pointer to the memory block
[365] Fix | Delete
*/
[366] Fix | Delete
Image(int size, void * data, Gif_tag)
[367] Fix | Delete
:im(0) {
[368] Fix | Delete
CreateFromGif(size, data);
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
/** Construct an image by reading from \p in.
[372] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[373] Fix | Delete
e.g. GD::Image img(input, GD::WBMP_tag()); // read a monchrome WBMP file from input
[374] Fix | Delete
\param[in] in The stream containing the image data
[375] Fix | Delete
*/
[376] Fix | Delete
Image(std::istream & in, WBMP_tag)
[377] Fix | Delete
:im(0) {
[378] Fix | Delete
CreateFromWBMP(in);
[379] Fix | Delete
}
[380] Fix | Delete
/** Construct an image by reading from \p in.
[381] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[382] Fix | Delete
e.g. GD::Image img(input, GD::WBMP_tag()); // read a monchrome WBMP file from input
[383] Fix | Delete
\param[in] in An opened FILE * handle to a file containing the image data
[384] Fix | Delete
*/
[385] Fix | Delete
Image(FILE * in, WBMP_tag)
[386] Fix | Delete
:im(0) {
[387] Fix | Delete
CreateFromWBMP(in);
[388] Fix | Delete
}
[389] Fix | Delete
/** Construct an image by reading from \p in.
[390] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[391] Fix | Delete
e.g. GD::Image img(input, GD::WBMP_tag()); // read a monchrome WBMP file from input
[392] Fix | Delete
\param[in] in The io context from which to read the image data
[393] Fix | Delete
*/
[394] Fix | Delete
Image(gdIOCtx * in, WBMP_tag)
[395] Fix | Delete
:im(0) {
[396] Fix | Delete
CreateFromWBMP(in);
[397] Fix | Delete
}
[398] Fix | Delete
/** Construct an image by reading from memory block \p data.
[399] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[400] Fix | Delete
e.g. GD::Image img(sz, dat, GD::WBMP_tag()); // read a monchrome WBMP file from dat
[401] Fix | Delete
\param[in] size The byte count of the memory block
[402] Fix | Delete
\param[in] data Pointer to the memory block
[403] Fix | Delete
*/
[404] Fix | Delete
Image(int size, void * data, WBMP_tag)
[405] Fix | Delete
:im(0) {
[406] Fix | Delete
CreateFromWBMP(size, data);
[407] Fix | Delete
}
[408] Fix | Delete
[409] Fix | Delete
#ifdef HAVE_LIBJPEG
[410] Fix | Delete
/** Construct an image by reading from \p in.
[411] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[412] Fix | Delete
e.g. GD::Image img(input, GD::Jpeg_tag()); // read a jpeg file from input
[413] Fix | Delete
\param[in] in The stream containing the image data
[414] Fix | Delete
*/
[415] Fix | Delete
Image(std::istream & in, Jpeg_tag)
[416] Fix | Delete
:im(0) {
[417] Fix | Delete
CreateFromJpeg(in);
[418] Fix | Delete
}
[419] Fix | Delete
/** Construct an image by reading from \p in.
[420] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[421] Fix | Delete
e.g. GD::Image img(input, GD::Jpeg_tag()); // read a jpeg file from input
[422] Fix | Delete
\param[in] in An opened FILE * handle to a file containing the image data
[423] Fix | Delete
*/
[424] Fix | Delete
Image(FILE * in, Jpeg_tag)
[425] Fix | Delete
:im(0) {
[426] Fix | Delete
CreateFromJpeg(in);
[427] Fix | Delete
}
[428] Fix | Delete
/** Construct an image by reading from \p in.
[429] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[430] Fix | Delete
e.g. GD::Image img(input, GD::Jpeg_tag()); // read a jpeg file from input
[431] Fix | Delete
\param[in] in The io context from which to read the image data
[432] Fix | Delete
*/
[433] Fix | Delete
Image(gdIOCtx * in, Jpeg_tag)
[434] Fix | Delete
:im(0) {
[435] Fix | Delete
CreateFromJpeg(in);
[436] Fix | Delete
}
[437] Fix | Delete
/** Construct an image by reading from memory block \p data.
[438] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[439] Fix | Delete
e.g. GD::Image img(sz, dat, GD::Jpeg_tag()); // read a jpeg file from dat
[440] Fix | Delete
\param[in] size The byte count of the memory block
[441] Fix | Delete
\param[in] data Pointer to the memory block
[442] Fix | Delete
*/
[443] Fix | Delete
Image(int size, void * data, Jpeg_tag)
[444] Fix | Delete
:im(0) {
[445] Fix | Delete
CreateFromJpeg(size, data);
[446] Fix | Delete
}
[447] Fix | Delete
#endif
[448] Fix | Delete
[449] Fix | Delete
/** Construct an image by reading from \p in.
[450] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[451] Fix | Delete
e.g. GD::Image img(input, GD::Gd_tag()); // read a gd file from input
[452] Fix | Delete
\param[in] in The stream containing the image data
[453] Fix | Delete
*/
[454] Fix | Delete
Image(std::istream & in, Gd_tag)
[455] Fix | Delete
:im(0) {
[456] Fix | Delete
CreateFromGd(in);
[457] Fix | Delete
}
[458] Fix | Delete
/** Construct an image by reading from \p in.
[459] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[460] Fix | Delete
e.g. GD::Image img(input, GD::Gd_tag()); // read a gd file from input
[461] Fix | Delete
\param[in] in An opened FILE * handle to a file containing the image data
[462] Fix | Delete
*/
[463] Fix | Delete
Image(FILE * in, Gd_tag)
[464] Fix | Delete
:im(0) {
[465] Fix | Delete
CreateFromGd(in);
[466] Fix | Delete
}
[467] Fix | Delete
/** Construct an image by reading from \p in.
[468] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[469] Fix | Delete
e.g. GD::Image img(input, GD::Gd_tag()); // read a gd file from input
[470] Fix | Delete
\param[in] in The io context from which to read the image data
[471] Fix | Delete
*/
[472] Fix | Delete
Image(gdIOCtx * in, Gd_tag)
[473] Fix | Delete
:im(0) {
[474] Fix | Delete
CreateFromGd(in);
[475] Fix | Delete
}
[476] Fix | Delete
/** Construct an image by reading from memory block \p data.
[477] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[478] Fix | Delete
e.g. GD::Image img(sz, dat, GD::Gd_tag()); // read a gd file from dat
[479] Fix | Delete
\param[in] size The byte count of the memory block
[480] Fix | Delete
\param[in] data Pointer to the memory block
[481] Fix | Delete
*/
[482] Fix | Delete
Image(int size, void * data, Gd_tag)
[483] Fix | Delete
:im(0) {
[484] Fix | Delete
CreateFromGd(size, data);
[485] Fix | Delete
}
[486] Fix | Delete
[487] Fix | Delete
/** Construct an image by reading from \p in.
[488] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[489] Fix | Delete
e.g. GD::Image img(input, GD::Gd2_tag()); // read a gd2 file from input
[490] Fix | Delete
\param[in] in The stream containing the image data
[491] Fix | Delete
*/
[492] Fix | Delete
Image(std::istream & in, Gd2_tag)
[493] Fix | Delete
:im(0) {
[494] Fix | Delete
CreateFromGd2(in);
[495] Fix | Delete
}
[496] Fix | Delete
/** Construct an image by reading from \p in.
[497] Fix | Delete
The tag is an empty struct which simply tells the compiler which image read function to use.
[498] Fix | Delete
e.g. GD::Image img(input, GD::Png_tag()); // read a png file from input
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function