1 /* 2 * Copyright 2009, Haiku Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _BITMAP_STREAM_H 6 #define _BITMAP_STREAM_H 7 8 9 #include <ByteOrder.h> 10 #include <DataIO.h> 11 #include <TranslationDefs.h> 12 #include <TranslatorFormats.h> 13 14 15 class BBitmap; 16 17 18 class BBitmapStream : public BPositionIO { 19 public: 20 BBitmapStream(BBitmap* bitmap = NULL); 21 virtual ~BBitmapStream(); 22 23 virtual ssize_t ReadAt(off_t offset, void* buffer, size_t size); 24 virtual ssize_t WriteAt(off_t offset, const void* buffer, 25 size_t size); 26 virtual off_t Seek(off_t position, uint32 seekMode); 27 virtual off_t Position() const; 28 virtual off_t Size() const; 29 virtual status_t SetSize(off_t size); 30 31 status_t DetachBitmap(BBitmap** _bitmap); 32 33 protected: 34 void SwapHeader(const TranslatorBitmap* source, 35 TranslatorBitmap* destination); 36 37 protected: 38 TranslatorBitmap fHeader; 39 BBitmap* fBitmap; 40 size_t fPosition; 41 size_t fSize; 42 bool fDetached; 43 44 private: 45 virtual void _ReservedBitmapStream1(); 46 virtual void _ReservedBitmapStream2(); 47 48 private: 49 TranslatorBitmap* fBigEndianHeader; 50 long _reserved[5]; 51 }; 52 53 54 #endif // _BITMAP_STREAM_H 55