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