1 // Copyright 2008-present Contributors to the OpenImageIO project.
2 // SPDX-License-Identifier: BSD-3-Clause
3 // https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
4 
5 #pragma once
6 
7 #include <cstdio>
8 
9 #include <OpenImageIO/filesystem.h>
10 #include <OpenImageIO/fmath.h>
11 #include <OpenImageIO/imageio.h>
12 
13 OIIO_PLUGIN_NAMESPACE_BEGIN
14 
15 namespace softimage_pvt {
16 
17 class PicFileHeader {
18 public:
19     // Read pic header from file
20     bool read_header(FILE* fd);
21 
22     // PIC header
23     uint32_t magic;    // Softimage magic number
24     float version;     // Storage format - 1 is RLE, 0 is RAW
25     char comment[80];  // Comment
26     char id[4];        // ID - should be PICT
27     uint16_t width;    // X size in pixels
28     uint16_t height;   // Y size in pixels
29     float ratio;       // Pixel aspect ratio
30     uint16_t fields;   // The scanline setting - No Pictures, Odd, Even or every
31     uint16_t pad;      // unused
32 
33 private:
34     void swap_endian();
35 };  // class PicFileHeader
36 
37 
38 
39 class ChannelPacket {
40 public:
41     //channel packet contains info on the image data
ChannelPacket()42     ChannelPacket() { chained = 0; }
43     // !brief  get a list of the channels contained in this channel packet
44     std::vector<int> channels() const;
45     uint8_t chained;      // 0 if this is the last channel packet
46     uint8_t size;         // Number of bits per pixel per channel
47     uint8_t type;         // Data encoding and type
48     uint8_t channelCode;  // bitset for channels
49 };
50 
51 
52 
53 enum channelCodes {
54     RED_CHANNEL   = 0x80,
55     GREEN_CHANNEL = 0x40,
56     BLUE_CHANNEL  = 0x20,
57     ALPHA_CHANNEL = 0x10
58 };  // enum channelCodes
59 
60 
61 
62 enum encoding {
63     UNCOMPRESSED,
64     PURE_RUN_LENGTH,
65     MIXED_RUN_LENGTH
66 };  // enum encoding
67 
68 }  //namespace softimage_pvt
69 
70 OIIO_PLUGIN_NAMESPACE_END
71