summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_quadtree.h
blob: 2638d8ba593e6388003d5d1fb75704af538d9d9c (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
/* EINA - EFL data type library
 * Copyright (C) 2010 Cedric BAIL
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library;
 * if not, see <http://www.gnu.org/licenses/>.
 */

#ifndef EINA_QUADTREE_H_
#define EINA_QUADTREE_H_

#include "eina_config.h"

#include "eina_inlist.h"

typedef struct _Eina_QuadTree      Eina_QuadTree;
typedef struct _Eina_QuadTree_Item Eina_QuadTree_Item;

typedef enum {
   EINA_QUAD_LEFT,
   EINA_QUAD_RIGHT,
   EINA_QUAD_BOTH
} Eina_Quad_Direction;

typedef Eina_Quad_Direction (*Eina_Quad_Callback)(const void *object, size_t middle);

EAPI Eina_QuadTree      *eina_quadtree_new(size_t w, size_t h, Eina_Quad_Callback vertical, Eina_Quad_Callback horizontal);
EAPI void                eina_quadtree_free(Eina_QuadTree *q);
EAPI void                eina_quadtree_resize(Eina_QuadTree *q, size_t w, size_t h);

EAPI void                eina_quadtree_cycle(Eina_QuadTree *q);
EAPI void                eina_quadtree_increase(Eina_QuadTree_Item *object);

EAPI Eina_QuadTree_Item *eina_quadtree_add(Eina_QuadTree *q, const void *object);
EAPI Eina_Bool           eina_quadtree_del(Eina_QuadTree_Item *object);
EAPI Eina_Bool           eina_quadtree_change(Eina_QuadTree_Item *object);
EAPI Eina_Bool           eina_quadtree_hide(Eina_QuadTree_Item *object);
EAPI Eina_Bool           eina_quadtree_show(Eina_QuadTree_Item *object);

EAPI Eina_Inlist        *eina_quadtree_collide(Eina_QuadTree *q, int x, int y, int w, int h);
EAPI void               *eina_quadtree_object(Eina_Inlist *list);

#endif