2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: ilint.h /main/4 1996/01/08 12:14:49 lehors $ */
24 /**---------------------------------------------------------------------
26 *** (c)Copyright 1991 Hewlett-Packard Co.
28 *** RESTRICTED RIGHTS LEGEND
29 *** Use, duplication, or disclosure by the U.S. Government is subject to
30 *** restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in
31 *** Technical Data and Computer Software clause in DFARS 252.227-7013.
32 *** Hewlett-Packard Company
33 *** 3000 Hanover Street
34 *** Palo Alto, CA 94304 U.S.A.
35 *** Rights for non-DOD U.S. Government Departments and Agencies are as set
36 *** forth in FAR 52.227-19(c)(1,2).
38 ***-------------------------------------------------------------------*/
43 /* General internal definitions for Image Library (IL).
46 #include <stddef.h> /* for size_t declaration */
51 #include "ilpipelem.h"
70 /* IL_EXTERN is declared in place of "extern" for functions / data
71 that are external (in other another source file) but not public
72 (meant to be accessed by callers). ilall.c redefines to null
73 so that external references are not generated.
76 #define IL_EXTERN extern
79 /* IL_PRIVATE is declared for functions / data that are private
80 to the IL but need to be referenced by other source modules.
81 ilall.c redefines to "static" so external symbol is not generated.
87 /* New definitions for JPEG. These may be moved to il.h and exposed
88 to users in the future ...
91 /* ilImageDes.compInfo.JPEG.flags masks. All other bits must be 0 */
92 #define IL_JPEGM_RAW (1<<0)
98 short reserved; /* must be zero (0) */
106 ilJPEGSampleData sample[IL_MAX_SAMPLES];
110 /* Maximums that correspond to defines in /ilinc/il.h .
111 WARNING: MUST CHANGE THESE IF IL.H DEFINES CHANGE.
112 (These defines are here rather than in the public file to discourage
113 public use of "max" defines, which would break if more codes were added
114 (for example if application has a table of size MAX_?).
116 #define IL_MAX_TYPE 4 /* IL_BITONAL, etc. */
117 #define IL_MAX_COMPRESSION 5 /* IL_UNCOMPRESSED, etc. */
118 #define IL_MAX_OBJECT_TYPE 7 /* IL_NULL_OBJECT, etc. */
119 #define IL_MAX_BYTE_ORDER 1 /* IL_MSB_FIRST, etc. */
120 #define IL_MAX_SAMPLE_ORDER 2 /* IL_SAMPLE_PIXELS, etc. */
123 /* First part of all IL objects. More object-specific data may follow. Notes:
125 refCount reference count. Code which "attaches" to an object (e.g.
126 when an object is referenced in a pipe) should increment
127 refCount, and should call ilDestroyObject() when detaching
128 from the object. The caller must have the same number of
129 calls to ilDestroyObject() as inc's of refCount for object.
133 ilObjectPublicRec p; /* /ilinc/il.h , e.g. "context" */
134 unsigned long refCount; /* see notes */
135 ilPtr pNext, pPrev; /* private to /ilc/ilobject.c */
136 void (*Destroy)(); /* private to /ilc/ilobject.c */
137 } ilObjectRec, *ilObjectPtr;
140 /* From /ilc/ilobject.c : */
141 /* Creates an object of size "sizeInBytes" and returns a ptr to it, or null
142 if failure (the error code in "context" is set in either case). The object
143 is added to the given "context". "sizeInBytes" must be a minimum of
144 "sizeof(ilObjectRec)".
145 The function "Destroy" will be called by ilDestroyObject(), as:
146 Destroy (ilObjectPtr pObject);
147 Before destroying this object. The Destroy() function must free any
148 object-specific data etc. It MUST not touch the fields in the object header
149 (ilObjectRec) or free *pObject.
152 IL_EXTERN ilObjectPtr _ilCreateObject (
153 ilContext context, /* context to add object to */
154 int objectType, /* code for object, e.g. IL_PIPE */
155 void (*Destroy)(), /* destroy function; see above */
156 /* Use the portable(correct) type for sizeof() operator, bug report OSF_QAR#32082 */
157 size_t sizeInBytes /* size of object to create */
160 /* From /ilc/ilimage.c : */
161 /* Validate the given image descriptor at "pDes" and the image format at
162 "pFormat" if it is non-null and validate that they are compatible
164 If "allowPrivateTypes" is true, private image type codes are allowed;
165 otherwise an error is declared. Should be true for client images.
166 Return 0 (IL_OK) if valid, else error code.
167 NOTE: this function defines valid compressions and nBitsPerSample.
169 IL_EXTERN ilError _ilValidateDesFormat (
170 ilBool allowPrivateTypes,
171 const ilImageDes *pDes,
172 const ilImageFormat *pFormat
176 /* From /ilc/ilcontext.c : */
177 /* Intersect the rectangle "*pSrcRect" with the rect "*pDstRect",
178 storing the result in "*pDstRect".
180 IL_EXTERN void _ilIntersectRect (
186 /* Table of shift values, indexed by YCbCr subsample values (1, 2 or 4) */
187 IL_EXTERN const int _ilSubsampleShift [];
190 /* Allocate _nBytes from heap and return a ptr to it.
191 If IL_GARBAGE_MALLOC defined, init the alloc'd space with garbage
192 to help find unit'd vars/image errors.
194 #ifdef IL_GARBAGE_MALLOC
196 IL_EXTERN void *_ilMallocAndInitWithGarbage (unsigned long nBytes);
197 # define IL_MALLOC(_nBytes) (_ilMallocAndInitWithGarbage (_nBytes))
201 # define IL_MALLOC(_nBytes) (malloc (_nBytes))
205 /* Allocate _nBytes from heap, zero it, and return a ptr to it.
207 #define IL_MALLOC_ZERO(_nBytes) (calloc ((_nBytes), 1))
209 /* Reallocate the given _ptr to be of size _nBytes.
211 #define IL_REALLOC(_ptr, _nBytes) (realloc ((_ptr), (_nBytes)))
213 /* Free given block (*_ptr), allocated by IL_MALLOC[_ZERO]().
215 #define IL_FREE(_ptr) (free (_ptr))
217 /* Print the given message if debug msgs enabled.
220 # define IL_DEBUG(_msg) (printf (stderr, _msg))
221 # define IL_DEBUG_DEC(_msg, _decValue) (printf (stderr, _msg, _decValue))
223 # define IL_DEBUG(_msg)
224 # define IL_DEBUG_DEC(_msg, _decValue)