got this added\?

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12057 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-03-26 22:26:42 +00:00
parent 3294d07b15
commit 4594032d1a
2 changed files with 104 additions and 0 deletions

View File

@ -0,0 +1,73 @@
// BitmapBuffer.h
#include <Bitmap.h>
#include "BitmapBuffer.h"
// constructor
BitmapBuffer::BitmapBuffer(BBitmap* bitmap)
: fBitmap(bitmap)
{
}
// destructor
BitmapBuffer::~BitmapBuffer()
{
delete fBitmap;
}
// InitCheck
status_t
BitmapBuffer::InitCheck() const
{
status_t ret = B_NO_INIT;
if (fBitmap)
ret = fBitmap->InitCheck();
return ret;
}
// ColorSpace
color_space
BitmapBuffer::ColorSpace() const
{
if (InitCheck() >= B_OK)
return fBitmap->ColorSpace();
return B_NO_COLOR_SPACE;
}
// Bits
void*
BitmapBuffer::Bits() const
{
if (InitCheck() >= B_OK)
return fBitmap->Bits();
return NULL;
}
// BytesPerRow
uint32
BitmapBuffer::BytesPerRow() const
{
if (InitCheck() >= B_OK)
return fBitmap->BytesPerRow();
return 0;
}
// Width
uint32
BitmapBuffer::Width() const
{
if (InitCheck() >= B_OK)
return fBitmap->Bounds().IntegerWidth() + 1;
return 0;
}
// Height
uint32
BitmapBuffer::Height() const
{
if (InitCheck() >= B_OK)
return fBitmap->Bounds().IntegerHeight() + 1;
return 0;
}

View File

@ -0,0 +1,31 @@
// BitmapBuffer.h
#ifndef BITMAP_BUFFER_H
#define BITMAP_BUFFER_H
#include "RenderingBuffer.h"
class BBitmap;
class BitmapBuffer : public RenderingBuffer {
public:
BitmapBuffer(BBitmap* bitmap);
virtual ~BitmapBuffer();
virtual status_t InitCheck() const;
virtual color_space ColorSpace() const;
virtual void* Bits() const;
virtual uint32 BytesPerRow() const;
virtual uint32 Width() const;
virtual uint32 Height() const;
// BitmapBuffer
const BBitmap* Bitmap() const
{ return fBitmap; }
private:
BBitmap* fBitmap;
};
#endif // BITMAP_BUFFER_H