1 /* atlc - arbitrary transmission line calculator, for the analysis of
2 transmission lines are directional couplers.
4 Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB).
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either package_version 2
9 of the License, or (at your option) any later package_version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 Dr. David Kirkby, e-mail drkirkby at ntlworld.com
39 #include "definitions.h"
42 /* names, colours and Ers are all arrays of 10. It would be better they were
43 in a structure as they are all linked closely, but they are not and I
44 can't be bothered to change it */
48 void write_bitmap(FILE *image_data_fp, struct transmission_line_properties xyz)
50 int colour_Er1=-1, colour_Er2=-1, vector_aligned;
54 unsigned char *image_data, *unaligned_image_vector;
56 get_Er1_and_Er2_colours(&colour_Er1, &colour_Er2);
61 /* We create an vector big enough for the image. Since rows are
62 aligned on 4-byte boundaries, we need to allow suffient space for
65 /* when aligning data on 4-byte boundaries, the
66 padding must be filled with 0's, to meet the
69 image_data=ustring(0,(W+3)*3*H);
70 unaligned_image_vector=ustring(0,(W+3)*3*H);
73 (void) memset((void *) (image_data),0x0,(size_t) ((W+3)*3*H));
75 for(memory_location=0; memory_location < (W+3)*3*H; ++ memory_location)
76 image_data[memory_location]=0;
77 #endif /* end of #ifdef HAVE_MEMSET */
80 /* Fill a vector with the initial (original) data on the
81 tline. This is not aligned in any way */
82 /* The following function 'fill_image_vector_with_data' is *not* in the file
83 fill_image_vector_with_data.c, but instead different versions of it are
84 located in files fill_rect_with_rect.c, fill_circ_with_circ.c,
85 fill_rect_with_circ.c and fill_circ_with_rect.c */
86 fill_image_vector_with_data(unaligned_image_vector, colour_Er1, colour_Er2, xyz);
88 /* put into the vector, in reverse order - i.e. from bottom to top and
89 align each row on 4-byte boundaries */
90 vector_aligned=align_bitmap_image(W, H, unaligned_image_vector,image_data);
91 write_bitmap_out(image_data, image_data_fp,vector_aligned, W, H);