(InStream is)
| 103 | } |
| 104 | |
| 105 | public void read(InStream is) { |
| 106 | bpp = is.readU8(); |
| 107 | depth = is.readU8(); |
| 108 | bigEndian = is.readU8()!=0; |
| 109 | trueColour = is.readU8()!=0; |
| 110 | redMax = is.readU16(); |
| 111 | greenMax = is.readU16(); |
| 112 | blueMax = is.readU16(); |
| 113 | redShift = is.readU8(); |
| 114 | greenShift = is.readU8(); |
| 115 | blueShift = is.readU8(); |
| 116 | is.skip(3); |
| 117 | |
| 118 | // We have no real support for colour maps. If the client |
| 119 | // wants one, then we force a 8-bit true colour format and |
| 120 | // pretend it's a colour map. |
| 121 | if (!trueColour) { |
| 122 | redMax = 7; |
| 123 | greenMax = 7; |
| 124 | blueMax = 3; |
| 125 | redShift = 0; |
| 126 | greenShift = 3; |
| 127 | blueShift = 6; |
| 128 | } |
| 129 | |
| 130 | if (!isSane()) |
| 131 | throw new Exception("invalid pixel format: "+print()); |
| 132 | |
| 133 | updateState(); |
| 134 | } |
| 135 | |
| 136 | public void write(OutStream os) { |
| 137 | os.writeU8(bpp); |
no test coverage detected