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
|
/*
Copyright (c) 2003 Bruno T. C. de Oliveira
LICENSE INFORMATION:
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
Copyright (c) 2002 Bruno T. C. de Oliveira
INFORMA��ES DE LICEN�A:
Este programa � um software de livre distribui��o; voc� pode
redistribu�-lo e/ou modific�-lo sob os termos da GNU General
Public License, conforme publicado pela Free Software Foundation,
pela vers�o 2 da licen�a ou qualquer vers�o posterior.
Este programa � distribu�do na esperan�a de que ele ser� �til
aos seus usu�rios, por�m, SEM QUAISQUER GARANTIAS; sem sequer
a garantia impl�cita de COMERCIABILIDADE ou DE ADEQUA��O A
QUALQUER FINALIDADE ESPEC�FICA. Consulte a GNU General Public
License para obter mais detalhes (uma c�pia acompanha este
programa, armazenada no arquivo COPYING).
*/
#ifndef _btco_aewan_vlayer_h
#define _btco_aewan_vlayer_h
#include "document.h"
typedef void (*vlayer_get_cell_t)(Cell *r_cell, int x, int y, void *ud);
/* A virtual layer. A virtual layer is a structure used when one wishes
* to represent a layer abstractly, where a callback function is responsible
* for returning the content of any given cell upon request. The layer
* does not exist physically (or perhaps it does, but we don't know),
* and we only rely on the function to retrieve the virtual layer's content.
* It is primarily used for export and display purposes where one wishes
* to have a unified interface to deal with actual layers, composites
* and all such things that are implemented differently but have the
* same "outside appearance". */
typedef struct VirtualLayer_ {
int width, height; /* dimensions of the virtual layer */
vlayer_get_cell_t get_cell; /* the callback that
* retrieves what is at cell (x,y) and records that
* in the structure pointed by r_cell */
void *user_data; /* arbitrary data passed as the ud parameter of get_cell */
} VirtualLayer;
/* Creates a virtual layer with the given dimensions, callback function,
* and user data */
VirtualLayer *vlayer_create(int width, int height, vlayer_get_cell_t get_cell,
void *user_data);
/* Creates a virtual layer based on the physical layer l. You MUST NOT DESTROY
* the layer l while the virtual layer exists. */
VirtualLayer *vlayer_create_from_layer(Layer *l);
/* Creates a virtual layer formed by making a composite from all the layers
* of the given document. You MUST NOT DESTROY the document while the
* virtual layer exists. */
VirtualLayer *vlayer_create_from_composite(Document *doc);
/* Destroys a virtual layer previously created with one of the creator
* functions */
void vlayer_destroy(VirtualLayer *vl);
/* Gets a cell from a virtual layer. The cell is filled in r_cell. */
void vlayer_get_cell(VirtualLayer *vl, Cell *r_cell, int x, int y);
#endif
|