2
0

ilimage.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  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)
  10. * any later version.
  11. *
  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
  16. * details.
  17. *
  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
  22. */
  23. /* $XConsortium: ilimage.h /main/3 1995/10/23 15:49:13 rswiston $ */
  24. /**---------------------------------------------------------------------
  25. ***
  26. *** (c)Copyright 1991 Hewlett-Packard Co.
  27. ***
  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).
  37. ***
  38. ***-------------------------------------------------------------------*/
  39. #ifndef ILIMAGE_H
  40. #define ILIMAGE_H
  41. /* Defines what an image (client or internal) looks like internally.
  42. NOTE: this file should NOT be included by most IL code.
  43. In particular, pipe elements should not include this file -
  44. their view of images is completely determined by /ilinc/ilpipelem.h .
  45. */
  46. #ifndef ILINT_H
  47. #include "ilint.h"
  48. #endif
  49. #ifndef ILPIPELEM_H
  50. #include "ilpipelem.h"
  51. #endif
  52. /* Returns the number of occurrences of "plane" for an image.
  53. */
  54. #define IL_NPLANES(_pImage) \
  55. (((_pImage)->format.sampleOrder == IL_SAMPLE_PIXELS) ? \
  56. 1 : (_pImage)->des.nSamplesPerPixel)
  57. /* Definition of IL internal and client images. Notes:
  58. o object header - MUST BE FIRST.
  59. Not meaningful for temporary pipe images, which are owned
  60. by /ilc/ilimage.c and have an object type of IL_NULL_OBJECT.
  61. des descriptor for this image.
  62. format format of this image.
  63. Next three fields used for compressed images only:
  64. nStrips # of strips in the image
  65. stripHeight height in scanlines of each strip
  66. pStripOffsets ptr to an array of byte offsets to each strip within the
  67. compressed pixels. The length of each strip "i" is
  68. pStripOffsets[i+1] - pStripOffsets[i]. There are nStrips+1
  69. elements in array so this works for the last strip.
  70. i view of image to pipe elements - see /ilinc/ilpipelem.h .
  71. */
  72. typedef struct {
  73. ilObjectRec o;
  74. ilImageDes des;
  75. ilImageFormat format;
  76. long nStrips;
  77. long stripHeight;
  78. long *pStripOffsets;
  79. ilImageInfo i;
  80. } ilImageRec, *ilImagePtr;
  81. /* Typecast the given ptr to an ilImagePtr.
  82. */
  83. #define IL_IMAGE_PTR(_pObject) ((ilImagePtr)_pObject)
  84. /* Creates a buffer for the pixels of image "*pImage", based on pImage->des,
  85. pImage->format, and pImage->height. Set ownPixels to true.
  86. NOTE: handles uncompressed images only!
  87. Returns: zero if success, else error code.
  88. */
  89. IL_EXTERN ilError _ilMallocImagePixels (
  90. ilImagePtr pImage
  91. );
  92. /* Destroy() function for client and internal image objects.
  93. Also used to discard pixels when writing images or loading client images.
  94. Free the pixels of the image only if the IL owns them.
  95. NOTE: handles uncompressed images only!
  96. */
  97. IL_EXTERN void _ilFreeImagePixels (
  98. ilImagePtr pImage
  99. );
  100. /* For compressed images only: allocate strip offsets array (pStripOffsets)
  101. using the given "stripHeight", or use the default strip height if "stripHeight"
  102. is zero (0). Locks image to that strip height.
  103. */
  104. IL_EXTERN ilBool _ilAllocStripOffsets (
  105. ilImagePtr pImage,
  106. long stripHeight
  107. );
  108. #endif