]> granicus.if.org Git - imagemagick/blob - magick/cache-private.h
(no commit message)
[imagemagick] / magick / cache-private.h
1 /*
2   Copyright 1999-2010 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   PingCache
37 } CacheType;
38
39 typedef void
40   *Cache;
41
42 typedef const IndexPacket
43   *(*GetVirtualIndexesFromHandler)(const Image *);
44
45 typedef IndexPacket
46   *(*GetAuthenticIndexesFromHandler)(const Image *);
47
48 typedef MagickBooleanType
49   (*GetOneAuthenticPixelFromHandler)(Image *,const long,const long,
50     PixelPacket *,ExceptionInfo *),
51   (*GetOneVirtualPixelFromHandler)(const Image *,const VirtualPixelMethod,
52     const long,const long,PixelPacket *,ExceptionInfo *),
53   (*SyncAuthenticPixelsHandler)(Image *,ExceptionInfo *);
54
55 typedef const PixelPacket
56   *(*GetVirtualPixelHandler)(const Image *,const VirtualPixelMethod,const long,
57     const long,const unsigned long,const unsigned long,ExceptionInfo *),
58   *(*GetVirtualPixelsHandler)(const Image *);
59
60 typedef PixelPacket
61   *(*GetAuthenticPixelsHandler)(Image *,const long,const long,
62     const unsigned long,const unsigned long,ExceptionInfo *);
63
64 typedef PixelPacket
65   *(*GetAuthenticPixelsFromHandler)(const Image *);
66
67 typedef PixelPacket
68   *(*QueueAuthenticPixelsHandler)(Image *,const long,const long,
69     const unsigned long,const unsigned long,ExceptionInfo *);
70
71 typedef void
72   (*DestroyPixelHandler)(Image *);
73
74 typedef struct _CacheMethods
75 {
76   GetVirtualPixelHandler
77     get_virtual_pixel_handler;
78
79   GetVirtualPixelsHandler
80     get_virtual_pixels_handler;
81
82   GetVirtualIndexesFromHandler
83     get_virtual_indexes_from_handler;
84
85   GetOneVirtualPixelFromHandler
86     get_one_virtual_pixel_from_handler;
87
88   GetAuthenticPixelsHandler
89     get_authentic_pixels_handler;
90
91   GetAuthenticIndexesFromHandler
92     get_authentic_indexes_from_handler;
93
94   GetOneAuthenticPixelFromHandler
95     get_one_authentic_pixel_from_handler;
96
97   GetAuthenticPixelsFromHandler
98     get_authentic_pixels_from_handler;
99
100   QueueAuthenticPixelsHandler
101     queue_authentic_pixels_handler;
102
103   SyncAuthenticPixelsHandler
104     sync_authentic_pixels_handler;
105
106   DestroyPixelHandler
107     destroy_pixel_handler;
108
109 } CacheMethods;
110
111 typedef struct _NexusInfo
112    NexusInfo;
113
114 typedef struct _CacheInfo
115 {
116   ClassType
117     storage_class;
118
119   ColorspaceType
120     colorspace;
121
122   CacheType
123     type;
124
125   MapMode
126     mode;
127
128   MagickBooleanType
129     mapped;
130
131   unsigned long
132     columns,
133     rows;
134
135   MagickOffsetType
136     offset;
137
138   MagickSizeType
139     length;
140
141   VirtualPixelMethod
142     virtual_pixel_method;
143
144   MagickPixelPacket
145     virtual_pixel_color;
146
147   unsigned long
148     number_threads;
149
150   NexusInfo
151     **nexus_info;
152
153   PixelPacket
154     *pixels;
155
156   IndexPacket
157     *indexes;
158
159   MagickBooleanType
160     active_index_channel;
161
162   int
163     file;
164
165   char
166     filename[MaxTextExtent],
167     cache_filename[MaxTextExtent];
168
169   CacheMethods
170     methods;
171
172   RandomInfo
173     *random_info;
174
175   MagickBooleanType
176     debug;
177
178   MagickThreadType
179     id;
180
181   long
182     reference_count;
183
184   SemaphoreInfo
185     *semaphore,
186     *disk_semaphore;
187
188   time_t
189     timestamp;
190
191   unsigned long
192     signature;
193 } CacheInfo;
194
195 extern MagickExport Cache
196   AcquirePixelCache(const unsigned long),
197   ClonePixelCache(const Cache),
198   DestroyPixelCache(Cache),
199   GetImagePixelCache(Image *,const MagickBooleanType,ExceptionInfo *),
200   ReferencePixelCache(Cache);
201
202 extern MagickExport CacheType
203   GetPixelCacheType(const Image *);
204
205 extern MagickExport ClassType
206   GetPixelCacheStorageClass(const Cache);
207
208 extern MagickExport ColorspaceType
209   GetPixelCacheColorspace(const Cache);
210
211 extern MagickExport const IndexPacket
212   *GetVirtualIndexesFromNexus(const Cache,NexusInfo *);
213
214 extern MagickExport const PixelPacket
215   *GetVirtualPixelsFromNexus(const Image *,const VirtualPixelMethod,const long,
216     const long,const unsigned long,const unsigned long,NexusInfo *,
217     ExceptionInfo *),
218   *GetVirtualPixelsNexus(const Cache,NexusInfo *);
219
220 extern MagickExport IndexPacket
221   *GetPixelCacheNexusIndexes(const Cache,NexusInfo *);
222
223 extern MagickExport MagickBooleanType
224   SyncAuthenticPixelCacheNexus(Image *,NexusInfo *,ExceptionInfo *);
225
226 extern MagickExport MagickSizeType
227   GetPixelCacheNexusExtent(const Cache,NexusInfo *);
228
229 extern MagickExport NexusInfo
230   **AcquirePixelCacheNexus(const unsigned long),
231   **DestroyPixelCacheNexus(NexusInfo **,const unsigned long);
232
233 extern MagickExport PixelPacket
234   *GetAuthenticPixelCacheNexus(Image *,const long,const long,
235     const unsigned long,const unsigned long,NexusInfo *,ExceptionInfo *),
236   *GetPixelCacheNexusPixels(const Cache,NexusInfo *),
237   *QueueAuthenticNexus(Image *,const long,const long,const unsigned long,
238     const unsigned long,NexusInfo *,ExceptionInfo *);
239
240 extern MagickExport void
241   ClonePixelCacheMethods(Cache,const Cache),
242   GetPixelCacheTileSize(const Image *,unsigned long *,unsigned long *),
243   GetPixelCacheMethods(CacheMethods *),
244   SetPixelCacheMethods(Cache,CacheMethods *);
245
246 #if defined(__cplusplus) || defined(c_plusplus)
247 }
248 #endif
249
250 #endif