]> granicus.if.org Git - imagemagick/blob - MagickCore/cache-private.h
(no commit message)
[imagemagick] / MagickCore / cache-private.h
1 /*
2   Copyright 1999-2011 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 "MagickCore/random_.h"
27 #include "MagickCore/thread-private.h"
28 #include "MagickCore/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 MagickBooleanType
43   (*GetOneAuthenticPixelFromHandler)(Image *,const ssize_t,const ssize_t,
44     PixelPacket *,ExceptionInfo *),
45   (*GetOneVirtualPixelFromHandler)(const Image *,const VirtualPixelMethod,
46     const ssize_t,const ssize_t,PixelPacket *,ExceptionInfo *),
47   (*SyncAuthenticPixelsHandler)(Image *,ExceptionInfo *);
48
49 typedef const Quantum
50   *(*GetVirtualPixelHandler)(const Image *,const VirtualPixelMethod,
51     const ssize_t,const ssize_t,const size_t,const size_t,ExceptionInfo *),
52   *(*GetVirtualPixelsHandler)(const Image *);
53
54 typedef const void
55   *(*GetVirtualMetacontentFromHandler)(const Image *);
56
57 typedef Quantum
58   *(*GetAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
59     const size_t,const size_t,ExceptionInfo *);
60
61 typedef Quantum
62   *(*GetAuthenticPixelsFromHandler)(const Image *);
63
64 typedef Quantum
65   *(*QueueAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
66     const size_t,const size_t,ExceptionInfo *);
67
68 typedef void
69   (*DestroyPixelHandler)(Image *);
70
71 typedef void
72   *(*GetAuthenticMetacontentFromHandler)(const Image *);
73
74 typedef struct _CacheMethods
75 {
76   GetVirtualPixelHandler
77     get_virtual_pixel_handler;
78
79   GetVirtualPixelsHandler
80     get_virtual_pixels_handler;
81
82   GetVirtualMetacontentFromHandler
83     get_virtual_metacontent_from_handler;
84
85   GetOneVirtualPixelFromHandler
86     get_one_virtual_pixel_from_handler;
87
88   GetAuthenticPixelsHandler
89     get_authentic_pixels_handler;
90
91   GetAuthenticMetacontentFromHandler
92     get_authentic_metacontent_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 } 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   size_t
122     metacontent_extent,
123     pixel_channels;
124
125   CacheType
126     type;
127
128   MapMode
129     mode;
130
131   MagickBooleanType
132     mapped;
133
134   size_t
135     columns,
136     rows;
137
138   MagickOffsetType
139     offset;
140
141   MagickSizeType
142     length;
143
144   VirtualPixelMethod
145     virtual_pixel_method;
146
147   PixelInfo
148     virtual_pixel_color;
149
150   size_t
151     number_threads;
152
153   NexusInfo
154     **nexus_info;
155
156   Quantum
157     *pixels;
158
159   void
160     *metacontent;
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   ssize_t
182     reference_count;
183
184   SemaphoreInfo
185     *semaphore,
186     *disk_semaphore;
187
188   time_t
189     timestamp;
190
191   size_t
192     signature;
193 } CacheInfo;
194
195 extern MagickExport Cache
196   AcquirePixelCache(const size_t),
197   ClonePixelCache(const Cache),
198   DestroyPixelCache(Cache),
199   ReferencePixelCache(Cache);
200
201 extern MagickExport CacheType
202   GetPixelCacheType(const Image *);
203
204 extern MagickExport ClassType
205   GetPixelCacheStorageClass(const Cache);
206
207 extern MagickExport ColorspaceType
208   GetPixelCacheColorspace(const Cache);
209
210
211 extern MagickExport const Quantum
212   *GetVirtualPixelsFromNexus(const Image *,const VirtualPixelMethod,
213     const ssize_t,const ssize_t,const size_t,const size_t,NexusInfo *,
214     ExceptionInfo *),
215   *GetVirtualPixelsNexus(const Cache,NexusInfo *);
216
217 extern MagickExport const void
218   *GetVirtualMetacontentFromNexus(const Cache,NexusInfo *);
219
220 extern MagickExport MagickBooleanType
221   SyncAuthenticPixelCacheNexus(Image *,NexusInfo *,ExceptionInfo *);
222
223 extern MagickExport MagickSizeType
224   GetPixelCacheNexusExtent(const Cache,NexusInfo *);
225
226 extern MagickExport NexusInfo
227   **AcquirePixelCacheNexus(const size_t),
228   **DestroyPixelCacheNexus(NexusInfo **,const size_t);
229
230 extern MagickExport Quantum
231   *GetAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t,
232     const size_t,const size_t,NexusInfo *,ExceptionInfo *),
233   *GetPixelCacheNexusPixels(const Cache,NexusInfo *),
234   *QueueAuthenticNexus(Image *,const ssize_t,const ssize_t,const size_t,
235     const size_t,NexusInfo *,ExceptionInfo *);
236
237 extern MagickExport size_t
238   GetPixelCacheChannels(const Cache);
239
240 extern MagickExport void
241   ClonePixelCacheMethods(Cache,const Cache),
242   GetPixelCacheTileSize(const Image *,size_t *,size_t *),
243   GetPixelCacheMethods(CacheMethods *),
244   SetPixelCacheMethods(Cache,CacheMethods *);
245
246 extern MagickExport void
247   *GetPixelCacheNexusMetacontent(const Cache,NexusInfo *);
248
249 #if defined(__cplusplus) || defined(c_plusplus)
250 }
251 #endif
252
253 #endif