blob: 5a2ff6254054b28fac2ddfa9d28c261d313dfcb1 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
cristy7e41fe82010-12-04 23:12:08 +00002 Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization
cristy3ed852e2009-09-05 21:47:34 +00003 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)
22extern "C" {
23#endif
24
25#include <time.h>
cristy4c08aed2011-07-01 19:47:50 +000026#include "MagickCore/random_.h"
27#include "MagickCore/thread-private.h"
28#include "MagickCore/semaphore.h"
cristy3ed852e2009-09-05 21:47:34 +000029
30typedef enum
31{
32 UndefinedCache,
33 MemoryCache,
34 MapCache,
cristy73724512010-04-12 14:43:14 +000035 DiskCache,
36 PingCache
cristy3ed852e2009-09-05 21:47:34 +000037} CacheType;
38
39typedef void
40 *Cache;
41
cristy3ed852e2009-09-05 21:47:34 +000042typedef MagickBooleanType
cristybb503372010-05-27 20:51:26 +000043 (*GetOneAuthenticPixelFromHandler)(Image *,const ssize_t,const ssize_t,
cristy3ed852e2009-09-05 21:47:34 +000044 PixelPacket *,ExceptionInfo *),
45 (*GetOneVirtualPixelFromHandler)(const Image *,const VirtualPixelMethod,
cristybb503372010-05-27 20:51:26 +000046 const ssize_t,const ssize_t,PixelPacket *,ExceptionInfo *),
cristy3ed852e2009-09-05 21:47:34 +000047 (*SyncAuthenticPixelsHandler)(Image *,ExceptionInfo *);
48
cristy4c08aed2011-07-01 19:47:50 +000049typedef const Quantum
cristy5ed838e2010-05-31 00:05:35 +000050 *(*GetVirtualPixelHandler)(const Image *,const VirtualPixelMethod,
51 const ssize_t,const ssize_t,const size_t,const size_t,ExceptionInfo *),
cristy3ed852e2009-09-05 21:47:34 +000052 *(*GetVirtualPixelsHandler)(const Image *);
53
cristy4c08aed2011-07-01 19:47:50 +000054typedef const void
55 *(*GetVirtualMetacontentFromHandler)(const Image *);
56
57typedef Quantum
cristybb503372010-05-27 20:51:26 +000058 *(*GetAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
59 const size_t,const size_t,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +000060
cristy4c08aed2011-07-01 19:47:50 +000061typedef Quantum
cristy3ed852e2009-09-05 21:47:34 +000062 *(*GetAuthenticPixelsFromHandler)(const Image *);
63
cristy4c08aed2011-07-01 19:47:50 +000064typedef Quantum
cristybb503372010-05-27 20:51:26 +000065 *(*QueueAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
66 const size_t,const size_t,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +000067
68typedef void
69 (*DestroyPixelHandler)(Image *);
70
cristy4c08aed2011-07-01 19:47:50 +000071typedef void
72 *(*GetAuthenticMetacontentFromHandler)(const Image *);
73
cristy3ed852e2009-09-05 21:47:34 +000074typedef struct _CacheMethods
75{
76 GetVirtualPixelHandler
77 get_virtual_pixel_handler;
78
79 GetVirtualPixelsHandler
80 get_virtual_pixels_handler;
81
cristy4c08aed2011-07-01 19:47:50 +000082 GetVirtualMetacontentFromHandler
83 get_virtual_metacontent_from_handler;
cristy3ed852e2009-09-05 21:47:34 +000084
85 GetOneVirtualPixelFromHandler
86 get_one_virtual_pixel_from_handler;
87
88 GetAuthenticPixelsHandler
89 get_authentic_pixels_handler;
90
cristy4c08aed2011-07-01 19:47:50 +000091 GetAuthenticMetacontentFromHandler
92 get_authentic_metacontent_from_handler;
cristy3ed852e2009-09-05 21:47:34 +000093
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;
cristy3ed852e2009-09-05 21:47:34 +0000108} CacheMethods;
109
110typedef struct _NexusInfo
111 NexusInfo;
112
113typedef struct _CacheInfo
114{
115 ClassType
116 storage_class;
117
118 ColorspaceType
119 colorspace;
120
cristybcc1fdc2011-04-29 13:06:35 +0000121 size_t
cristy4c08aed2011-07-01 19:47:50 +0000122 metacontent_extent,
cristyed231572011-07-14 02:18:59 +0000123 number_channels;
cristy0d267172011-04-25 20:13:48 +0000124
cristy3ed852e2009-09-05 21:47:34 +0000125 CacheType
126 type;
127
cristy87528ea2009-09-10 14:53:56 +0000128 MapMode
129 mode;
130
cristy3ed852e2009-09-05 21:47:34 +0000131 MagickBooleanType
132 mapped;
133
cristybb503372010-05-27 20:51:26 +0000134 size_t
cristy3ed852e2009-09-05 21:47:34 +0000135 columns,
136 rows;
137
138 MagickOffsetType
139 offset;
140
141 MagickSizeType
142 length;
143
144 VirtualPixelMethod
145 virtual_pixel_method;
146
cristy4c08aed2011-07-01 19:47:50 +0000147 PixelInfo
cristyc3ec0d42010-04-07 01:18:08 +0000148 virtual_pixel_color;
149
cristybb503372010-05-27 20:51:26 +0000150 size_t
cristy3ed852e2009-09-05 21:47:34 +0000151 number_threads;
152
153 NexusInfo
154 **nexus_info;
155
cristy4c08aed2011-07-01 19:47:50 +0000156 Quantum
cristy3ed852e2009-09-05 21:47:34 +0000157 *pixels;
158
cristy4c08aed2011-07-01 19:47:50 +0000159 void
160 *metacontent;
cristy3ed852e2009-09-05 21:47:34 +0000161
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
cristybb503372010-05-27 20:51:26 +0000181 ssize_t
cristy3ed852e2009-09-05 21:47:34 +0000182 reference_count;
183
184 SemaphoreInfo
185 *semaphore,
186 *disk_semaphore;
187
188 time_t
189 timestamp;
190
cristybb503372010-05-27 20:51:26 +0000191 size_t
cristy3ed852e2009-09-05 21:47:34 +0000192 signature;
193} CacheInfo;
194
195extern MagickExport Cache
cristybb503372010-05-27 20:51:26 +0000196 AcquirePixelCache(const size_t),
cristy3ed852e2009-09-05 21:47:34 +0000197 ClonePixelCache(const Cache),
198 DestroyPixelCache(Cache),
cristy3ed852e2009-09-05 21:47:34 +0000199 ReferencePixelCache(Cache);
200
cristyb32b90a2009-09-07 21:45:48 +0000201extern MagickExport CacheType
202 GetPixelCacheType(const Image *);
203
cristy3ed852e2009-09-05 21:47:34 +0000204extern MagickExport ClassType
205 GetPixelCacheStorageClass(const Cache);
206
207extern MagickExport ColorspaceType
208 GetPixelCacheColorspace(const Cache);
209
cristy3ed852e2009-09-05 21:47:34 +0000210
cristy4c08aed2011-07-01 19:47:50 +0000211extern MagickExport const Quantum
cristy5ed838e2010-05-31 00:05:35 +0000212 *GetVirtualPixelsFromNexus(const Image *,const VirtualPixelMethod,
213 const ssize_t,const ssize_t,const size_t,const size_t,NexusInfo *,
cristy3ed852e2009-09-05 21:47:34 +0000214 ExceptionInfo *),
215 *GetVirtualPixelsNexus(const Cache,NexusInfo *);
216
cristy4c08aed2011-07-01 19:47:50 +0000217extern MagickExport const void
218 *GetVirtualMetacontentFromNexus(const Cache,NexusInfo *);
cristy3ed852e2009-09-05 21:47:34 +0000219
220extern MagickExport MagickBooleanType
221 SyncAuthenticPixelCacheNexus(Image *,NexusInfo *,ExceptionInfo *);
222
223extern MagickExport MagickSizeType
224 GetPixelCacheNexusExtent(const Cache,NexusInfo *);
225
226extern MagickExport NexusInfo
cristybb503372010-05-27 20:51:26 +0000227 **AcquirePixelCacheNexus(const size_t),
228 **DestroyPixelCacheNexus(NexusInfo **,const size_t);
cristy3ed852e2009-09-05 21:47:34 +0000229
cristy4c08aed2011-07-01 19:47:50 +0000230extern MagickExport Quantum
cristybb503372010-05-27 20:51:26 +0000231 *GetAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t,
232 const size_t,const size_t,NexusInfo *,ExceptionInfo *),
cristy3ed852e2009-09-05 21:47:34 +0000233 *GetPixelCacheNexusPixels(const Cache,NexusInfo *),
cristybb503372010-05-27 20:51:26 +0000234 *QueueAuthenticNexus(Image *,const ssize_t,const ssize_t,const size_t,
235 const size_t,NexusInfo *,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +0000236
cristy0d267172011-04-25 20:13:48 +0000237extern MagickExport size_t
238 GetPixelCacheChannels(const Cache);
239
cristy3ed852e2009-09-05 21:47:34 +0000240extern MagickExport void
241 ClonePixelCacheMethods(Cache,const Cache),
cristybb503372010-05-27 20:51:26 +0000242 GetPixelCacheTileSize(const Image *,size_t *,size_t *),
cristy3ed852e2009-09-05 21:47:34 +0000243 GetPixelCacheMethods(CacheMethods *),
cristy3ed852e2009-09-05 21:47:34 +0000244 SetPixelCacheMethods(Cache,CacheMethods *);
245
cristy4c08aed2011-07-01 19:47:50 +0000246extern MagickExport void
247 *GetPixelCacheNexusMetacontent(const Cache,NexusInfo *);
248
cristy3ed852e2009-09-05 21:47:34 +0000249#if defined(__cplusplus) || defined(c_plusplus)
250}
251#endif
252
253#endif