X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Falign_bitmap_image.c;fp=src%2Falign_bitmap_image.c;h=85662891abd250ed591eb8526c4d4d56ffc77b4e;hb=ec2d2ab8e90a0c4b86ffc2385655c2fb27fcacd9;hp=0000000000000000000000000000000000000000;hpb=795fb988211df268a8f7724bd2f4493c594abee9;p=debian%2Fatlc diff --git a/src/align_bitmap_image.c b/src/align_bitmap_image.c new file mode 100644 index 0000000..8566289 --- /dev/null +++ b/src/align_bitmap_image.c @@ -0,0 +1,81 @@ +/* atlc - arbitrary transmission line calculator, for the analysis of +transmission lines are directional couplers. + +Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB). + +This program 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 package_version 2 +of the License, or (at your option) any later package_version. + +This program 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 this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +Dr. David Kirkby, e-mail drkirkby at gmail.com + +*/ +#include "config.h" + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDLIB_H +#include +#endif + +#include "definitions.h" + +/* a vector of length W*H called 'unaligned_image' contains the data. +This is written to a vector 'byte_aligned_image', which in general is longer +and is of length 'vector_aligned. This routine returns the lenght of the image, +once it have been byte-aligned + +The image 'unaligned_image' is expected to have the top of the image at the top of the +file. This routine puts the image, so the bottom of the image is at the beggining of the +vector 'byte_aligned_image' +*/ + +int align_bitmap_image(int W,int H,unsigned char *unaligned_image,unsigned char *byte_aligned_image) +{ + int i, j, vector_aligned=0, vector_original=0; + /* put into the vector, in reverse order - i.e. from bottom to top */ + for(j=0;j