1 /* 2 * Copyright 2008, Jérôme Duval, korli@users.berlios.de. All rights reserved. 3 * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 4 * Distributed under the terms of the MIT License. 5 */ 6 #ifndef PCX_H 7 #define PCX_H 8 9 10 #include <GraphicsDefs.h> 11 #include <BufferIO.h> 12 #include <TranslatorFormats.h> 13 14 class BMessage; 15 16 17 namespace PCX { 18 19 struct pcx_header { 20 uint8 manufacturer; 21 uint8 version; 22 uint8 encoding; 23 uint8 bitsPerPixel; 24 uint16 xMin, yMin, xMax, yMax; 25 uint16 hDpi, vDpi; 26 uint8 colormap[48]; 27 uint8 reserved; 28 uint8 nPlanes; 29 uint16 bytesPerLine; 30 uint16 paletteInfo; 31 uint16 hScreenSize, vScreenSize; 32 uint8 filler[54]; 33 bool IsValid() const; 34 void SwapToHost(); 35 void SwapFromHost(); 36 } _PACKED; 37 38 39 struct rgba32_color { 40 uint8 blue; 41 uint8 green; 42 uint8 red; 43 uint8 alpha; 44 45 inline bool 46 operator==(const rgba32_color& other) const 47 { 48 return red == other.red && green == other.green && blue == other.blue; 49 } 50 }; 51 52 53 extern status_t identify(BMessage *settings, BPositionIO &stream, uint8 &type, int32 &bitsPerPixel); 54 extern status_t convert_pcx_to_bits(BMessage *settings, BPositionIO &source, BPositionIO &target); 55 56 } // namespace PCX 57 58 #endif /* PCX_H */ 59