blob: d3d8dbe217c5cd4e1687daadd5c0e1db491f4f42 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
cristy16af1cb2009-12-11 21:38:29 +00002 Copyright 1999-2010 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>
26#include "magick/random_.h"
27#include "magick/thread-private.h"
28#include "magick/semaphore.h"
29
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
42typedef const IndexPacket
43 *(*GetVirtualIndexesFromHandler)(const Image *);
44
45typedef IndexPacket
46 *(*GetAuthenticIndexesFromHandler)(const Image *);
47
48typedef MagickBooleanType
cristybb503372010-05-27 20:51:26 +000049 (*GetOneAuthenticPixelFromHandler)(Image *,const ssize_t,const ssize_t,
cristy3ed852e2009-09-05 21:47:34 +000050 PixelPacket *,ExceptionInfo *),
51 (*GetOneVirtualPixelFromHandler)(const Image *,const VirtualPixelMethod,
cristybb503372010-05-27 20:51:26 +000052 const ssize_t,const ssize_t,PixelPacket *,ExceptionInfo *),
cristy3ed852e2009-09-05 21:47:34 +000053 (*SyncAuthenticPixelsHandler)(Image *,ExceptionInfo *);
54
55typedef const PixelPacket
cristybb503372010-05-27 20:51:26 +000056 *(*GetVirtualPixelHandler)(const Image *,const VirtualPixelMethod,const ssize_t,
57 const ssize_t,const size_t,const size_t,ExceptionInfo *),
cristy3ed852e2009-09-05 21:47:34 +000058 *(*GetVirtualPixelsHandler)(const Image *);
59
60typedef PixelPacket
cristybb503372010-05-27 20:51:26 +000061 *(*GetAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
62 const size_t,const size_t,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +000063
64typedef PixelPacket
65 *(*GetAuthenticPixelsFromHandler)(const Image *);
66
67typedef PixelPacket
cristybb503372010-05-27 20:51:26 +000068 *(*QueueAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
69 const size_t,const size_t,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +000070
71typedef void
72 (*DestroyPixelHandler)(Image *);
73
74typedef 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;
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
121 CacheType
122 type;
123
cristy87528ea2009-09-10 14:53:56 +0000124 MapMode
125 mode;
126
cristy3ed852e2009-09-05 21:47:34 +0000127 MagickBooleanType
128 mapped;
129
cristybb503372010-05-27 20:51:26 +0000130 size_t
cristy3ed852e2009-09-05 21:47:34 +0000131 columns,
132 rows;
133
134 MagickOffsetType
135 offset;
136
137 MagickSizeType
138 length;
139
140 VirtualPixelMethod
141 virtual_pixel_method;
142
cristyc3ec0d42010-04-07 01:18:08 +0000143 MagickPixelPacket
144 virtual_pixel_color;
145
cristybb503372010-05-27 20:51:26 +0000146 size_t
cristy3ed852e2009-09-05 21:47:34 +0000147 number_threads;
148
149 NexusInfo
150 **nexus_info;
151
152 PixelPacket
153 *pixels;
154
155 IndexPacket
156 *indexes;
157
158 MagickBooleanType
159 active_index_channel;
160
161 int
162 file;
163
164 char
165 filename[MaxTextExtent],
166 cache_filename[MaxTextExtent];
167
168 CacheMethods
169 methods;
170
171 RandomInfo
172 *random_info;
173
174 MagickBooleanType
175 debug;
176
177 MagickThreadType
178 id;
179
cristybb503372010-05-27 20:51:26 +0000180 ssize_t
cristy3ed852e2009-09-05 21:47:34 +0000181 reference_count;
182
183 SemaphoreInfo
184 *semaphore,
185 *disk_semaphore;
186
187 time_t
188 timestamp;
189
cristybb503372010-05-27 20:51:26 +0000190 size_t
cristy3ed852e2009-09-05 21:47:34 +0000191 signature;
192} CacheInfo;
193
194extern MagickExport Cache
cristybb503372010-05-27 20:51:26 +0000195 AcquirePixelCache(const size_t),
cristy3ed852e2009-09-05 21:47:34 +0000196 ClonePixelCache(const Cache),
197 DestroyPixelCache(Cache),
198 GetImagePixelCache(Image *,const MagickBooleanType,ExceptionInfo *),
199 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
210extern MagickExport const IndexPacket
211 *GetVirtualIndexesFromNexus(const Cache,NexusInfo *);
212
213extern MagickExport const PixelPacket
cristybb503372010-05-27 20:51:26 +0000214 *GetVirtualPixelsFromNexus(const Image *,const VirtualPixelMethod,const ssize_t,
215 const ssize_t,const size_t,const size_t,NexusInfo *,
cristy3ed852e2009-09-05 21:47:34 +0000216 ExceptionInfo *),
217 *GetVirtualPixelsNexus(const Cache,NexusInfo *);
218
219extern MagickExport IndexPacket
220 *GetPixelCacheNexusIndexes(const Cache,NexusInfo *);
221
222extern MagickExport MagickBooleanType
223 SyncAuthenticPixelCacheNexus(Image *,NexusInfo *,ExceptionInfo *);
224
225extern MagickExport MagickSizeType
226 GetPixelCacheNexusExtent(const Cache,NexusInfo *);
227
228extern MagickExport NexusInfo
cristybb503372010-05-27 20:51:26 +0000229 **AcquirePixelCacheNexus(const size_t),
230 **DestroyPixelCacheNexus(NexusInfo **,const size_t);
cristy3ed852e2009-09-05 21:47:34 +0000231
232extern MagickExport PixelPacket
cristybb503372010-05-27 20:51:26 +0000233 *GetAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t,
234 const size_t,const size_t,NexusInfo *,ExceptionInfo *),
cristy3ed852e2009-09-05 21:47:34 +0000235 *GetPixelCacheNexusPixels(const Cache,NexusInfo *),
cristybb503372010-05-27 20:51:26 +0000236 *QueueAuthenticNexus(Image *,const ssize_t,const ssize_t,const size_t,
237 const size_t,NexusInfo *,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +0000238
239extern MagickExport void
240 ClonePixelCacheMethods(Cache,const Cache),
cristybb503372010-05-27 20:51:26 +0000241 GetPixelCacheTileSize(const Image *,size_t *,size_t *),
cristy3ed852e2009-09-05 21:47:34 +0000242 GetPixelCacheMethods(CacheMethods *),
cristy3ed852e2009-09-05 21:47:34 +0000243 SetPixelCacheMethods(Cache,CacheMethods *);
244
245#if defined(__cplusplus) || defined(c_plusplus)
246}
247#endif
248
249#endif