]> granicus.if.org Git - imagemagick/blob - magick/cache-private.h
(no commit message)
[imagemagick] / magick / cache-private.h
1 /*
2   Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization
3   dedicated to making software imaging solutions freely available.
4   
5   You may not use this file except in compliance with the License.
6   obtain a copy of the License at
7   
8     http://www.imagemagick.org/script/license.php
9   
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15
16   MagickCore cache private methods.
17 */
18 #ifndef _MAGICKCORE_CACHE_PRIVATE_H
19 #define _MAGICKCORE_CACHE_PRIVATE_H
20
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24
25 #include <time.h>
26 #include "magick/random_.h"
27 #include "magick/thread-private.h"
28 #include "magick/semaphore.h"
29
30 typedef enum
31 {
32   UndefinedCache,
33   MemoryCache,
34   MapCache,
35   DiskCache
36 } CacheType;
37
38 typedef void
39   *Cache;
40
41 typedef const IndexPacket
42   *(*GetVirtualIndexesFromHandler)(const Image *);
43
44 typedef IndexPacket
45   *(*GetAuthenticIndexesFromHandler)(const Image *);
46
47 typedef MagickBooleanType
48   (*GetOneAuthenticPixelFromHandler)(Image *,const long,const long,
49     PixelPacket *,ExceptionInfo *),
50   (*GetOneVirtualPixelFromHandler)(const Image *,const VirtualPixelMethod,
51     const long,const long,PixelPacket *,ExceptionInfo *),
52   (*SyncAuthenticPixelsHandler)(Image *,ExceptionInfo *);
53
54 typedef const PixelPacket
55   *(*GetVirtualPixelHandler)(const Image *,const VirtualPixelMethod,const long,
56     const long,const unsigned long,const unsigned long,ExceptionInfo *),
57   *(*GetVirtualPixelsHandler)(const Image *);
58
59 typedef PixelPacket
60   *(*GetAuthenticPixelsHandler)(Image *,const long,const long,
61     const unsigned long,const unsigned long,ExceptionInfo *);
62
63 typedef PixelPacket
64   *(*GetAuthenticPixelsFromHandler)(const Image *);
65
66 typedef PixelPacket
67   *(*QueueAuthenticPixelsHandler)(Image *,const long,const long,
68     const unsigned long,const unsigned long,ExceptionInfo *);
69
70 typedef void
71   (*DestroyPixelHandler)(Image *);
72
73 typedef struct _CacheMethods
74 {
75   GetVirtualPixelHandler
76     get_virtual_pixel_handler;
77
78   GetVirtualPixelsHandler
79     get_virtual_pixels_handler;
80
81   GetVirtualIndexesFromHandler
82     get_virtual_indexes_from_handler;
83
84   GetOneVirtualPixelFromHandler
85     get_one_virtual_pixel_from_handler;
86
87   GetAuthenticPixelsHandler
88     get_authentic_pixels_handler;
89
90   GetAuthenticIndexesFromHandler
91     get_authentic_indexes_from_handler;
92
93   GetOneAuthenticPixelFromHandler
94     get_one_authentic_pixel_from_handler;
95
96   GetAuthenticPixelsFromHandler
97     get_authentic_pixels_from_handler;
98
99   QueueAuthenticPixelsHandler
100     queue_authentic_pixels_handler;
101
102   SyncAuthenticPixelsHandler
103     sync_authentic_pixels_handler;
104
105   DestroyPixelHandler
106     destroy_pixel_handler;
107
108 } CacheMethods;
109
110 typedef struct _NexusInfo
111    NexusInfo;
112
113 typedef struct _CacheInfo
114 {
115   ClassType
116     storage_class;
117
118   ColorspaceType
119     colorspace;
120
121   CacheType
122     type;
123
124   MagickBooleanType
125     mapped;
126
127   unsigned long
128     columns,
129     rows;
130
131   MagickOffsetType
132     offset;
133
134   MagickSizeType
135     length;
136
137   VirtualPixelMethod
138     virtual_pixel_method;
139
140   unsigned long
141     number_threads;
142
143   NexusInfo
144     **nexus_info;
145
146   PixelPacket
147     *pixels;
148
149   IndexPacket
150     *indexes;
151
152   MagickBooleanType
153     active_index_channel;
154
155   int
156     file;
157
158   char
159     filename[MaxTextExtent],
160     cache_filename[MaxTextExtent];
161
162   CacheMethods
163     methods;
164
165   RandomInfo
166     *random_info;
167
168   MagickBooleanType
169     debug;
170
171   MagickThreadType
172     id;
173
174   long
175     reference_count;
176
177   SemaphoreInfo
178     *semaphore,
179     *disk_semaphore;
180
181   time_t
182     timestamp;
183
184   unsigned long
185     signature;
186 } CacheInfo;
187
188 extern MagickExport Cache
189   AcquirePixelCache(const unsigned long),
190   ClonePixelCache(const Cache),
191   DestroyPixelCache(Cache),
192   GetImagePixelCache(Image *,const MagickBooleanType,ExceptionInfo *),
193   ReferencePixelCache(Cache);
194
195 extern MagickExport CacheType
196   GetPixelCacheType(const Image *);
197
198 extern MagickExport ClassType
199   GetPixelCacheStorageClass(const Cache);
200
201 extern MagickExport ColorspaceType
202   GetPixelCacheColorspace(const Cache);
203
204 extern MagickExport const IndexPacket
205   *GetVirtualIndexesFromNexus(const Cache,NexusInfo *);
206
207 extern MagickExport const PixelPacket
208   *GetVirtualPixelsFromNexus(const Image *,const VirtualPixelMethod,const long,
209     const long,const unsigned long,const unsigned long,NexusInfo *,
210     ExceptionInfo *),
211   *GetVirtualPixelsNexus(const Cache,NexusInfo *);
212
213 extern MagickExport IndexPacket
214   *GetPixelCacheNexusIndexes(const Cache,NexusInfo *);
215
216 extern MagickExport MagickBooleanType
217   SyncAuthenticPixelCacheNexus(Image *,NexusInfo *,ExceptionInfo *);
218
219 extern MagickExport MagickSizeType
220   GetPixelCacheNexusExtent(const Cache,NexusInfo *);
221
222 extern MagickExport NexusInfo
223   **AcquirePixelCacheNexus(const unsigned long),
224   **DestroyPixelCacheNexus(NexusInfo **,const unsigned long);
225
226 extern MagickExport PixelPacket
227   *GetAuthenticPixelCacheNexus(Image *,const long,const long,
228     const unsigned long,const unsigned long,NexusInfo *,ExceptionInfo *),
229   *GetPixelCacheNexusPixels(const Cache,NexusInfo *),
230   *QueueAuthenticNexus(Image *,const long,const long,const unsigned long,
231     const unsigned long,NexusInfo *,ExceptionInfo *);
232
233 extern MagickExport void
234   ClonePixelCacheMethods(Cache,const Cache),
235   GetPixelCacheTileSize(const Image *,unsigned long *,unsigned long *),
236   GetPixelCacheMethods(CacheMethods *),
237   SetPixelCacheMethods(Cache,CacheMethods *);
238
239 #if defined(__cplusplus) || defined(c_plusplus)
240 }
241 #endif
242
243 #endif