vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / translators / pcx / PCX.h
blobb1bab0e27c353333b0b629c7e0b89a8b8012c333
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
10 #include <GraphicsDefs.h>
11 #include <BufferIO.h>
12 #include <TranslatorFormats.h>
14 class BMessage;
17 namespace PCX {
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 numPlanes;
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;
39 struct rgba32_color {
40 uint8 blue;
41 uint8 green;
42 uint8 red;
43 uint8 alpha;
45 inline bool
46 operator==(const rgba32_color& other) const
48 return red == other.red && green == other.green && blue == other.blue;
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);
56 } // namespace PCX
58 #endif /* PCX_H */