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