temp-buf.h 2.26 KB
Newer Older
Elliot Lee's avatar
Elliot Lee committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* The GIMP -- an image manipulation program
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * 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
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Elliot Lee's avatar
Elliot Lee committed
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
 */
#ifndef __TEMP_BUF_H__
#define __TEMP_BUF_H__


typedef struct _temp_buf TempBuf;
typedef struct _temp_buf MaskBuf;

struct _temp_buf
{
  int             bytes;      /*  The necessary info  */
  int             width;
  int             height;
  int             x, y;       /*  origin of data source  */

  int             swapped;    /*  flag indicating whether buf is cached to disk  */
  char *          filename;   /*  filename of cached information  */

  unsigned char * data;       /*  The data buffer     */
};


/*  The temp buffer functions  */

TempBuf *         temp_buf_new        (int, int, int, int, int, unsigned char *);
TempBuf *         temp_buf_copy       (TempBuf *, TempBuf *);
TempBuf *         temp_buf_resize     (TempBuf *, int, int, int, int, int);
TempBuf *         temp_buf_copy_area  (TempBuf *, TempBuf *, int, int, int, int, int);
void              temp_buf_free       (TempBuf *);
unsigned char *   temp_buf_data       (TempBuf *);

/* The mask buffer functions  */

MaskBuf *         mask_buf_new        (int, int);
void              mask_buf_free       (MaskBuf *);
unsigned char *   mask_buf_data       (MaskBuf *);

/*  The disk caching functions  */

void              temp_buf_swap       (TempBuf *);
void              temp_buf_unswap     (TempBuf *);
void              temp_buf_swap_free  (TempBuf *);


/*  Called by app_procs:exit to free up the cached undo buffer  */

void              swapping_free       (void);

#endif  /*  __TEMP_BUF_H__  */