/* * graph.c * * Add simple graphics to image rasters. * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% * * This file part of: SExtractor * * Copyright: (C) 1993-2020 IAP/CNRS/SorbonneU * * License: GNU General Public License * * SExtractor 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 3 of the License, or * (at your option) any later version. * SExtractor 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. * You should have received a copy of the GNU General Public License * along with SExtractor. If not, see . * * Last modified: 15/07/2020 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "define.h" #include "globals.h" double sexx1, sexy1; float ctg[37], stg[37]; /********************************* sexmove **********************************/ /* Move function (related to sexdraw).. */ void sexmove(double x, double y) { sexx1 = x; sexy1 = y; return; } /********************************* sexdraw **********************************/ /* Draw a line in a PIXTYPE bitmap. */ void sexdraw(PIXTYPE *bmp, int w, int h, double sexx2, double sexy2, PIXTYPE val) { double dx,dy, slope; int ix1,iy1, ix2,iy2, ix,iy; dx = sexx2-sexx1; dy = sexy2-sexy1; if (fabs(dx) > fabs(dy)) { slope = dy/dx; ix1 = RINT(sexx1); ix2 = RINT(sexx2); if (ix2>ix1) { for (ix=ix1+1; ix<=ix2; ix++) if (ix>=0 && ix=0 && iy=ix2; ix--) if (ix>=0 && ix=0 && iyiy1) { for (iy=iy1+1; iy<=iy2; iy++) if (iy>=0 && iy=0 && ix=iy2; iy--) { if (iy>=0 && iy=0 && ix