blob: dfa8cc9e5dbecbd760f23acc914fb6fe466199eb [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
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
55typedef 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
60typedef PixelPacket
61 *(*GetAuthenticPixelsHandler)(Image *,const long,const long,
62 const unsigned long,const unsigned long,ExceptionInfo *);
63
64typedef PixelPacket
65 *(*GetAuthenticPixelsFromHandler)(const Image *);
66
67typedef PixelPacket
68 *(*QueueAuthenticPixelsHandler)(Image *,const long,const long,
69 const unsigned long,const unsigned long,ExceptionInfo *);
70
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;
108
109} CacheMethods;
110
111typedef struct _NexusInfo
112 NexusInfo;
113
114typedef struct _CacheInfo
115{
116 ClassType
117 storage_class;
118
119 ColorspaceType
120 colorspace;
121
122 CacheType
123 type;
124
cristy87528ea2009-09-10 14:53:56 +0000125 MapMode
126 mode;
127
cristy3ed852e2009-09-05 21:47:34 +0000128 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
cristyc3ec0d42010-04-07 01:18:08 +0000144 MagickPixelPacket
145 virtual_pixel_color;
146
cristy3ed852e2009-09-05 21:47:34 +0000147 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
195extern MagickExport Cache
196 AcquirePixelCache(const unsigned long),
197 ClonePixelCache(const Cache),
198 DestroyPixelCache(Cache),
199 GetImagePixelCache(Image *,const MagickBooleanType,ExceptionInfo *),
200 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
211extern MagickExport const IndexPacket
212 *GetVirtualIndexesFromNexus(const Cache,NexusInfo *);
213
214extern 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
220extern MagickExport IndexPacket
221 *GetPixelCacheNexusIndexes(const Cache,NexusInfo *);
222
223extern MagickExport MagickBooleanType
224 SyncAuthenticPixelCacheNexus(Image *,NexusInfo *,ExceptionInfo *);
225
226extern MagickExport MagickSizeType
227 GetPixelCacheNexusExtent(const Cache,NexusInfo *);
228
229extern MagickExport NexusInfo
230 **AcquirePixelCacheNexus(const unsigned long),
231 **DestroyPixelCacheNexus(NexusInfo **,const unsigned long);
232
233extern 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
240extern MagickExport void
241 ClonePixelCacheMethods(Cache,const Cache),
cristyb32b90a2009-09-07 21:45:48 +0000242 GetPixelCacheTileSize(const Image *,unsigned long *,unsigned long *),
cristy3ed852e2009-09-05 21:47:34 +0000243 GetPixelCacheMethods(CacheMethods *),
cristy3ed852e2009-09-05 21:47:34 +0000244 SetPixelCacheMethods(Cache,CacheMethods *);
245
246#if defined(__cplusplus) || defined(c_plusplus)
247}
248#endif
249
250#endif