1
/* bounding-box.h: operations on both real- and integer-valued bounding boxes.
3
* Copyright (C) 1992 Free Software Foundation, Inc.
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2, or (at your option)
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
#ifndef BOUNDING_BOX_H
21
#define BOUNDING_BOX_H
26
/* The bounding box's numbers are usually in Cartesian/Metafont
27
coordinates: (0,0) is towards the lower left. */
30
signed_4_bytes min_row, max_row;
31
signed_4_bytes min_col, max_col;
36
real min_row, max_row;
37
real min_col, max_col;
38
} real_bounding_box_type;
40
/* These accessing macros work for both types of bounding boxes, since
41
the member names are the same. */
42
#define MIN_ROW(bb) ((bb).min_row)
43
#define MAX_ROW(bb) ((bb).max_row)
44
#define MIN_COL(bb) ((bb).min_col)
45
#define MAX_COL(bb) ((bb).max_col)
47
/* See the comments at `get_character_bitmap' in gf_input.c for why the
48
width and height are treated asymetrically. */
49
#define BB_WIDTH(bb) (MAX_COL (bb) - MIN_COL (bb))
50
#define BB_HEIGHT(bb) (MAX_ROW (bb) - MIN_ROW (bb) + 1)
53
/* Convert a dimensions structure to an integer bounding box, and vice
55
extern bounding_box_type dimensions_to_bb (dimensions_type);
56
extern dimensions_type bb_to_dimensions (bounding_box_type);
59
/* Update the bounding box BB from the point P. */
60
extern void update_real_bounding_box (real_bounding_box_type *bb,
61
real_coordinate_type p);
62
extern void update_bounding_box (bounding_box_type *bb, coordinate_type p);
64
#endif /* not BOUNDING_BOX_H */