blob: 8990852fc017bc0899f4b35b14f8dffdefdaca92 [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.
cristy222b19c2011-08-04 01:35:11 +00004
cristy3ed852e2009-09-05 21:47:34 +00005 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
cristy222b19c2011-08-04 01:35:11 +00007
cristy3ed852e2009-09-05 21:47:34 +00008 http://www.imagemagick.org/script/license.php
cristy222b19c2011-08-04 01:35:11 +00009
cristy3ed852e2009-09-05 21:47:34 +000010 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>
cristyaf894d72011-08-06 23:03:10 +000026#include "MagickCore/cache.h"
cristy4c08aed2011-07-01 19:47:50 +000027#include "MagickCore/random_.h"
28#include "MagickCore/thread-private.h"
29#include "MagickCore/semaphore.h"
cristy3ed852e2009-09-05 21:47:34 +000030
31typedef enum
32{
33 UndefinedCache,
34 MemoryCache,
35 MapCache,
cristy73724512010-04-12 14:43:14 +000036 DiskCache,
37 PingCache
cristy3ed852e2009-09-05 21:47:34 +000038} CacheType;
39
cristy3ed852e2009-09-05 21:47:34 +000040typedef MagickBooleanType
cristybb503372010-05-27 20:51:26 +000041 (*GetOneAuthenticPixelFromHandler)(Image *,const ssize_t,const ssize_t,
cristy3ed852e2009-09-05 21:47:34 +000042 PixelPacket *,ExceptionInfo *),
43 (*GetOneVirtualPixelFromHandler)(const Image *,const VirtualPixelMethod,
cristybb503372010-05-27 20:51:26 +000044 const ssize_t,const ssize_t,PixelPacket *,ExceptionInfo *),
cristy3ed852e2009-09-05 21:47:34 +000045 (*SyncAuthenticPixelsHandler)(Image *,ExceptionInfo *);
46
cristy4c08aed2011-07-01 19:47:50 +000047typedef const Quantum
cristy5ed838e2010-05-31 00:05:35 +000048 *(*GetVirtualPixelHandler)(const Image *,const VirtualPixelMethod,
49 const ssize_t,const ssize_t,const size_t,const size_t,ExceptionInfo *),
cristy3ed852e2009-09-05 21:47:34 +000050 *(*GetVirtualPixelsHandler)(const Image *);
51
cristy4c08aed2011-07-01 19:47:50 +000052typedef const void
53 *(*GetVirtualMetacontentFromHandler)(const Image *);
54
55typedef Quantum
cristybb503372010-05-27 20:51:26 +000056 *(*GetAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
57 const size_t,const size_t,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +000058
cristy4c08aed2011-07-01 19:47:50 +000059typedef Quantum
cristy3ed852e2009-09-05 21:47:34 +000060 *(*GetAuthenticPixelsFromHandler)(const Image *);
61
cristy4c08aed2011-07-01 19:47:50 +000062typedef Quantum
cristybb503372010-05-27 20:51:26 +000063 *(*QueueAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
64 const size_t,const size_t,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +000065
66typedef void
67 (*DestroyPixelHandler)(Image *);
68
cristy4c08aed2011-07-01 19:47:50 +000069typedef void
70 *(*GetAuthenticMetacontentFromHandler)(const Image *);
71
cristy3ed852e2009-09-05 21:47:34 +000072typedef struct _CacheMethods
73{
74 GetVirtualPixelHandler
75 get_virtual_pixel_handler;
76
77 GetVirtualPixelsHandler
78 get_virtual_pixels_handler;
79
cristy4c08aed2011-07-01 19:47:50 +000080 GetVirtualMetacontentFromHandler
81 get_virtual_metacontent_from_handler;
cristy3ed852e2009-09-05 21:47:34 +000082
83 GetOneVirtualPixelFromHandler
84 get_one_virtual_pixel_from_handler;
85
86 GetAuthenticPixelsHandler
87 get_authentic_pixels_handler;
88
cristy4c08aed2011-07-01 19:47:50 +000089 GetAuthenticMetacontentFromHandler
90 get_authentic_metacontent_from_handler;
cristy3ed852e2009-09-05 21:47:34 +000091
92 GetOneAuthenticPixelFromHandler
93 get_one_authentic_pixel_from_handler;
94
95 GetAuthenticPixelsFromHandler
96 get_authentic_pixels_from_handler;
97
98 QueueAuthenticPixelsHandler
99 queue_authentic_pixels_handler;
100
101 SyncAuthenticPixelsHandler
102 sync_authentic_pixels_handler;
103
104 DestroyPixelHandler
105 destroy_pixel_handler;
cristy3ed852e2009-09-05 21:47:34 +0000106} CacheMethods;
107
108typedef struct _NexusInfo
109 NexusInfo;
110
111typedef struct _CacheInfo
112{
113 ClassType
114 storage_class;
115
116 ColorspaceType
117 colorspace;
118
cristy222b19c2011-08-04 01:35:11 +0000119 MagickBooleanType
120 matte;
121
122 size_t
123 columns,
124 rows;
125
cristybcc1fdc2011-04-29 13:06:35 +0000126 size_t
cristy4c08aed2011-07-01 19:47:50 +0000127 metacontent_extent,
cristyed231572011-07-14 02:18:59 +0000128 number_channels;
cristy0d267172011-04-25 20:13:48 +0000129
cristy3ed852e2009-09-05 21:47:34 +0000130 CacheType
131 type;
132
cristy87528ea2009-09-10 14:53:56 +0000133 MapMode
134 mode;
135
cristy3ed852e2009-09-05 21:47:34 +0000136 MagickBooleanType
137 mapped;
138
cristy3ed852e2009-09-05 21:47:34 +0000139 MagickOffsetType
140 offset;
141
142 MagickSizeType
143 length;
144
145 VirtualPixelMethod
146 virtual_pixel_method;
147
cristy4c08aed2011-07-01 19:47:50 +0000148 PixelInfo
cristyc3ec0d42010-04-07 01:18:08 +0000149 virtual_pixel_color;
150
cristybb503372010-05-27 20:51:26 +0000151 size_t
cristy3ed852e2009-09-05 21:47:34 +0000152 number_threads;
153
154 NexusInfo
155 **nexus_info;
156
cristy4c08aed2011-07-01 19:47:50 +0000157 Quantum
cristy3ed852e2009-09-05 21:47:34 +0000158 *pixels;
159
cristy4c08aed2011-07-01 19:47:50 +0000160 void
161 *metacontent;
cristy3ed852e2009-09-05 21:47:34 +0000162
163 int
164 file;
165
166 char
167 filename[MaxTextExtent],
168 cache_filename[MaxTextExtent];
169
170 CacheMethods
171 methods;
172
173 RandomInfo
174 *random_info;
175
176 MagickBooleanType
177 debug;
178
179 MagickThreadType
180 id;
181
cristybb503372010-05-27 20:51:26 +0000182 ssize_t
cristy3ed852e2009-09-05 21:47:34 +0000183 reference_count;
184
185 SemaphoreInfo
186 *semaphore,
187 *disk_semaphore;
188
189 time_t
190 timestamp;
191
cristybb503372010-05-27 20:51:26 +0000192 size_t
cristy3ed852e2009-09-05 21:47:34 +0000193 signature;
194} CacheInfo;
195
196extern MagickExport Cache
cristybb503372010-05-27 20:51:26 +0000197 AcquirePixelCache(const size_t),
cristy3ed852e2009-09-05 21:47:34 +0000198 ClonePixelCache(const Cache),
199 DestroyPixelCache(Cache),
cristy3ed852e2009-09-05 21:47:34 +0000200 ReferencePixelCache(Cache);
201
cristyb32b90a2009-09-07 21:45:48 +0000202extern MagickExport CacheType
203 GetPixelCacheType(const Image *);
204
cristy3ed852e2009-09-05 21:47:34 +0000205extern MagickExport ClassType
206 GetPixelCacheStorageClass(const Cache);
207
208extern MagickExport ColorspaceType
209 GetPixelCacheColorspace(const Cache);
210
cristy3ed852e2009-09-05 21:47:34 +0000211
cristy4c08aed2011-07-01 19:47:50 +0000212extern MagickExport const Quantum
cristy5ed838e2010-05-31 00:05:35 +0000213 *GetVirtualPixelsFromNexus(const Image *,const VirtualPixelMethod,
214 const ssize_t,const ssize_t,const size_t,const size_t,NexusInfo *,
cristy3ed852e2009-09-05 21:47:34 +0000215 ExceptionInfo *),
216 *GetVirtualPixelsNexus(const Cache,NexusInfo *);
217
cristy4c08aed2011-07-01 19:47:50 +0000218extern MagickExport const void
219 *GetVirtualMetacontentFromNexus(const Cache,NexusInfo *);
cristy3ed852e2009-09-05 21:47:34 +0000220
221extern MagickExport MagickBooleanType
222 SyncAuthenticPixelCacheNexus(Image *,NexusInfo *,ExceptionInfo *);
223
224extern MagickExport MagickSizeType
225 GetPixelCacheNexusExtent(const Cache,NexusInfo *);
226
227extern MagickExport NexusInfo
cristybb503372010-05-27 20:51:26 +0000228 **AcquirePixelCacheNexus(const size_t),
229 **DestroyPixelCacheNexus(NexusInfo **,const size_t);
cristy3ed852e2009-09-05 21:47:34 +0000230
cristy4c08aed2011-07-01 19:47:50 +0000231extern MagickExport Quantum
cristybb503372010-05-27 20:51:26 +0000232 *GetAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t,
233 const size_t,const size_t,NexusInfo *,ExceptionInfo *),
cristy3ed852e2009-09-05 21:47:34 +0000234 *GetPixelCacheNexusPixels(const Cache,NexusInfo *),
cristybb503372010-05-27 20:51:26 +0000235 *QueueAuthenticNexus(Image *,const ssize_t,const ssize_t,const size_t,
236 const size_t,NexusInfo *,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +0000237
cristy0d267172011-04-25 20:13:48 +0000238extern MagickExport size_t
239 GetPixelCacheChannels(const Cache);
240
cristy3ed852e2009-09-05 21:47:34 +0000241extern MagickExport void
242 ClonePixelCacheMethods(Cache,const Cache),
cristybb503372010-05-27 20:51:26 +0000243 GetPixelCacheTileSize(const Image *,size_t *,size_t *),
cristy3ed852e2009-09-05 21:47:34 +0000244 GetPixelCacheMethods(CacheMethods *),
cristy3ed852e2009-09-05 21:47:34 +0000245 SetPixelCacheMethods(Cache,CacheMethods *);
246
cristy4c08aed2011-07-01 19:47:50 +0000247extern MagickExport void
248 *GetPixelCacheNexusMetacontent(const Cache,NexusInfo *);
249
cristy3ed852e2009-09-05 21:47:34 +0000250#if defined(__cplusplus) || defined(c_plusplus)
251}
252#endif
253
254#endif