/usr/include/grits/objects/grits-tile.h is in libgrits-dev 0.8.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | /*
* Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GRITS_TILE_H__
#define __GRITS_TILE_H__
#include <glib.h>
#include <glib-object.h>
#include "grits-object.h"
#define GRITS_TYPE_TILE (grits_tile_get_type())
#define GRITS_TILE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GRITS_TYPE_TILE, GritsTile))
#define GRITS_IS_TILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GRITS_TYPE_TILE))
#define GRITS_TILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRITS_TYPE_TILE, GritsTileClass))
#define GRITS_IS_TILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRITS_TYPE_TILE))
#define GRITS_TILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRITS_TYPE_TILE, GritsTileClass))
typedef struct _GritsTile GritsTile;
typedef struct _GritsTileClass GritsTileClass;
struct _GritsTile {
GritsObject parent_instance;
/* Pointer to the tile data */
gpointer data;
gboolean load;
/* Drawing order */
gint zindex;
/* North,South,East,West limits */
GritsBounds edge;
/* Texture mapping coordinates */
GritsBounds coords;
/* Pointers to parent/child nodes */
GritsTile *parent;
GritsTile *children[2][2];
/* Last access time (for garbage collection) */
time_t atime;
/* Projection used by tile data */
GritsProj proj;
/* Internal data to the tile */
guint tex;
GdkPixbuf *pixbuf;
guchar *pixels;
gint width;
gint height;
gint alpha;
};
struct _GritsTileClass {
GritsObjectClass parent_class;
};
/**
* GritsTileLoadFunc:
* @tile: the tile to load
* @user_data: data paseed to the function
*
* Used to load the image data associated with a tile. For GritsOpenGL, this
* function should store the OpenGL texture number in the tiles data field.
*/
typedef void (*GritsTileLoadFunc)(GritsTile *tile, gpointer user_data);
/**
* GritsTileFreeFunc:
* @tile: the tile to free
* @user_data: data paseed to the function
*
* Used to free the image data associated with a tile
*/
typedef void (*GritsTileFreeFunc)(GritsTile *tile, gpointer user_data);
/* Forech functions */
/**
* grits_tile_foreach:
* @parent: the #GritsTile to iterate over
* @child: a pointer to a #GritsTile to store the current subtile
*
* Iterate over each imediate subtile of @parent.
*/
#define grits_tile_foreach(parent, child) \
for (int _x = 0; _x < G_N_ELEMENTS(parent->children); _x++) \
for (int _y = 0; child = parent->children[_x][_y], \
_y < G_N_ELEMENTS(parent->children[_x]); _y++)
/**
* grits_tile_foreach_index:
* @parent: the #GritsTile to iterate over
* @x: integer to store the x index of the current subtile
* @y: integer to store the y index of the current subtile
*
* Iterate over each imediate subtile of @parent.
*/
#define grits_tile_foreach_index(parent, x, y) \
for (x = 0; x < G_N_ELEMENTS(parent->children); x++) \
for (y = 0; y < G_N_ELEMENTS(parent->children[x]); y++)
/* Path to string table, keep in sync with tile->children */
extern gchar *grits_tile_path_table[2][2];
GType grits_tile_get_type(void);
/* Allocate a new Tile */
GritsTile *grits_tile_new(GritsTile *parent,
gdouble n, gdouble s, gdouble e, gdouble w);
/* Return a string representation of the tile's path */
gchar *grits_tile_get_path(GritsTile *child);
/* Update a root tile */
/* Based on eye distance */
void grits_tile_update(GritsTile *root, GritsPoint *eye,
gdouble res, gint width, gint height,
GritsTileLoadFunc load_func, gpointer user_data);
/* Load tile data from pixel buffer */
gboolean grits_tile_load_pixels(GritsTile *tile, guchar *pixels,
gint width, gint height, gint channels);
/* Load tile data from a GdkPixbuf */
gboolean grits_tile_load_pixbuf(GritsTile *tile, GdkPixbuf *pixbuf);
/* Load tile data from an image file */
gboolean grits_tile_load_file(GritsTile *tile, const gchar *file);
/* Find the leaf tile containing lat-lon */
GritsTile *grits_tile_find(GritsTile *root, gdouble lat, gdouble lon);
/* Delete nodes that haven't been accessed since atime */
GritsTile *grits_tile_gc(GritsTile *root, time_t atime,
GritsTileFreeFunc free_func, gpointer user_data);
/* Free a tile and all it's children */
void grits_tile_free(GritsTile *root,
GritsTileFreeFunc free_func, gpointer user_data);
#endif
|