/*! ======================================================================== ** Extended Template and Library Test Suite ** Surface Class Test ** $Id$ ** ** Copyright (c) 2002 Robert B. Quattlebaum Jr. ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as ** published by the Free Software Foundation; either version 2 of ** the License, or (at your option) any later version. ** ** This package is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** === N O T E S =========================================================== ** ** ========================================================================= */ /* === H E A D E R S ======================================================= */ #include #include #include #include /* === M A C R O S ========================================================= */ using namespace etl; using namespace std; /* === C L A S S E S ======================================================= */ /* === P R O C E D U R E S ================================================= */ int display_pen(generic_pen pen, int w, int h) { int ret=0; int x, y; // print out the after pic for(y=0;y=2.0f) printf("#"); else if(pen.get_value()>=1.0f) printf("@"); else if(pen.get_value()>=0.8f) printf("%%"); else if(pen.get_value()>=0.6f) printf("O"); else if(pen.get_value()>=0.4f) printf(":"); else if(pen.get_value()>=0.2f) printf("."); else if(pen.get_value()>=-0.1f) printf(" "); else printf("X"),ret++; } pen.dec_x(x); printf("|\n"); } pen.dec_y(y); return ret; } void make_pattern(generic_pen pen, int w, int h) { int x,y; for(y=0;y my_surface(100,100); gaussian_blur(my_surface.begin(),my_surface.end(),10,10); surface my_surface2(my_surface); my_surface2.fill(0.5); my_surface2.clear(); my_surface2=my_surface; my_surface2.fill(0.5); my_surface2.clear(); my_surface.fill(0.5); my_surface.clear(); surface my_surface3; my_surface3.mirror(my_surface2); my_surface3.fill(0.5); my_surface3.clear(); my_surface3=my_surface; my_surface3.mirror(my_surface); printf("Surface:basic_test(): %d errors.\n",ret); return ret; } int linear_sample_test() { printf("Surface:linear_sample_test(): Running...\n"); int ret=0; surface my_surface(16,16); my_surface.fill(0.0f); make_pattern(my_surface.begin(),my_surface.get_w(),my_surface.get_h()); int extra(5); surface dest(18+extra*2,18+extra*2); int x,y; for(x=-extra;x my_surface(16,16); my_surface.fill(0.0f); make_pattern(my_surface.begin(),my_surface.get_w(),my_surface.get_h()); { surface dest(24,24); int x,y; for(x=0;x dest(16,16); int x,y; for(x=0;x