~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/selection-to-path/bounding-box.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-06 13:30:41 UTC
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: james.westby@ubuntu.com-20081006133041-3panbkcanaymfsmp
Tags: upstream-2.6.0
ImportĀ upstreamĀ versionĀ 2.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* bounding-box.h: operations on both real- and integer-valued bounding boxes.
 
2
 *
 
3
 * Copyright (C) 1992 Free Software Foundation, Inc.
 
4
 *
 
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)
 
8
 * any later version.
 
9
 *
 
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.
 
14
 *
 
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.
 
18
 */
 
19
 
 
20
#ifndef BOUNDING_BOX_H
 
21
#define BOUNDING_BOX_H
 
22
 
 
23
#include "types.h"
 
24
 
 
25
 
 
26
/* The bounding box's numbers are usually in Cartesian/Metafont
 
27
   coordinates: (0,0) is towards the lower left.  */
 
28
typedef struct
 
29
{
 
30
  signed_4_bytes min_row, max_row;
 
31
  signed_4_bytes min_col, max_col;
 
32
} bounding_box_type;
 
33
 
 
34
typedef struct
 
35
{
 
36
  real min_row, max_row;
 
37
  real min_col, max_col;
 
38
} real_bounding_box_type;
 
39
 
 
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)
 
46
 
 
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)
 
51
 
 
52
 
 
53
/* Convert a dimensions structure to an integer bounding box, and vice
 
54
   versa.  */
 
55
extern bounding_box_type dimensions_to_bb (dimensions_type);
 
56
extern dimensions_type bb_to_dimensions (bounding_box_type);
 
57
 
 
58
 
 
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);
 
63
 
 
64
#endif /* not BOUNDING_BOX_H */