// // Stitch routines. // // Copyright 2006 by Johannes Hofmann // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library 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 // Library General Public License for more details. // // You should have received a copy of the GNU Library General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA. // #include #include #include #include #include #include "Stitch.H" static double pi_d = asin(1.0) * 2.0; Stitch::Stitch() { for (int i=0; iload_image(file) != 0) { delete gipf[i]; gipf[i] = NULL; } break; } } } int Stitch::resample(DataImage *img, double view_start, double view_end) { double step_view = (view_end - view_start) / img->w(); char r, g, b; int y_off = img->h() / 2; double radius = (double) img->w() / (view_end -view_start); for (int y=0; yh(); y++) { double a_nick = atan((double)(y_off - y)/radius); for (int x=0; xw(); x++) { double a_view; a_view = view_start + x * step_view; for (int i=0; iget_pixel(a_view, a_nick, &r, &g, &b)==0) { img->set_pixel(x, y, r, g, b); break; } } } if (y % (img->h() / 200) == 0) { img->redraw(); Fl::check(); } } }