1 //------------------------------------------------------------------------------
2 // Copyright (c) 2001-2005, Haiku, Inc.
4 // Distributed under the terms of the MIT license.
7 // Author: Ingo Weinhold (bonefish@users.sf.net)
8 // Description: BBitmap objects represent off-screen windows that
9 // contain bitmap data.
10 //------------------------------------------------------------------------------
15 #include <Archivable.h>
16 #include <InterfaceDefs.h>
20 B_BITMAP_CLEAR_TO_WHITE
= 0x00000001,
21 B_BITMAP_ACCEPTS_VIEWS
= 0x00000002,
22 B_BITMAP_IS_AREA
= 0x00000004,
23 B_BITMAP_IS_LOCKED
= 0x00000008 | B_BITMAP_IS_AREA
,
24 B_BITMAP_IS_CONTIGUOUS
= 0x00000010 | B_BITMAP_IS_LOCKED
,
25 B_BITMAP_IS_OFFSCREEN
= 0x00000020,
26 B_BITMAP_WILL_OVERLAY
= 0x00000040 | B_BITMAP_IS_OFFSCREEN
,
27 B_BITMAP_RESERVE_OVERLAY_CHANNEL
= 0x00000080,
28 B_BITMAP_NO_SERVER_LINK
= 0x00000100
31 #define B_ANY_BYTES_PER_ROW -1
33 //----------------------------------------------------------------//
34 //----- BBitmap class --------------------------------------------//
36 class BBitmap
: public BArchivable
{
38 BBitmap(BRect bounds
, uint32 flags
, color_space colorSpace
,
39 int32 bytesPerRow
= B_ANY_BYTES_PER_ROW
,
40 screen_id screenID
= B_MAIN_SCREEN_ID
);
41 BBitmap(BRect bounds
, color_space colorSpace
, bool acceptsViews
= false,
42 bool needsContiguous
= false);
43 BBitmap(const BBitmap
*source
, bool acceptsViews
= false,
44 bool needsContiguous
= false);
48 BBitmap(BMessage
*data
);
49 static BArchivable
*Instantiate(BMessage
*data
);
50 virtual status_t
Archive(BMessage
*data
, bool deep
= true) const;
52 status_t
InitCheck() const;
55 status_t
LockBits(uint32
*state
= NULL
);
60 int32
BitsLength() const;
61 int32
BytesPerRow() const;
62 color_space
ColorSpace() const;
65 void SetBits(const void *data
, int32 length
, int32 offset
,
66 color_space colorSpace
);
68 // not part of the R5 API
69 status_t
ImportBits(const void *data
, int32 length
, int32 bpr
,
70 int32 offset
, color_space colorSpace
);
71 status_t
ImportBits(const BBitmap
*bitmap
);
73 status_t
GetOverlayRestrictions(overlay_restrictions
*restrictions
) const;
75 //----- Private or reserved -----------------------------------------//
77 virtual status_t
Perform(perform_code d
, void *arg
);
80 virtual void _ReservedBitmap1();
81 virtual void _ReservedBitmap2();
82 virtual void _ReservedBitmap3();
84 BBitmap(const BBitmap
&);
85 BBitmap
&operator=(const BBitmap
&);
87 char *get_shared_pointer() const;
88 int32
get_server_token() const;
89 void InitObject(BRect bounds
, color_space colorSpace
, uint32 flags
,
90 int32 bytesPerRow
, screen_id screenID
);
97 color_space fColorSpace
;
109 /*-------------------------------------------------------------*/
110 /*-------------------------------------------------------------*/