1 |
torben |
68 |
#include <iostream> |
2 |
|
|
#include <fstream> |
3 |
|
|
#include "gdpp.h" |
4 |
|
|
|
5 |
|
|
using namespace std; |
6 |
|
|
using namespace GD; |
7 |
|
|
|
8 |
|
|
void test(int r, int g,int b, int a) |
9 |
|
|
{ |
10 |
|
|
cout << "--------------------------" << endl; |
11 |
|
|
cout << r << "|" << g << "|" << b << "|" << a << endl; |
12 |
|
|
GD::Image image;// image(20,30); |
13 |
|
|
image.CreateTrueColor(200,300); |
14 |
|
|
|
15 |
|
|
GD::TrueColor col3(r,g,b,a); |
16 |
|
|
cout << col3.Int() << "\n"; |
17 |
|
|
cout << gdTrueColorAlpha(r,g,b,a) << "\n"; |
18 |
|
|
GD::TrueColor col4( image.ColorAllocate(r,g,b,a)); |
19 |
|
|
cout << col4.Int() << "\n"; |
20 |
|
|
} |
21 |
|
|
|
22 |
|
|
int main() |
23 |
|
|
{ |
24 |
|
|
/* |
25 |
|
|
GD::Image image;// image(20,30); |
26 |
|
|
image.CreateTrueColor(200,300); |
27 |
|
|
std::ofstream out("/tmp/test.png"); |
28 |
|
|
image.Png(out); |
29 |
|
|
out.close();*/ |
30 |
|
|
|
31 |
|
|
test(1,0,0,0); |
32 |
|
|
test(0,1,0,0); |
33 |
|
|
test(0,0,1,0); |
34 |
|
|
test(0,0,0,1); |
35 |
|
|
|
36 |
|
|
return 0; |
37 |
|
|
|
38 |
|
|
for (int red=0; red<256; ++red) |
39 |
|
|
{ |
40 |
|
|
for (int green=0; green<256; ++green) |
41 |
|
|
{ |
42 |
|
|
for (int blue=0; blue<256; ++blue) |
43 |
|
|
{ |
44 |
|
|
GD::TrueColor col1(red,green,blue); |
45 |
|
|
int col2 = gdTrueColorAlpha(red,green,blue,0); |
46 |
|
|
|
47 |
|
|
if (col1.Int() != col2) |
48 |
|
|
cout << "Warning " << red << "|" << green << "|" << blue << "\n"; |
49 |
|
|
|
50 |
|
|
} |
51 |
|
|
} |
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
} |