/* Copyright (C) 2001 Johan Rydberg. All Rights Reserved. This file is part of Crust. 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 version 2 of the License, or (at your option) any later 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. */ #ifndef __GraphicsFoundation_GFGeometry_h #define __GraphicsFoundation_GFGeometry_h 1 #include #include struct GFPoint { float x; float y; }; typedef struct GFPoint GFPoint; struct GFSize { float width; float height; }; typedef struct GFSize GFSize; /* Rectangle. ORIGIN is the origin of the rectangle, SIZE is the size. */ struct GFRect { GFPoint origin; GFSize size; }; typedef struct GFRect GFRect; /* Returns true if SRC is an empty rectangle. */ GF_EXTERN bool GFRectIsEmpty (GFRect src); /* Find union of two rectangles. Returns the result. */ GF_EXTERN GFRect GFRectUnion (GFRect src1, GFRect src2); /* Intersect two rectangles. Returns the result. */ GF_EXTERN GFRect GFRectIntersect(GFRect src1, GFRect src2); /* Creates a rectangle from (X, Y, W, H). */ GF_EXTERN GFRect GFRectMake (float x, float y, float w, float h); /* Zero point [ 0.0, 0.0 ]. */ GF_EXTERN GFPoint GFPointZero; /* Returns a point for (X, Y). */ GF_EXTERN GFPoint GFPointMake (float x, float y); /* Returns the result from A - B. */ GF_EXTERN GFPoint GFPointSubtract (GFPoint a, GFPoint b); /* Returns a size for (W, H). */ GF_EXTERN GFSize GFSizeMake (float w, float h); #endif /* GFGeometry.h */