tiff.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. /************************************************************************************
  2. * apps/include/graphics/tiff.h
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one or more
  5. * contributor license agreements. See the NOTICE file distributed with
  6. * this work for additional information regarding copyright ownership. The
  7. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance with the
  9. * License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations
  17. * under the License.
  18. *
  19. ************************************************************************************/
  20. /* Reference:
  21. * "TIFF, Revision 6.0, Final," June 3, 1992, Adobe Developers Association.
  22. */
  23. #ifndef __APPS_INCLUDE_GRAPHICS_TIFF_H
  24. #define __APPS_INCLUDE_GRAPHICS_TIFF_H
  25. /************************************************************************************
  26. * Included Files
  27. ************************************************************************************/
  28. #include <nuttx/config.h>
  29. #include <sys/types.h>
  30. #include <nuttx/nx/nxglib.h>
  31. /************************************************************************************
  32. * Pre-processor Definitions
  33. ************************************************************************************/
  34. /* Configuration ********************************************************************/
  35. /* TIFF File Format Definitions *****************************************************/
  36. /* Values for the IFD field type */
  37. #define IFD_FIELD_BYTE 1 /* 8-bit unsigned integer */
  38. #define IFD_FIELD_ASCII 2 /* 8-bit byte that contains a 7-bit ASCII code.
  39. * The last byte must be NUL */
  40. #define IFD_FIELD_SHORT 3 /* 16-bit (2-byte) unsigned integer */
  41. #define IFD_FIELD_LONG 4 /* 32-bit (4-byte) unsigned integer */
  42. #define IFD_FIELD_RATIONAL 5 /* Two LONGs: the first represents the
  43. * numerator of a fraction, the second the
  44. * denominator */
  45. #define IFD_FIELD_SBYTE 6 /* An 8-bit signed (twos-complement) integer */
  46. #define IFD_FIELD_UNDEFINED 7 /* An 8-bit byte that may contain anything,
  47. * depending on the definition of the field */
  48. #define IFD_FIELD_SSHORT 8 /* A 16-bit (2-byte) signed (twos-complement)
  49. * integer */
  50. #define IFD_FIELD_SLONG 9 /* A 32-bit (4-byte) signed (twos-complement)
  51. * integer */
  52. #define IFD_FIELD_SRATIONAL 10 /* Two SLONG’s: the first represents the
  53. * numerator of a fraction, the second the
  54. * denominator */
  55. #define IFD_FIELD_FLOAT 11 /* Single precision (4-byte) IEEE format */
  56. #define IFD_FIELD_DOUBLE 12 /* Double precision (8-byte) IEEE format */
  57. /* Values for the IFD tag type */
  58. #define IFD_TAG_NEWSUBFILETYPE 254 /* NewSubfileType, LONG */
  59. # define TAG_NEWSUBFILETYPE_REDUCED (1 << 0) /* Bit 0: Reduced resolution version of image */
  60. # define TAG_NEWSUBFILETYPE_SINGLE (1 << 1) /* Bit 1: Single page of a multi-page image */
  61. # define TAG_NEWSUBFILETYPE_TRANSP (1 << 2) /* Bit 2: Defines a transparency mask for image */
  62. #define IFD_TAG_SUBFILETYPE 255 /* SubfileType, SHORT */
  63. # define TAG_SUBFILETYPE_FULL 1 /* Full-resolution image data */
  64. # define TAG_SUBFILETYPE_REDUCED 2 /* Reduced-resolution image data */
  65. # define TAG_SUBFILETYPE_SINGLE 3 /* Single page of a multi-page image */
  66. #define IFD_TAG_IMAGEWIDTH 256 /* ImageLength, SHORT or LONG (Required) */
  67. #define IFD_TAG_IMAGELENGTH 257 /* ImageWidth, SHORT or LONG (Required) */
  68. #define IFD_TAG_BITSPERSAMPLE 258 /* BitsPerSample, SHORT (Required
  69. * in greyscale and pallette-color image files) */
  70. #define IFD_TAG_COMPRESSION 259 /* Compression, SHORT (Required) */
  71. # define TAG_COMP_NONE 1 /* No compression */
  72. # define TAG_COMP_CCITT 2 /* CCITT Group 3 1-Dimensional Modified Huffman
  73. * run length encoding */
  74. # define TAG_COMP_T4 3 /* CCITT T.4 bi-level encoding */
  75. # define TAG_COMP_T6 4 /* CCITT T.6 bi-level encoding */
  76. # define TAG_COMP_LZW 5 /* LZW */
  77. # define TAG_COMP_JPEG 6 /* LZW */
  78. # define TAG_COMP_PACKBITS 32773 /* PackBits compression */
  79. #define IFD_TAG_PMI 262 /* PhotometricInterpretation, SHORT (Required) */
  80. # define TAG_PMI_WHITE 0 /* WhiteIsZero */
  81. # define TAG_PMI_BLACK 1 /* BlackIsZero */
  82. # define TAG_PMI_RGB 2 /* RGB */
  83. # define TAG_PMI_PALETTE 3 /* Palette color */
  84. # define TAG_PMI_TRANSP 4 /* Transparency mask */
  85. # define TAG_PMI_CMYK 5 /* CMYK */
  86. # define TAG_PMI_YCbCr 6 /* YCbCr */
  87. # define TAG_PMI_CIELAB 8 /* 1976 CIE L*a*b* */
  88. #define IFD_TAG_THRESHHOLDING 263 /* Threshholding, SHORT */
  89. # define TAG_THRESHHOLD_NONE 1 /* No dithering or halftoning has been applied */
  90. # define TAG_THRESHHOLD_ORDERED 2 /* Ordered dither or halftone technique has been applied */
  91. # define TAG_THRESHHOLD_RANDOM 3 /* Randomized process has been applied */
  92. #define IFD_TAG_CELLWIDTH 264 /* CellWidth, SHORT */
  93. #define IFD_TAG_CELLLENGTH 265 /* CellLength, SHORT */
  94. #define IFD_TAG_FILLORDER 266 /* FillOrder, SHORT */
  95. # define TAG_FILLORDER_HIGH 1 /* Lower column values are stored in the
  96. * higher-order bits */
  97. # define TAG_FILLORDER_LOW 2 /* Lower column values are stored in the
  98. * lower-order bits */
  99. #define IFD_TAG_DOCUMENTNAME 269 /* DocumentName, ASCII */
  100. #define IFD_TAG_IMAGEDESCRIPTION 270 /* ImageDescription, ASCII */
  101. #define IFD_TAG_MAKE 271 /* Make, ASCII */
  102. #define IFD_TAG_MODEL 272 /* Model, ASCII */
  103. #define IFD_TAG_STRIPOFFSETS 273 /* StripOffsets, SHORT or LONG (Required) */
  104. #define IFD_TAG_ORIENTATION 274 /* Orientation, SHORT */
  105. # define TAG_ORIENTATION_TL 1 /* (0,0)=top left */
  106. # define TAG_ORIENTATION_TR 2 /* (0,0)=top right */
  107. # define TAG_ORIENTATION_BR 3 /* (0,0)=bottom right */
  108. # define TAG_ORIENTATION_BL 4 /* (0,0)=bottom left */
  109. # define TAG_ORIENTATION_LT 5 /* (0,0)=left top */
  110. # define TAG_ORIENTATION_RT 6 /* (0,0)=right top */
  111. # define TAG_ORIENTATION_RB 7 /* (0,0)=right bottom */
  112. # define TAG_ORIENTATION_LB 8 /* (0,0)=left bottom */
  113. #define IFD_TAG_SAMPLESPERPIXEL 277 /* SamplesPerPixel, SHORT (Required in
  114. * RGB full color files) */
  115. #define IFD_TAG_ROWSPERSTRIP 278 /* RowsPerStrip, SHORT or LONG (Required) */
  116. #define IFD_TAG_STRIPCOUNTS 279 /* StripByteCounts, SHORT or LONG (Required) */
  117. #define IFD_TAG_MINSAMPLEVALUE 280 /* MinSampleValue, SHORT */
  118. #define IFD_TAG_MAXSAMPLEVALUE 281 /* MaxSampleValue, SHORT */
  119. #define IFD_TAG_XRESOLUTION 282 /* XResolution, RATIONAL (Required) */
  120. #define IFD_TAG_YRESOLUTION 283 /* YResolution, RATIONAL (Required) */
  121. #define IFD_TAG_PLANARCONFIG 284 /* PlanarConfiguration, SHORT */
  122. # define TAG_PLCONFIG_CHUNKY 1 /* Chunky format */
  123. # define TAG_PLCONFIG_PLANAR 2 /* Planar format */
  124. #define IFD_TAG_PAGENAME 285 /* PageName, ASCII */
  125. #define IFD_TAG_XPOSITION 286 /* XPosition, RATIONAL */
  126. #define IFD_TAG_YPOSITION 287 /* YPosition, RATIONAL */
  127. #define IFD_TAG_FREEOFFSETS 288 /* FreeOffsets, LONG */
  128. #define IFD_TAG_FREEBYTECOUNTS 289 /* FreeByteCounts, LONG */
  129. #define IFD_TAG_GRAYRESPONSEUNIT 290 /* GrayResponseUnit, SHORT */
  130. # define TAG_GRAYRESPUNIT_10THS 1 /* Number represents tenths of a unit */
  131. # define TAG_GRAYRESPUNIT_100THS 2 /* Number represents hundredths of a unit */
  132. # define TAG_GRAYRESPUNIT_1KTHS 3 /* Number represents thousandths of a unit */
  133. # define TAG_GRAYRESPUNIT_10KTHS 4 /* Number represents ten-thousandths of a unit */
  134. # define TAG_GRAYRESPUNIT_100KTHS 5 /* Number represents hundred-thousandths of a unit */
  135. #define IFD_TAG_GRAYRESPONSECURVE 291 /* GrayResponseCurve, SHORT */
  136. #define IFD_TAG_T4OPTIONS 292 /* T4Options, LONG */
  137. # define TAG_T4OPTIONS_2D (1 << 0) /* 2-dimensional coding */
  138. # define TAG_T4OPTIONS_NONE (1 << 1) /* Uncompressed mode */
  139. # define TAG_T4OPTIONS_FILL (1 << 2) /* Fill bits have been added */
  140. #define IFD_TAG_T6OPTIONS 293 /* T6Options, LONG */
  141. # define TAG_T6OPTIONS_NONE (1 << 1) /* Uncompressed mode allowed */
  142. #define IFD_TAG_RESUNIT 296 /* ResolutionUnit, SHORT (Required) */
  143. # define TAG_RESUNIT_NONE 1 /* No absolute unit of measurement */
  144. # define TAG_RESUNIT_INCH 2 /* Inch (default) */
  145. # define TAG_RESUNIT_CENTIMETER 3 /* Centimeter */
  146. #define IFD_TAG_PAGENUMBER 297 /* PageNumber, SHORT */
  147. #define IFD_TAG_TRANSFERFUNCTION 301 /* TransferFunction, SHORT */
  148. #define IFD_TAG_SOFTWARE 305 /* Software, ASCII */
  149. #define IFD_TAG_DATETIME 306 /* DateTime, ASCII */
  150. #define IFD_TAG_ARTIST 315 /* Artist, ASCII */
  151. #define IFD_TAG_HOSTCOMPUTER 316 /* HostComputer, ASCII */
  152. #define IFD_TAG_PREDICTOR 317 /* Predictor SHORT */
  153. # define TAG_PREDICTOR_NONE 1 /* No prediction scheme used before coding */
  154. # define TAG_PREDICTOR_HORIZ 2 /* Horizontal differencing */
  155. #define IFD_TAG_WHITEPOINT 318 /* WhitePoint, RATIONAL */
  156. #define IFD_TAG_PRIMARYCHROMA 319 /* PrimaryChromaticities, RATIONAL */
  157. #define IFD_TAG_COLORMAP 320 /* ColorMap, SHORT (Required in palette
  158. * color image files) */
  159. #define IFD_TAG_HALFTONEHINTS 321 /* HalftoneHints, SHORT */
  160. #define IFD_TAG_TILEWIDTH 322 /* TileWidth, SHORT or LONG */
  161. #define IFD_TAG_TILELENGTH 323 /* TileLength, SHORT or LONG */
  162. #define IFD_TAG_TILEOFFSETS 324 /* TileOffsets, LONG */
  163. #define IFD_TAG_TILEBYTECOUNTS 325 /* TileByteCounts, SHORT or LONG */
  164. #define IFD_TAG_INKSET 332 /* InkSet, SHORT */
  165. # define TAG_INKSET_CMYK 1 /* CMYK */
  166. # define TAG_INKSET_OTHER 2 /* Not CMYK */
  167. #define IFD_TAG_INKNAMES 333 /* InkNames, ASCII */
  168. #define IFD_TAG_NUMBEROFINKS 334 /* NumberOfInks, SHORT */
  169. #define IFD_TAG_DOTRANGE 336 /* DotRange, BYTE or SHORT */
  170. #define IFD_TAG_TARGETPRINTER 337 /* TargetPrinter, ASCII */
  171. #define IFD_TAG_EXTRASAMPLES 338 /* ExtraSamples, SHORT */
  172. # define TAG_EXTSAMP_UNSPEC 0 /* Unspecified */
  173. # define TAG_EXTSAMP_ASSOCALPHA 1 /* Associated alpha data */
  174. # define TAG_EXTSAMP_UNASSALPHA 2 /* Unassociated alpha data */
  175. #define IFD_TAG_SAMPLEFORMAT 339 /* SampleFormat, SHORT */
  176. # define TAG_SAMPLEFMT_UNSIGED 1 /* Unsigned integer data */
  177. # define TAG_SAMPLEFMT_SIGNED 2 /* Two’s complement signed integer data */
  178. # define TAG_SAMPLEFMT_FLOAT 3 /* IEEE floating point data */
  179. # define TAG_SAMPLEFMT_UNDEFINED 4 /* Undefined data format */
  180. #define IFD_TAG_SMINSAMPLEVALUE 340 /* SMinSampleValue, type matches sample data */
  181. #define IFD_TAG_SMAXSAMPLEVALUE 341 /* SMaxSampleValue, type matches sample data */
  182. #define IFD_TAG_TRANSFERRANGE 342 /* TransferRange, SHORT */
  183. #define IFD_TAG_JPEGPROC 512 /* JPEGProc, SHORT */
  184. #define IFD_TAG_JPEGFMT 513 /* JPEGInterchangeFormat, LONG */
  185. #define IFD_TAG_JPEGLENGTH 514 /* JPEGInterchangeFormatLength, LONG */
  186. #define IFD_TAG_JPEGRESTART 515 /* JPEGRestartInterval, SHORT */
  187. #define IFD_TAG_JPEGLLPREDICTORS 517 /* JPEGLosslessPredictors, SHORT */
  188. #define IFD_TAG_JPEGPOINTXFORMS 518 /* JPEGPointTransforms, SHORT */
  189. #define IFD_TAG_JPEGQTABLES 519 /* JPEGQTables, LONG */
  190. #define IFD_TAG_JPEGDCTABLES 520 /* JPEGDCTables, LONG */
  191. #define IFD_TAG_JPEGACTABLES 521 /* JPEGACTables, LONG */
  192. #define IFD_TAG_YCbCrCOEFFS 529 /* YCbCrCoefficients, RATIONAL */
  193. #define IFD_TAG_YCbCrSUBSAMPLING 530 /* YCbCrSubSampling, SHORT */
  194. #define IFD_TAG_YCbCrPOSITIONING 531 /* YCbCrPositioning, SHORT */
  195. #define IFD_TAG_REFERENCEBW 532 /* ReferenceBlackWhite, RATIONAL */
  196. #define IFD_TAG_COPYRIGHT 33432 /* Copyright, ASCII */
  197. /************************************************************************************
  198. * Public Types
  199. ************************************************************************************/
  200. /* TIFF File Format Structure *******************************************************/
  201. /* "A TIFF file begins with an 8-byte image file header that points to an
  202. * image file directory (IFD). An image file directory contains information
  203. * about the image, as well as pointers to the actual image data."
  204. */
  205. struct tiff_header_s
  206. {
  207. uint8_t order[2]; /* 0-1: Byte order: "II"=little endian, "MM"=big endian */
  208. uint8_t magic[2]; /* 2-3: 42 in appropriate byte order */
  209. uint8_t offset[4]; /* 4-7: Offset to the first IFD */
  210. };
  211. #define SIZEOF_TIFF_HEADER 8
  212. /* "An Image File Directory (IFD) consists of a 2-byte count of the number
  213. * of directory entries (i.e., the number of fields), followed by a sequence
  214. * of 12-byte field entries, followed by a 4-byte offset of the next IFD (or
  215. * 0 if none).
  216. *
  217. * Each 12-byte IFD entry has the following format:
  218. */
  219. struct tiff_ifdentry_s
  220. {
  221. uint8_t tag[2]; /* 0-1: The Tag that identifies the field */
  222. uint8_t type[2]; /* 2-3 The field Type */
  223. uint8_t count[4]; /* 4-7: The number of values of the indicated type */
  224. uint8_t offset[4]; /* 8-11: The Value Offset (or the value itself) */
  225. };
  226. #define SIZEOF_IFD_ENTRY 12
  227. /************************************************************************************/
  228. /* Structures needed to interface with the TIFF file creation library )and also
  229. * structures used only internally by the TIFF file creation library).
  230. */
  231. /* This structure describes on strip in tmpfile2 */
  232. struct tiff_strip_s
  233. {
  234. uint32_t offset; /* Offset to the strip data in tmpfile1 */
  235. uint32_t count; /* Count of pixels in the strip */
  236. };
  237. /* This structure is used only internally by the TIFF file creation library to
  238. * manage file offsets.
  239. */
  240. struct tiff_filefmt_s
  241. {
  242. uint16_t nifdentries; /* Number of IFD entries */
  243. uint16_t soifdoffset; /* Offset to StripOffset IFD entry */
  244. uint16_t sbcifdoffset; /* Offset to StripByteCount IFD entry */
  245. uint16_t valoffset; /* Offset to first values */
  246. uint16_t xresoffset; /* Offset to XResolution values */
  247. uint16_t yresoffset; /* Offset to yResolution values */
  248. uint16_t swoffset; /* Offset to Software string */
  249. uint16_t dateoffset; /* Offset to DateTime string */
  250. uint16_t sbcoffset; /* Offset to StripByteCount values */
  251. };
  252. /* These type is used to hold information about the TIFF file under
  253. * construction
  254. */
  255. struct tiff_info_s
  256. {
  257. /* The first fields are used to pass information to the TIFF file creation
  258. * logic via tiff_initialize().
  259. *
  260. * Filenames. Three file names are required. (1) path to the final
  261. * output file and (2) two paths to temporary files. One temporary file
  262. * (tmpfile1) will be used to hold the strip image data and the other
  263. * (tmpfile2) will be used to hold strip offset and count information.
  264. *
  265. * colorfmt - Specifies the form of the color data that will be provided
  266. * in the strip data. These are the FB_FMT_* definitions
  267. * provided in include/nuttx/video/fb.h. Only the following values
  268. * are supported:
  269. *
  270. * FB_FMT_Y1 BPP=1, monochrome, 0=black
  271. * FB_FMT_Y4 BPP=4, 4-bit greyscale, 0=black
  272. * FB_FMT_Y8 BPP=8, 8-bit greyscale, 0=black
  273. * FB_FMT_RGB16_565 BPP=16 R=6, G=6, B=5
  274. * FB_FMT_RGB24 BPP=24 R=8, G=8, B=8
  275. *
  276. * rps - TIFF RowsPerStrip
  277. * imgwidth - TIFF ImageWidth, Number of columns in the image
  278. * imgheight - TIFF ImageLength, Number of rows in the image
  279. */
  280. FAR const char *outfile; /* Full path to the final output file name */
  281. FAR const char *tmpfile1; /* Full path to first temporary file */
  282. FAR const char *tmpfile2; /* Full path to second temporary file */
  283. uint8_t colorfmt; /* See FB_FMT_* definitions in include/nuttx/video/fb.h */
  284. nxgl_coord_t rps; /* TIFF RowsPerStrip */
  285. nxgl_coord_t imgwidth; /* TIFF ImageWidth, Number of columns in the image */
  286. nxgl_coord_t imgheight; /* TIFF ImageLength, Number of rows in the image */
  287. /* The caller must provide an I/O buffer as well. This I/O buffer will
  288. * used for color conversions and as the intermediate buffer for copying
  289. * files. The larger the buffer, the better the performance.
  290. */
  291. FAR uint8_t *iobuffer; /* IO buffer allocated by the caller */
  292. unsigned int iosize; /* The size of the I/O buffer in bytes */
  293. /* The second set of fields are used only internally by the TIFF file
  294. * creation logic. These fields must be set to zero initially by the
  295. * caller of tiff_initialize(). User logic should not depend upon any
  296. * definitions in the following -- they are subject to change without
  297. * notice. They are only exposed here so that the caller can allocate
  298. * memory for their storage.
  299. */
  300. uint8_t imgflags; /* Bit-encoded image flags */
  301. nxgl_coord_t nstrips; /* Number of strips in tmpfile3 */
  302. size_t pps; /* Pixels per strip */
  303. size_t bps; /* Bytes per strip */
  304. int outfd; /* outfile file descriptor */
  305. int tmp1fd; /* tmpfile1 file descriptor */
  306. int tmp2fd; /* tmpfile2 file descriptor */
  307. off_t outsize; /* Current size of outfile */
  308. off_t tmp1size; /* Current size of tmpfile1 */
  309. off_t tmp2size; /* Current size of tmpfile2 */
  310. /* Points to an internal constant structure of file offsets */
  311. FAR const struct tiff_filefmt_s *filefmt;
  312. };
  313. /************************************************************************************
  314. * Public Function Prototypes
  315. ************************************************************************************/
  316. #ifdef __cplusplus
  317. #define EXTERN extern "C"
  318. extern "C"
  319. {
  320. #else
  321. #define EXTERN extern
  322. #endif
  323. /************************************************************************************
  324. * Name: tiff_initialize
  325. *
  326. * Description:
  327. * Setup to create a new TIFF file. The overall steps to creating a TIFF file are
  328. * as follows:
  329. *
  330. * 1) Create an initialize a struct tiff_info_s instance
  331. * 2) Call tiff_initialize() to setup the file creation
  332. * 3) Call tiff_addstrip() repeatedly to add strips to the graphic image
  333. * 4) Call tiff_finalize() to complete the file creation.
  334. *
  335. * Input Parameters:
  336. * info - A pointer to the caller allocated parameter passing/TIFF state instance.
  337. *
  338. * Returned Value:
  339. * Zero (OK) on success. A negated errno value on failure.
  340. *
  341. ************************************************************************************/
  342. int tiff_initialize(FAR struct tiff_info_s *info);
  343. /************************************************************************************
  344. * Name: tiff_addstrip
  345. *
  346. * Description:
  347. * Add an image data strip. The size of the strip in pixels must be equal to
  348. * the RowsPerStrip x ImageWidth values that were provided to tiff_initialize().
  349. *
  350. * Input Parameters:
  351. * info - A pointer to the caller allocated parameter passing/TIFF state instance.
  352. * buffer - A buffer containing a single row of data.
  353. *
  354. * Returned Value:
  355. * Zero (OK) on success. A negated errno value on failure.
  356. *
  357. ************************************************************************************/
  358. int tiff_addstrip(FAR struct tiff_info_s *info, FAR const uint8_t *strip);
  359. /************************************************************************************
  360. * Name: tiff_finalize
  361. *
  362. * Description:
  363. * Finalize the TIFF output file, completing the TIFF file creation steps.
  364. *
  365. * Input Parameters:
  366. * info - A pointer to the caller allocated parameter passing/TIFF state instance.
  367. *
  368. * Returned Value:
  369. * Zero (OK) on success. A negated errno value on failure.
  370. *
  371. ************************************************************************************/
  372. int tiff_finalize(FAR struct tiff_info_s *info);
  373. /************************************************************************************
  374. * Name: tiff_abort
  375. *
  376. * Description:
  377. * Abort the TIFF file creation and create-up resources.
  378. *
  379. * Input Parameters:
  380. * info - A pointer to the caller allocated parameter passing/TIFF state instance.
  381. *
  382. * Returned Value:
  383. * None
  384. *
  385. ************************************************************************************/
  386. void tiff_abort(FAR struct tiff_info_s *info);
  387. /************************************************************************************
  388. * Name: tiff_put/get16/32
  389. *
  390. * Description:
  391. * Put and get 16 and 32 values in the correct byte order at the specified position.
  392. *
  393. * Input Parameters:
  394. * dest - The location to store the multi-byte data (put only)
  395. * src - The location to get the multi-byte data (get only)
  396. *
  397. * Returned Value:
  398. * None (put)
  399. * The extracted value (get)
  400. *
  401. ************************************************************************************/
  402. void tiff_put16(FAR uint8_t *dest, uint16_t value);
  403. void tiff_put32(FAR uint8_t *dest, uint32_t value);
  404. uint16_t tiff_get16(FAR uint8_t *dest);
  405. uint32_t tiff_get32(FAR uint8_t *dest);
  406. #undef EXTERN
  407. #ifdef __cplusplus
  408. }
  409. #endif
  410. #endif /* __APPS_INCLUDE_GRAPHICS_TIFF_H */