summaryrefslogtreecommitdiff
path: root/eel/eel-art-extensions.h
blob: 67f5aa041b61aae8b8df187ef635ab62e2955d44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */

/* eel-art-extensions.h - interface of libart extension functions.

   Copyright (C) 2000 Eazel, Inc.

   The Mate Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   The Mate Library 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with the Mate Library; see the file COPYING.LIB.  If not,
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.

   Authors: Darin Adler <darin@eazel.com>
            Ramiro Estrugo <ramiro@eazel.com>
*/

#ifndef EEL_ART_EXTENSIONS_H
#define EEL_ART_EXTENSIONS_H

#include <glib.h>

#ifdef __cplusplus
extern "C" {
#endif

    typedef struct
    {
        double x, y;
    } EelDPoint;

    typedef struct
    {
        int x;
        int y;
    } EelIPoint;

    typedef struct
    {
        double x0, y0, x1, y1;
    } EelDRect;

    typedef struct
    {
        /*< public >*/
        int x0, y0, x1, y1;
    } EelIRect;

    typedef struct
    {
        int width;
        int height;
    } EelDimensions;

    extern const EelDRect eel_drect_empty;
    extern const EelIRect eel_irect_empty;
    extern const EelIPoint eel_ipoint_max;
    extern const EelIPoint eel_ipoint_min;
    extern const EelIPoint eel_ipoint_zero;
    extern const EelDimensions eel_dimensions_empty;

    void     eel_irect_copy              (EelIRect       *dest,
                                          const EelIRect *src);
    void     eel_irect_union             (EelIRect       *dest,
                                          const EelIRect *src1,
                                          const EelIRect *src2);
    void     eel_irect_intersect         (EelIRect       *dest,
                                          const EelIRect *src1,
                                          const EelIRect *src2);
    gboolean eel_irect_equal             (EelIRect        rectangle_a,
                                          EelIRect        rectangle_b);
    gboolean eel_irect_hits_irect        (EelIRect        rectangle_a,
                                          EelIRect        rectangle_b);
    EelIRect eel_irect_offset_by         (EelIRect        rectangle,
                                          int             x,
                                          int             y);
    EelIRect eel_irect_scale_by          (EelIRect        rectangle,
                                          double          scale);
    gboolean eel_irect_is_empty          (const EelIRect *rectangle);
    gboolean eel_irect_contains_point    (EelIRect        outer_rectangle,
                                          int             x,
                                          int             y);
    EelIRect eel_irect_assign            (int             x,
                                          int             y,
                                          int             width,
                                          int             height);
    EelIRect eel_irect_assign_dimensions (int             x,
                                          int             y,
                                          EelDimensions   dimensions);
    int      eel_irect_get_width         (EelIRect        rectangle);
    int      eel_irect_get_height        (EelIRect        rectangle);
    EelIRect eel_irect_align             (EelIRect        container,
                                          int             aligned_width,
                                          int             aligned_height,
                                          float           x_alignment,
                                          float           y_alignment);


    void eel_drect_union (EelDRect       *dest,
                          const EelDRect *src1,
                          const EelDRect *src2);


    /* EelDimensions functions. */
    gboolean      eel_dimensions_are_empty        (EelDimensions dimensions);


#ifdef __cplusplus
}
#endif

#endif /* EEL_ART_EXTENSIONS_H */