blob: 2d1e0df9b4beb11fe5ab91247c99a0965b40bf3c [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
2 Copyright 1999-2009 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)
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,
35 DiskCache
36} CacheType;
37
38typedef void
39 *Cache;
40
41typedef const IndexPacket
42 *(*GetVirtualIndexesFromHandler)(const Image *);
43
44typedef IndexPacket
45 *(*GetAuthenticIndexesFromHandler)(const Image *);
46
47typedef MagickBooleanType
48 (*GetOneAuthenticPixelFromHandler)(Image *,const long,const long,
49 PixelPacket *,ExceptionInfo *),
50 (*GetOneVirtualPixelFromHandler)(const Image *,const VirtualPixelMethod,
51 const long,const long,PixelPacket *,ExceptionInfo *),
52 (*SyncAuthenticPixelsHandler)(Image *,ExceptionInfo *);
53
54typedef const PixelPacket
55 *(*GetVirtualPixelHandler)(const Image *,const VirtualPixelMethod,const long,
56 const long,const unsigned long,const unsigned long,ExceptionInfo *),
57 *(*GetVirtualPixelsHandler)(const Image *);
58
59typedef PixelPacket
60 *(*GetAuthenticPixelsHandler)(Image *,const long,const long,
61 const unsigned long,const unsigned long,ExceptionInfo *);
62
63typedef PixelPacket
64 *(*GetAuthenticPixelsFromHandler)(const Image *);
65
66typedef PixelPacket
67 *(*QueueAuthenticPixelsHandler)(Image *,const long,const long,
68 const unsigned long,const unsigned long,ExceptionInfo *);
69
70typedef void
71 (*DestroyPixelHandler)(Image *);
72
73typedef struct _CacheMethods
74{
75 GetVirtualPixelHandler
76 get_virtual_pixel_handler;
77
78 GetVirtualPixelsHandler
79 get_virtual_pixels_handler;
80
81 GetVirtualIndexesFromHandler
82 get_virtual_indexes_from_handler;
83
84 GetOneVirtualPixelFromHandler
85 get_one_virtual_pixel_from_handler;
86
87 GetAuthenticPixelsHandler
88 get_authentic_pixels_handler;
89
90 GetAuthenticIndexesFromHandler
91 get_authentic_indexes_from_handler;
92
93 GetOneAuthenticPixelFromHandler
94 get_one_authentic_pixel_from_handler;
95
96 GetAuthenticPixelsFromHandler
97 get_authentic_pixels_from_handler;
98
99 QueueAuthenticPixelsHandler
100 queue_authentic_pixels_handler;
101
102 SyncAuthenticPixelsHandler
103 sync_authentic_pixels_handler;
104
105 DestroyPixelHandler
106 destroy_pixel_handler;
107
108} 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
130 unsigned long
131 columns,
132 rows;
133
134 MagickOffsetType
135 offset;
136
137 MagickSizeType
138 length;
139
140 VirtualPixelMethod
141 virtual_pixel_method;
142
143 unsigned long
144 number_threads;
145
146 NexusInfo
147 **nexus_info;
148
149 PixelPacket
150 *pixels;
151
152 IndexPacket
153 *indexes;
154
155 MagickBooleanType
156 active_index_channel;
157
158 int
159 file;
160
161 char
162 filename[MaxTextExtent],
163 cache_filename[MaxTextExtent];
164
165 CacheMethods
166 methods;
167
168 RandomInfo
169 *random_info;
170
171 MagickBooleanType
172 debug;
173
174 MagickThreadType
175 id;
176
177 long
178 reference_count;
179
180 SemaphoreInfo
181 *semaphore,
182 *disk_semaphore;
183
184 time_t
185 timestamp;
186
187 unsigned long
188 signature;
189} CacheInfo;
190
191extern MagickExport Cache
192 AcquirePixelCache(const unsigned long),
193 ClonePixelCache(const Cache),
194 DestroyPixelCache(Cache),
195 GetImagePixelCache(Image *,const MagickBooleanType,ExceptionInfo *),
196 ReferencePixelCache(Cache);
197
cristyb32b90a2009-09-07 21:45:48 +0000198extern MagickExport CacheType
199 GetPixelCacheType(const Image *);
200
cristy3ed852e2009-09-05 21:47:34 +0000201extern MagickExport ClassType
202 GetPixelCacheStorageClass(const Cache);
203
204extern MagickExport ColorspaceType
205 GetPixelCacheColorspace(const Cache);
206
207extern MagickExport const IndexPacket
208 *GetVirtualIndexesFromNexus(const Cache,NexusInfo *);
209
210extern MagickExport const PixelPacket
211 *GetVirtualPixelsFromNexus(const Image *,const VirtualPixelMethod,const long,
212 const long,const unsigned long,const unsigned long,NexusInfo *,
213 ExceptionInfo *),
214 *GetVirtualPixelsNexus(const Cache,NexusInfo *);
215
216extern MagickExport IndexPacket
217 *GetPixelCacheNexusIndexes(const Cache,NexusInfo *);
218
219extern MagickExport MagickBooleanType
220 SyncAuthenticPixelCacheNexus(Image *,NexusInfo *,ExceptionInfo *);
221
222extern MagickExport MagickSizeType
223 GetPixelCacheNexusExtent(const Cache,NexusInfo *);
224
225extern MagickExport NexusInfo
226 **AcquirePixelCacheNexus(const unsigned long),
227 **DestroyPixelCacheNexus(NexusInfo **,const unsigned long);
228
229extern MagickExport PixelPacket
230 *GetAuthenticPixelCacheNexus(Image *,const long,const long,
231 const unsigned long,const unsigned long,NexusInfo *,ExceptionInfo *),
232 *GetPixelCacheNexusPixels(const Cache,NexusInfo *),
233 *QueueAuthenticNexus(Image *,const long,const long,const unsigned long,
234 const unsigned long,NexusInfo *,ExceptionInfo *);
235
236extern MagickExport void
237 ClonePixelCacheMethods(Cache,const Cache),
cristyb32b90a2009-09-07 21:45:48 +0000238 GetPixelCacheTileSize(const Image *,unsigned long *,unsigned long *),
cristy3ed852e2009-09-05 21:47:34 +0000239 GetPixelCacheMethods(CacheMethods *),
240 SetPixelCacheMethods(Cache,CacheMethods *);
241
242#if defined(__cplusplus) || defined(c_plusplus)
243}
244#endif
245
246#endif