1 // BBitmapBuffer.h 2 3 #include <Bitmap.h> 4 5 #include "BBitmapBuffer.h" 6 7 // constructor 8 BBitmapBuffer::BBitmapBuffer(BBitmap* bitmap) 9 : fBitmap(bitmap) 10 { 11 } 12 13 // destructor 14 BBitmapBuffer::~BBitmapBuffer() 15 { 16 delete fBitmap; 17 } 18 19 // InitCheck 20 status_t 21 BBitmapBuffer::InitCheck() const 22 { 23 status_t ret = B_NO_INIT; 24 if (fBitmap) 25 ret = fBitmap->InitCheck(); 26 return ret; 27 } 28 29 // ColorSpace 30 color_space 31 BBitmapBuffer::ColorSpace() const 32 { 33 if (InitCheck() >= B_OK) 34 return fBitmap->ColorSpace(); 35 return B_NO_COLOR_SPACE; 36 } 37 38 // Bits 39 void* 40 BBitmapBuffer::Bits() const 41 { 42 if (InitCheck() >= B_OK) 43 return fBitmap->Bits(); 44 return NULL; 45 } 46 47 // BytesPerRow 48 uint32 49 BBitmapBuffer::BytesPerRow() const 50 { 51 if (InitCheck() >= B_OK) 52 return fBitmap->BytesPerRow(); 53 return 0; 54 } 55 56 // Width 57 uint32 58 BBitmapBuffer::Width() const 59 { 60 if (InitCheck() >= B_OK) 61 return fBitmap->Bounds().IntegerWidth() + 1; 62 return 0; 63 } 64 65 // Height 66 uint32 67 BBitmapBuffer::Height() const 68 { 69 if (InitCheck() >= B_OK) 70 return fBitmap->Bounds().IntegerHeight() + 1; 71 return 0; 72 } 73 74