first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / graphiq / library / geometric / screen_rectangle.cpp
1
2
3
4 /*****************************************************************************\
5 *                                                                             *
6 *  Name   : screen_rectangle                                                  *
7 *  Author : Chris Koeritz                                                     *
8 *                                                                             *
9 *******************************************************************************
10 * Copyright (c) 1992-$now By Author.  This program is free software; you can  *
11 * redistribute it and/or modify it under the terms of the GNU General Public  *
12 * License as published by the Free Software Foundation; either version 2 of   *
13 * the License or (at your option) any later version.  This is online at:      *
14 *     http://www.fsf.org/copyleft/gpl.html                                    *
15 * Please send any updates to: fred@gruntose.com                               *
16 \*****************************************************************************/
17
18 #include "rectangle.h"
19 #include "screen_rectangle.h"
20
21 #include <basis/mutex.h>
22
23 #include <structures/static_memory_gremlin.h>
24
25 using namespace basis;
26
27 namespace geometric {
28
29 SAFE_STATIC_CONST(screen_point, screen_origin, (0, 0))
30
31 //////////////
32
33 #ifdef __WIN32__
34 screen_point::screen_point(const tagPOINT &original) : point<int>(original.x, original.y) {}
35
36 screen_point::operator tagPOINT()
37 { POINT to_return; to_return.x = x(); to_return.y = y(); return to_return; }
38 #endif
39
40 //////////////
41
42 screen_rectangle::screen_rectangle(const rectangle<int> &init)
43 : rectangle<int>(init) {}
44
45 screen_rectangle::screen_rectangle(const screen_point &vertex_1,
46     const screen_point &vertex_2)
47 : rectangle<int>(vertex_1, vertex_2) {}
48
49 screen_rectangle::screen_rectangle(int x_1, int y_1, int x_2, int y_2)
50 : rectangle<int>(x_1, y_1, x_2, y_2) {}
51
52 screen_rectangle screen_rectangle::order() const
53 { return screen_rectangle(top_left(), bottom_right()); }
54
55 screen_point screen_rectangle::top_left() const
56 { return rectangle<int>::bottom_left(); }
57
58 screen_point screen_rectangle::bottom_left() const
59 { return rectangle<int>::top_left(); }
60
61 screen_point screen_rectangle::top_right() const
62 { return rectangle<int>::bottom_right(); }
63
64 screen_point screen_rectangle::bottom_right() const
65 { return rectangle<int>::top_right(); }
66
67 #ifdef __WIN32__
68 screen_rectangle::screen_rectangle(const tagRECT &original)
69 : rectangle<int>(original.left, original.top, original.right, original.bottom)
70 {}
71
72 screen_rectangle::operator tagRECT() const
73 {
74   RECT to_return; to_return.left = left();
75   to_return.top = top(); to_return.right = right();
76   to_return.bottom = bottom(); return to_return;
77 }
78 #endif
79
80 } // namespace.
81
82
83