#include <Imagine/Images.h>
using namespace std;
void images() {
cout << "Testing Image functions!" << endl;
byte t1[]={1,2,3,4,5,6};
byte *t2=new byte[6];
for(
int i=0; i<Jb.
height(); i++)
for(
int j=0; j<Jb.
width(); j++)
Jb(j,i) = byte(rand()%256);
for(
int i=0; i<Jcb.
height(); i++)
for(
int j=0; j<Jcb.
width(); j++)
Jcb(j,i)=
Color(byte(rand()%256),byte(rand()%256),byte(rand()%256));
A=E;
Jd=Jb;
Jcd=Jcb;
byte a,b,c,d;
cout << sum(Jd) << ' ' << sum(Jcd) << endl;
cout << norm2(Jd) << ' ' << norm2(Jcd) << endl;
cout << norm(Jd) << ' ' << norm(Jcd) << endl;
O=-O;
O=O+P;
O+=P;
O=O-P;
O-=P;
O=RGB<double>(1.,2.,3.)+P;
O+=RGB<double>(1.,2.,3.);
O=P-RGB<double>(1.,2.,3.);
O=RGB<double>(1.,2.,3.)-P;
O-=RGB<double>(1.,2.,3.);
O=P*2.;
O=2*P;
O*=2.;
O=P/2.;
O/=2.;
O=P*Q;
O*=Q;
O=P/Q;
O/=Q;
}
void io_transparency() {
cout << "Testing IO transparency functions!" << endl;
cout << "GIF opaque image" << endl;
cout << "Superimposed transparent PNG image" << endl;
cout << "Two transparent images" << endl;
cout << "Transparent image" << endl;
cout << "Saved and reloaded PNG transparent image" << endl;
}
void io() {
cout << "Testing IO functions!" << endl;
save(J,
"out_color.jpg",95);
save(R,G,B,
"out_color.png");
K/=255.;
L/=255.;
for (int k=0;k<110;k++)
for (int j=0;j<120;j++)
for (int i=0;i<130;i++)
M(i,j,k)=i+j+k;
saveAnalyze<float>(I,"out");
if (I(10,10)!=I0(10,10))
cout << "Analyze error!!!" << endl;
saveAnalyze<double>(K,"out");
if (K(10,10)!=K0(10,10))
cout << "Analyze error!!!" << endl;
}
void algos() {
cout << "Testing Algos functions!" << endl;
J=I;
}
void schemes(){
cout << "Testing PDE schemes" << endl;
cout << dp << " " << dm << endl;
cout << pp << " " << pm << endl;
}
int main() {
images();
io();
algos();
schemes();
io_transparency();
return 0;
}