xref: /haiku/docs/user/interface/Bitmap.dox (revision 131261d2b5169bc95e384ede25aee5c371e5889b)
1a33f8fbdSAdrien Destugues/*
2820dca4dSJohn Scipione * Copyright 2011 Haiku Inc. All rights reserved.
3820dca4dSJohn Scipione * Distributed under the terms of the MIT License.
4a33f8fbdSAdrien Destugues *
5820dca4dSJohn Scipione * Authors:
6820dca4dSJohn Scipione *		Axel Dörfler, axeld@pinc-software.de
7820dca4dSJohn Scipione *		John Scipione, jscipione@gmail.com
8820dca4dSJohn Scipione *
9a33f8fbdSAdrien Destugues * Corresponds to:
10*131261d2SJohn Scipione *		headers/os/interface/Bitmap.h	 rev 42274
11*131261d2SJohn Scipione *		src/kits/interface/Bitmap.cpp	 rev 42274
12a33f8fbdSAdrien Destugues */
13a33f8fbdSAdrien Destugues
14820dca4dSJohn Scipione
15a33f8fbdSAdrien Destugues/*!
16a33f8fbdSAdrien Destugues	\file Bitmap.h
17820dca4dSJohn Scipione	\ingroup interface
18820dca4dSJohn Scipione	\ingroup libbe
19a33f8fbdSAdrien Destugues	\brief Defines the BBitmap class and global operators and functions for
20a33f8fbdSAdrien Destugues		handling bitmaps.
21a33f8fbdSAdrien Destugues*/
22a33f8fbdSAdrien Destugues
23a33f8fbdSAdrien Destugues
24a33f8fbdSAdrien Destugues/*!
25a33f8fbdSAdrien Destugues	\class BBitmap
26a33f8fbdSAdrien Destugues	\ingroup interface
27a33f8fbdSAdrien Destugues	\ingroup libbe
28a33f8fbdSAdrien Destugues	\brief Access and manipulate digital images commonly known as bitmaps.
29a33f8fbdSAdrien Destugues
30a33f8fbdSAdrien Destugues	A BBitmap is a rectangular map of pixel data. The BBitmap class allows you
31a33f8fbdSAdrien Destugues	to create a bitmap by specifying its pixel data and has operations for
32a33f8fbdSAdrien Destugues	altering and accessing the properties of bitmaps.
33a33f8fbdSAdrien Destugues
34a33f8fbdSAdrien Destugues	To create a BBitmap object use one of the constructor methods below. You
35a33f8fbdSAdrien Destugues	can determine if initialization was successful by calling the InitCheck()
36a33f8fbdSAdrien Destugues	method. You can determine if a BBitmap object is valid at any time by
37a33f8fbdSAdrien Destugues	calling the IsValid() method.
38a33f8fbdSAdrien Destugues
39a33f8fbdSAdrien Destugues	An example of creating a new 32x32 pixel BBitmap object and assigning the
40a33f8fbdSAdrien Destugues	icon of the current application looks like this:
41820dca4dSJohn Scipione
42a33f8fbdSAdrien Destugues\code
43a33f8fbdSAdrien DestuguesBBitmap iconBitmap = new BBitmap(BRect(0, 0, 31, 31), B_RGBA32));
44a33f8fbdSAdrien DestuguesappFileInfo.GetIcon(iconBitmap, B_LARGE_ICON);
45a33f8fbdSAdrien Destugues\endcode
46a33f8fbdSAdrien Destugues
47a33f8fbdSAdrien Destugues	You can access the properties of a bitmap by calling the Bounds(),
48a33f8fbdSAdrien Destugues	Flags(), ColorSpace(), Area(), Bits(), BitsLength(), BytesPerRow(),
49a33f8fbdSAdrien Destugues	and GetOverlayRestrictions() methods.
50a33f8fbdSAdrien Destugues
51a33f8fbdSAdrien Destugues	To directly set the pixel data of a bitmap call the Bits() or SetBits()
52a33f8fbdSAdrien Destugues	methods or you can use the ImportBits() method to copy the bits from an
53a33f8fbdSAdrien Destugues	existing bitmap.
54a33f8fbdSAdrien Destugues
55a33f8fbdSAdrien Destugues	You can also draw into a bitmap by attaching a child BView to the bitmap.
56a33f8fbdSAdrien Destugues	To add and remove child BView's to a bitmap call the AddChild() and
57a33f8fbdSAdrien Destugues	RemoveChild() methods respectively. You can access the child views of a
58a33f8fbdSAdrien Destugues	bitmap by calling the CountChildren(), ChildAt(), and FindView() methods.
59a33f8fbdSAdrien Destugues
60a33f8fbdSAdrien Destugues	For off-screen bitmaps it is important to lock the bitmap before drawing
61a33f8fbdSAdrien Destugues	the pixels and then unlock the bitmap when you are done to prevent
62a33f8fbdSAdrien Destugues	flickering. To lock and unlock a bitmap call the LockBits() and UnLockBits()
63a33f8fbdSAdrien Destugues	methods respectively. To lock and unlock the off-screen window that a
64a33f8fbdSAdrien Destugues	bitmap resides in you should call the Lock() and UnLock() methods. To
65a33f8fbdSAdrien Destugues	determine is a bitmap is currently locked you can call the IsLocked()
66a33f8fbdSAdrien Destugues	method.
67a33f8fbdSAdrien Destugues*/
68a33f8fbdSAdrien Destugues
69a33f8fbdSAdrien Destugues
70a33f8fbdSAdrien Destugues/*!
71a33f8fbdSAdrien Destugues	\fn BBitmap::BBitmap(BRect bounds, uint32 flags, color_space colorSpace,
72a33f8fbdSAdrien Destugues		int32 bytesPerRow, screen_id screenID)
73a33f8fbdSAdrien Destugues	\brief Creates and initializes a BBitmap object.
74a33f8fbdSAdrien Destugues
75a33f8fbdSAdrien Destugues	\param bounds The bitmap dimensions.
76a33f8fbdSAdrien Destugues	\param flags Creation flags.
77a33f8fbdSAdrien Destugues	\param colorSpace The bitmap's color space.
78a33f8fbdSAdrien Destugues	\param bytesPerRow The number of bytes per row the bitmap should use.
79a33f8fbdSAdrien Destugues		   \c B_ANY_BYTES_PER_ROW to let the constructor choose an appropriate
80a33f8fbdSAdrien Destugues		   value.
81a33f8fbdSAdrien Destugues	\param screenID ???
82a33f8fbdSAdrien Destugues*/
83a33f8fbdSAdrien Destugues
84a33f8fbdSAdrien Destugues
85a33f8fbdSAdrien Destugues/*!
86a33f8fbdSAdrien Destugues	\fn BBitmap::BBitmap(BRect bounds, color_space colorSpace,
87a33f8fbdSAdrien Destugues		bool acceptsViews, bool needsContiguous)
88a33f8fbdSAdrien Destugues	\brief Creates and initializes a BBitmap object.
89a33f8fbdSAdrien Destugues
90a33f8fbdSAdrien Destugues	\param bounds The bitmap dimensions.
91a33f8fbdSAdrien Destugues	\param colorSpace The bitmap's color space.
92a33f8fbdSAdrien Destugues	\param acceptsViews \c true, if the bitmap shall accept BViews, i.e. if
93a33f8fbdSAdrien Destugues		   it shall be possible to attach BView to the bitmap and draw into
94a33f8fbdSAdrien Destugues		   it.
95a33f8fbdSAdrien Destugues	\param needsContiguous If \c true a physically contiguous chunk of memory
96a33f8fbdSAdrien Destugues		   will be allocated.
97a33f8fbdSAdrien Destugues*/
98a33f8fbdSAdrien Destugues
99a33f8fbdSAdrien Destugues
100a33f8fbdSAdrien Destugues/*!
101a33f8fbdSAdrien Destugues	\fn BBitmap::BBitmap(const BBitmap* source, bool acceptsViews,
102a33f8fbdSAdrien Destugues		bool needsContiguous)
103a33f8fbdSAdrien Destugues	\brief Creates a BBitmap object as a clone of another bitmap.
104a33f8fbdSAdrien Destugues
105a33f8fbdSAdrien Destugues	\param source The source bitmap.
106a33f8fbdSAdrien Destugues	\param acceptsViews \c true, if the bitmap shall accept BViews, i.e. if
107a33f8fbdSAdrien Destugues		   it shall be possible to attach BView to the bitmap and draw into
108a33f8fbdSAdrien Destugues		   it.
109a33f8fbdSAdrien Destugues	\param needsContiguous If \c true a physically contiguous chunk of memory
110a33f8fbdSAdrien Destugues		   will be allocated.
111a33f8fbdSAdrien Destugues*/
112a33f8fbdSAdrien Destugues
113a33f8fbdSAdrien Destugues
114a33f8fbdSAdrien Destugues/*!
115a33f8fbdSAdrien Destugues	\fn BBitmap::BBitmap(const BBitmap& source, uint32 flags)
116a33f8fbdSAdrien Destugues	\brief Creates a BBitmap object as a clone of another bitmap.
117a33f8fbdSAdrien Destugues
118a33f8fbdSAdrien Destugues	\param source The source bitmap.
119a33f8fbdSAdrien Destugues	\param flags Creation flags.
120a33f8fbdSAdrien Destugues*/
121a33f8fbdSAdrien Destugues
122a33f8fbdSAdrien Destugues
123a33f8fbdSAdrien Destugues/*!
124a33f8fbdSAdrien Destugues	\fn BBitmap::BBitmap(const BBitmap& source)
125a33f8fbdSAdrien Destugues	\brief Creates a BBitmap object as a clone of another bitmap.
126a33f8fbdSAdrien Destugues
127a33f8fbdSAdrien Destugues	\param source The source bitmap.
128a33f8fbdSAdrien Destugues*/
129a33f8fbdSAdrien Destugues
130a33f8fbdSAdrien Destugues
131a33f8fbdSAdrien Destugues/*!
132a33f8fbdSAdrien Destugues	\fn BBitmap::~BBitmap()
133a33f8fbdSAdrien Destugues	\brief Destructor Method
134a33f8fbdSAdrien Destugues
135a33f8fbdSAdrien Destugues	Frees all resources associated with this object.
136a33f8fbdSAdrien Destugues*/
137a33f8fbdSAdrien Destugues
138a33f8fbdSAdrien Destugues
139a33f8fbdSAdrien Destugues/*!
140a33f8fbdSAdrien Destugues	\name Archiving
141a33f8fbdSAdrien Destugues*/
142a33f8fbdSAdrien Destugues
143a33f8fbdSAdrien Destugues
144a33f8fbdSAdrien Destugues//! @{
145a33f8fbdSAdrien Destugues
146a33f8fbdSAdrien Destugues
147a33f8fbdSAdrien Destugues/*!
148a33f8fbdSAdrien Destugues	\fn BBitmap::BBitmap(BMessage* data)
149a33f8fbdSAdrien Destugues	\brief Unarchives a bitmap from a BMessage.
150a33f8fbdSAdrien Destugues
151a33f8fbdSAdrien Destugues	\param data The archive.
152a33f8fbdSAdrien Destugues*/
153a33f8fbdSAdrien Destugues
154a33f8fbdSAdrien Destugues
155a33f8fbdSAdrien Destugues/*!
156a33f8fbdSAdrien Destugues	\fn BArchivable* BBitmap::Instantiate(BMessage* data)
157a33f8fbdSAdrien Destugues	\brief Instantiates a BBitmap from an archive.
158a33f8fbdSAdrien Destugues
159a33f8fbdSAdrien Destugues	\param data The archive.
160a33f8fbdSAdrien Destugues	\return A bitmap reconstructed from the archive or \c NULL, if an error
161a33f8fbdSAdrien Destugues		occurred.
162a33f8fbdSAdrien Destugues*/
163a33f8fbdSAdrien Destugues
164a33f8fbdSAdrien Destugues
165a33f8fbdSAdrien Destugues/*!
166a33f8fbdSAdrien Destugues	\fn status_t BBitmap::Archive(BMessage* data, bool deep) const
167a33f8fbdSAdrien Destugues	\brief Archives the BBitmap object.
168a33f8fbdSAdrien Destugues
169a33f8fbdSAdrien Destugues	\param data The archive.
170a33f8fbdSAdrien Destugues	\param deep if \c true, child object will be archived as well.
171a33f8fbdSAdrien Destugues	\return \c B_OK, if everything went fine, an error code otherwise.
172a33f8fbdSAdrien Destugues*/
173a33f8fbdSAdrien Destugues
174a33f8fbdSAdrien Destugues
175a33f8fbdSAdrien Destugues//! @}
176a33f8fbdSAdrien Destugues
177a33f8fbdSAdrien Destugues
178a33f8fbdSAdrien Destugues/*!
179a33f8fbdSAdrien Destugues	\fn status_t BBitmap::InitCheck() const
180a33f8fbdSAdrien Destugues	\brief Gets the status of the constructor.
181a33f8fbdSAdrien Destugues
182a33f8fbdSAdrien Destugues	\returns B_OK if initialization succeeded, otherwise returns an
183a33f8fbdSAdrien Destugues		error status.
184a33f8fbdSAdrien Destugues*/
185a33f8fbdSAdrien Destugues
186a33f8fbdSAdrien Destugues
187a33f8fbdSAdrien Destugues/*!
188a33f8fbdSAdrien Destugues	\fn bool BBitmap::IsValid() const
189a33f8fbdSAdrien Destugues	\brief Determines whether or not the BBitmap object is valid.
190a33f8fbdSAdrien Destugues
191a33f8fbdSAdrien Destugues	\return \c true, if the object is properly initialized, \c false otherwise.
192a33f8fbdSAdrien Destugues*/
193a33f8fbdSAdrien Destugues
194a33f8fbdSAdrien Destugues
195a33f8fbdSAdrien Destugues/*!
196a33f8fbdSAdrien Destugues	\name Locking
197a33f8fbdSAdrien Destugues*/
198a33f8fbdSAdrien Destugues
199a33f8fbdSAdrien Destugues
200a33f8fbdSAdrien Destugues//! @{
201a33f8fbdSAdrien Destugues
202a33f8fbdSAdrien Destugues
203a33f8fbdSAdrien Destugues/*!
204a33f8fbdSAdrien Destugues	\fn status_t BBitmap::LockBits(uint32* state)
205a33f8fbdSAdrien Destugues	\brief Locks the bitmap bits so that they cannot be relocated.
206a33f8fbdSAdrien Destugues
207a33f8fbdSAdrien Destugues	This is currently only used for overlay bitmaps; whenever you
208a33f8fbdSAdrien Destugues	need to access their Bits() you must lock them first.
209a33f8fbdSAdrien Destugues	On resolution change overlay bitmaps can be relocated in memory;
210a33f8fbdSAdrien Destugues	using this call prevents you from accessing an invalid pointer
211a33f8fbdSAdrien Destugues	and clobbering memory that doesn't belong you.
212a33f8fbdSAdrien Destugues
213a33f8fbdSAdrien Destugues	\param state Unused
214a33f8fbdSAdrien Destugues	\returns \c B_OK on success or an error status code.
215a33f8fbdSAdrien Destugues*/
216a33f8fbdSAdrien Destugues
217a33f8fbdSAdrien Destugues
218a33f8fbdSAdrien Destugues/*!
219a33f8fbdSAdrien Destugues	\fn void BBitmap::UnlockBits()
220a33f8fbdSAdrien Destugues	\brief Unlocks the bitmap's buffer.
221a33f8fbdSAdrien Destugues
222a33f8fbdSAdrien Destugues	Counterpart to BBitmap::LockBits().
223a33f8fbdSAdrien Destugues*/
224a33f8fbdSAdrien Destugues
225a33f8fbdSAdrien Destugues
226a33f8fbdSAdrien Destugues/*!
227a33f8fbdSAdrien Destugues	\fn bool BBitmap::Lock()
228a33f8fbdSAdrien Destugues	\brief Locks the off-screen window that belongs to the bitmap.
229a33f8fbdSAdrien Destugues
230a33f8fbdSAdrien Destugues	The bitmap must accept views, if locking should work.
231a33f8fbdSAdrien Destugues
232a33f8fbdSAdrien Destugues	\returns \c true, if the lock was acquired successfully.
233a33f8fbdSAdrien Destugues*/
234a33f8fbdSAdrien Destugues
235a33f8fbdSAdrien Destugues
236a33f8fbdSAdrien Destugues/*!
237a33f8fbdSAdrien Destugues	\fn void BBitmap::Unlock()
238a33f8fbdSAdrien Destugues	\brief Unlocks the off-screen window that belongs to the bitmap.
239a33f8fbdSAdrien Destugues
240a33f8fbdSAdrien Destugues	The bitmap must accept views, if locking should work.
241a33f8fbdSAdrien Destugues*/
242a33f8fbdSAdrien Destugues
243a33f8fbdSAdrien Destugues
244a33f8fbdSAdrien Destugues/*!
245a33f8fbdSAdrien Destugues	\fn bool BBitmap::IsLocked() const
246a33f8fbdSAdrien Destugues	\brief Determines whether or not the bitmap's off-screen window is locked.
247a33f8fbdSAdrien Destugues
248a33f8fbdSAdrien Destugues	The bitmap must accept views, if locking should work.
249a33f8fbdSAdrien Destugues
250a33f8fbdSAdrien Destugues	\return \c true, if the caller owns a lock , \c false otherwise.
251a33f8fbdSAdrien Destugues*/
252a33f8fbdSAdrien Destugues
253a33f8fbdSAdrien Destugues
254a33f8fbdSAdrien Destugues//! @}
255a33f8fbdSAdrien Destugues
256a33f8fbdSAdrien Destugues
257a33f8fbdSAdrien Destugues/*!
258a33f8fbdSAdrien Destugues	\name Accessors
259a33f8fbdSAdrien Destugues*/
260a33f8fbdSAdrien Destugues
261a33f8fbdSAdrien Destugues
262a33f8fbdSAdrien Destugues//! @{
263a33f8fbdSAdrien Destugues
264a33f8fbdSAdrien Destugues
265a33f8fbdSAdrien Destugues/*!
266a33f8fbdSAdrien Destugues	\fn area_id BBitmap::Area() const
267a33f8fbdSAdrien Destugues	\brief Gets the ID of the area the bitmap data reside in.
268a33f8fbdSAdrien Destugues
269a33f8fbdSAdrien Destugues	\return The ID of the area the bitmap data reside in.
270a33f8fbdSAdrien Destugues*/
271a33f8fbdSAdrien Destugues
272a33f8fbdSAdrien Destugues
273a33f8fbdSAdrien Destugues/*!
274a33f8fbdSAdrien Destugues	\fn void* BBitmap::Bits() const
275a33f8fbdSAdrien Destugues	\brief Gets the pointer to the bitmap data.
276a33f8fbdSAdrien Destugues
277a33f8fbdSAdrien Destugues	\return The pointer to the bitmap data.
278a33f8fbdSAdrien Destugues*/
279a33f8fbdSAdrien Destugues
280a33f8fbdSAdrien Destugues
281a33f8fbdSAdrien Destugues/*!
282a33f8fbdSAdrien Destugues	\fn int32 BBitmap::BitsLength() const
283a33f8fbdSAdrien Destugues	\brief Gets the length of the bitmap data.
284a33f8fbdSAdrien Destugues
285a33f8fbdSAdrien Destugues	\return The length of the bitmap data as an int32.
286a33f8fbdSAdrien Destugues*/
287a33f8fbdSAdrien Destugues
288a33f8fbdSAdrien Destugues
289a33f8fbdSAdrien Destugues/*!
290a33f8fbdSAdrien Destugues	\fn int32 BBitmap::BytesPerRow() const
291a33f8fbdSAdrien Destugues	\brief Gets the number of bytes used to store a row of bitmap data.
292a33f8fbdSAdrien Destugues
293a33f8fbdSAdrien Destugues	\return The number of bytes used to store a row of bitmap data.
294a33f8fbdSAdrien Destugues*/
295a33f8fbdSAdrien Destugues
296a33f8fbdSAdrien Destugues
297a33f8fbdSAdrien Destugues/*!
298a33f8fbdSAdrien Destugues	\fn color_space BBitmap::ColorSpace() const
299a33f8fbdSAdrien Destugues	\brief Gets the bitmap's color space.
300a33f8fbdSAdrien Destugues
301a33f8fbdSAdrien Destugues	\return The bitmap's color space.
302a33f8fbdSAdrien Destugues*/
303a33f8fbdSAdrien Destugues
304a33f8fbdSAdrien Destugues
305a33f8fbdSAdrien Destugues/*!
306a33f8fbdSAdrien Destugues	\fn BRect BBitmap::Bounds() const
307a33f8fbdSAdrien Destugues	\brief Gets a BRect the size of the bitmap's dimensions.
308a33f8fbdSAdrien Destugues
309a33f8fbdSAdrien Destugues	\return A BRect the size of the bitmap's dimensions.
310a33f8fbdSAdrien Destugues*/
311a33f8fbdSAdrien Destugues
312a33f8fbdSAdrien Destugues
313a33f8fbdSAdrien Destugues/*!
314a33f8fbdSAdrien Destugues	\fn uint32 BBitmap::Flags() const
315a33f8fbdSAdrien Destugues	\brief Accesses the bitmap's creation flags.
316a33f8fbdSAdrien Destugues
317a33f8fbdSAdrien Destugues	This method informs about which flags have been used to create the
318a33f8fbdSAdrien Destugues	bitmap. It would for example tell you wether this is an overlay
319a33f8fbdSAdrien Destugues	bitmap. If bitmap creation succeeded, all flags are fulfilled.
320a33f8fbdSAdrien Destugues
321a33f8fbdSAdrien Destugues	\return The bitmap's creation flags.
322a33f8fbdSAdrien Destugues*/
323a33f8fbdSAdrien Destugues
324a33f8fbdSAdrien Destugues
325a33f8fbdSAdrien Destugues/*!
326a33f8fbdSAdrien Destugues	\fn status_t BBitmap::GetOverlayRestrictions(overlay_restrictions*
327a33f8fbdSAdrien Destugues		restrictions) const
328a33f8fbdSAdrien Destugues	\brief Gets the overlay_restrictions structure for this bitmap.
329a33f8fbdSAdrien Destugues
330a33f8fbdSAdrien Destugues	\note This function is not part of the BeOS R5 API.
331a33f8fbdSAdrien Destugues
332a33f8fbdSAdrien Destugues	\param restrictions The overlay restrictions flag
333a33f8fbdSAdrien Destugues
334a33f8fbdSAdrien Destugues	\retval B_OK The overlay restriction structure was found.
335a33f8fbdSAdrien Destugues	\retval B_BAD_TYPE The overlay restriction structure for the bitmap could
336a33f8fbdSAdrien Destugues		not be found.
337a33f8fbdSAdrien Destugues*/
338a33f8fbdSAdrien Destugues
339a33f8fbdSAdrien Destugues
340a33f8fbdSAdrien Destugues//! @}
341a33f8fbdSAdrien Destugues
342a33f8fbdSAdrien Destugues
343a33f8fbdSAdrien Destugues/*!
344a33f8fbdSAdrien Destugues	\name Setters
345a33f8fbdSAdrien Destugues*/
346a33f8fbdSAdrien Destugues
347a33f8fbdSAdrien Destugues
348a33f8fbdSAdrien Destugues//! @{
349a33f8fbdSAdrien Destugues
350a33f8fbdSAdrien Destugues
351a33f8fbdSAdrien Destugues/*!
352a33f8fbdSAdrien Destugues	\fn void BBitmap::SetBits(const void* data, int32 length, int32 offset,
353a33f8fbdSAdrien Destugues		color_space colorSpace)
354a33f8fbdSAdrien Destugues	\brief Assigns data to the bitmap.
355a33f8fbdSAdrien Destugues
356a33f8fbdSAdrien Destugues	Data are directly written into the bitmap's data buffer, being converted
357a33f8fbdSAdrien Destugues	beforehand, if necessary. Some conversions do not work intuitively:
358a33f8fbdSAdrien Destugues	- \c B_RGB32: The source buffer is supposed to contain \c B_RGB24_BIG
359a33f8fbdSAdrien Destugues	  data without padding at the end of the rows.
360a33f8fbdSAdrien Destugues	- \c B_RGB32: The source buffer is supposed to contain \c B_CMAP8
361a33f8fbdSAdrien Destugues	  data without padding at the end of the rows.
362a33f8fbdSAdrien Destugues	- other color spaces: The source buffer is supposed to contain data
363a33f8fbdSAdrien Destugues	  according to the specified color space being padded to int32 row-wise.
364a33f8fbdSAdrien Destugues
365a33f8fbdSAdrien Destugues	The currently supported source/target color spaces are
366a33f8fbdSAdrien Destugues	<code>B_RGB{32,24,16,15}[_BIG]</code>, \c B_CMAP8 and
367a33f8fbdSAdrien Destugues	<code>B_GRAY{8,1}</code>.
368a33f8fbdSAdrien Destugues
369a33f8fbdSAdrien Destugues	\note Since this methods is a bit strange to use, Haiku has introduced
370a33f8fbdSAdrien Destugues		the ImportBits() method which is the recommended replacement.
371a33f8fbdSAdrien Destugues
372a33f8fbdSAdrien Destugues	\param data The data to be copied.
373a33f8fbdSAdrien Destugues	\param length The length in bytes of the data to be copied.
374a33f8fbdSAdrien Destugues	\param offset The offset (in bytes) relative to beginning of the bitmap
375a33f8fbdSAdrien Destugues		   data specifying the position at which the source data shall be
376a33f8fbdSAdrien Destugues		   written.
377a33f8fbdSAdrien Destugues	\param colorSpace Color space of the source data.
378a33f8fbdSAdrien Destugues*/
379a33f8fbdSAdrien Destugues
380a33f8fbdSAdrien Destugues
381a33f8fbdSAdrien Destugues/*!
382a33f8fbdSAdrien Destugues	\fn status_t BBitmap::ImportBits(const void* data, int32 length, int32 bpr,
383a33f8fbdSAdrien Destugues		int32 offset, color_space colorSpace)
384a33f8fbdSAdrien Destugues	\brief Assigns data to the bitmap.
385a33f8fbdSAdrien Destugues
386a33f8fbdSAdrien Destugues	Data are directly written into the bitmap's data buffer, being converted
387a33f8fbdSAdrien Destugues	beforehand, if necessary. Unlike for SetBits(), the meaning of
388a33f8fbdSAdrien Destugues	\a colorSpace is exactly the expected one here, i.e. the source buffer
389a33f8fbdSAdrien Destugues	is supposed to contain data of that color space. \a bpr specifies how
390a33f8fbdSAdrien Destugues	many bytes the source contains per row. \c B_ANY_BYTES_PER_ROW can be
391a33f8fbdSAdrien Destugues	supplied, if standard padding to int32 is used.
392a33f8fbdSAdrien Destugues
393a33f8fbdSAdrien Destugues	The currently supported source/target color spaces are
394a33f8fbdSAdrien Destugues	<code>B_RGB{32,24,16,15}[_BIG]</code>, \c B_CMAP8 and
395a33f8fbdSAdrien Destugues	<code>B_GRAY{8,1}</code>.
396a33f8fbdSAdrien Destugues
397a33f8fbdSAdrien Destugues	\note This function is not part of the BeOS R5 API.
398a33f8fbdSAdrien Destugues
399a33f8fbdSAdrien Destugues	\param data The data to be copied.
400a33f8fbdSAdrien Destugues	\param length The length in bytes of the data to be copied.
401a33f8fbdSAdrien Destugues	\param bpr The number of bytes per row in the source data.
402a33f8fbdSAdrien Destugues	\param offset The offset (in bytes) relative to beginning of the bitmap
403a33f8fbdSAdrien Destugues		   data specifying the position at which the source data shall be
404a33f8fbdSAdrien Destugues		   written.
405a33f8fbdSAdrien Destugues	\param colorSpace Color space of the source data.
406a33f8fbdSAdrien Destugues
407a33f8fbdSAdrien Destugues	\retval B_OK The bits were imported into the bitmap.
408a33f8fbdSAdrien Destugues	\retval B_BAD_VALUE \c NULL \a data, invalid \a bpr or \a offset, or
409a33f8fbdSAdrien Destugues	  unsupported \a colorSpace.
410a33f8fbdSAdrien Destugues*/
411a33f8fbdSAdrien Destugues
412a33f8fbdSAdrien Destugues
413a33f8fbdSAdrien Destugues/*!
414a33f8fbdSAdrien Destugues	\fn status_t BBitmap::ImportBits(const void* data, int32 length,
415a33f8fbdSAdrien Destugues		int32 bpr, color_space colorSpace, BPoint from, BPoint to,
416a33f8fbdSAdrien Destugues		int32 width, int32 height)
417a33f8fbdSAdrien Destugues	\brief Assigns data to the bitmap.
418a33f8fbdSAdrien Destugues
419a33f8fbdSAdrien Destugues	Allows for a BPoint offset in the source and in the bitmap. The region
420a33f8fbdSAdrien Destugues	of the source at \a from extending \a width and \a height is assigned
421a33f8fbdSAdrien Destugues	(and converted if necessary) to the bitmap at \a to.
422a33f8fbdSAdrien Destugues
423a33f8fbdSAdrien Destugues	The currently supported source/target color spaces are
424a33f8fbdSAdrien Destugues	<code>B_RGB{32,24,16,15}[_BIG]</code>, \c B_CMAP8 and
425a33f8fbdSAdrien Destugues	<code>B_GRAY{8,1}</code>.
426a33f8fbdSAdrien Destugues
427a33f8fbdSAdrien Destugues	\note This function is not part of the BeOS R5 API.
428a33f8fbdSAdrien Destugues
429a33f8fbdSAdrien Destugues	\param data The data to be copied.
430a33f8fbdSAdrien Destugues	\param length The length in bytes of the data to be copied.
431a33f8fbdSAdrien Destugues	\param bpr The number of bytes per row in the source data.
432a33f8fbdSAdrien Destugues	\param colorSpace Color space of the source data.
433a33f8fbdSAdrien Destugues	\param from The offset in the source where reading should begin.
434a33f8fbdSAdrien Destugues	\param to The offset in the bitmap where the source should be written.
435a33f8fbdSAdrien Destugues	\param width The width (in pixels) to be imported.
436a33f8fbdSAdrien Destugues	\param height The height (in pixels) to be imported.
437a33f8fbdSAdrien Destugues
438a33f8fbdSAdrien Destugues	\retval B_OK The bits were imported into the bitmap.
439a33f8fbdSAdrien Destugues	\retval B_BAD_VALUE: \c NULL \a data, invalid \a bpr, unsupported
440a33f8fbdSAdrien Destugues		\a colorSpace or invalid \a width or \a height.
441a33f8fbdSAdrien Destugues*/
442a33f8fbdSAdrien Destugues
443a33f8fbdSAdrien Destugues
444a33f8fbdSAdrien Destugues/*!
445a33f8fbdSAdrien Destugues	\fn status_t BBitmap::ImportBits(const BBitmap* bitmap)
446a33f8fbdSAdrien Destugues	\brief Assigns another bitmap's data to this bitmap.
447a33f8fbdSAdrien Destugues
448a33f8fbdSAdrien Destugues	The supplied bitmap must have the exactly same dimensions as this bitmap.
449a33f8fbdSAdrien Destugues	Its data is converted to the color space of this bitmap.
450a33f8fbdSAdrien Destugues
451a33f8fbdSAdrien Destugues	The currently supported source/target color spaces are
452a33f8fbdSAdrien Destugues	<code>B_RGB{32,24,16,15}[_BIG]</code>, \c B_CMAP8 and
453a33f8fbdSAdrien Destugues	<code>B_GRAY{8,1}</code>.
454a33f8fbdSAdrien Destugues
455a33f8fbdSAdrien Destugues	\note This function is not part of the BeOS R5 API.
456a33f8fbdSAdrien Destugues
457a33f8fbdSAdrien Destugues	\param bitmap The source bitmap.
458a33f8fbdSAdrien Destugues
459a33f8fbdSAdrien Destugues	\retval B_OK The bits were imported into the bitmap.
460a33f8fbdSAdrien Destugues	\retval B_BAD_VALUE \c NULL \a bitmap, or \a bitmap has other dimensions,
461a33f8fbdSAdrien Destugues		or the conversion from or to one of the color spaces is not supported.
462a33f8fbdSAdrien Destugues*/
463a33f8fbdSAdrien Destugues
464a33f8fbdSAdrien Destugues
465a33f8fbdSAdrien Destugues/*!
466a33f8fbdSAdrien Destugues	\fn status_t BBitmap::ImportBits(const BBitmap* bitmap, BPoint from,
467a33f8fbdSAdrien Destugues		BPoint to,int32 width, int32 height)
468a33f8fbdSAdrien Destugues	\brief Assigns data to the bitmap.
469a33f8fbdSAdrien Destugues
470a33f8fbdSAdrien Destugues	Allows for a BPoint offset in the source and in the bitmap. The region
471a33f8fbdSAdrien Destugues	of the source at \a from extending \a width and \a height is assigned
472a33f8fbdSAdrien Destugues	(and converted if necessary) to the bitmap at \a to. The source bitmap is
473a33f8fbdSAdrien Destugues	clipped to the bitmap and they don't need to have the same dimensions.
474a33f8fbdSAdrien Destugues
475a33f8fbdSAdrien Destugues	The currently supported source/target color spaces are
476a33f8fbdSAdrien Destugues	<code>B_RGB{32,24,16,15}[_BIG]</code>, \c B_CMAP8 and
477a33f8fbdSAdrien Destugues	<code>B_GRAY{8,1}</code>.
478a33f8fbdSAdrien Destugues
479a33f8fbdSAdrien Destugues	\note This function is not part of the BeOS R5 API.
480a33f8fbdSAdrien Destugues
481a33f8fbdSAdrien Destugues	\param bitmap The source bitmap.
482a33f8fbdSAdrien Destugues	\param from The offset in the source where reading should begin.
483a33f8fbdSAdrien Destugues	\param to The offset in the bitmap where the source should be written.
484a33f8fbdSAdrien Destugues	\param width The width (in pixels) to be imported.
485a33f8fbdSAdrien Destugues	\param height The height (in pixels) to be imported.
486a33f8fbdSAdrien Destugues
487a33f8fbdSAdrien Destugues	\retval B_OK The bits were imported into the bitmap.
488a33f8fbdSAdrien Destugues	\retval B_BAD_VALUE \c NULL \a bitmap, the conversion from or to one of
489a33f8fbdSAdrien Destugues	  	the color spaces is not supported, or invalid \a width or \a height.
490a33f8fbdSAdrien Destugues*/
491a33f8fbdSAdrien Destugues
492a33f8fbdSAdrien Destugues
493a33f8fbdSAdrien Destugues//! @}
494a33f8fbdSAdrien Destugues
495a33f8fbdSAdrien Destugues
496a33f8fbdSAdrien Destugues/*!
497a33f8fbdSAdrien Destugues	\name Child View Methods
498a33f8fbdSAdrien Destugues*/
499a33f8fbdSAdrien Destugues
500a33f8fbdSAdrien Destugues
501a33f8fbdSAdrien Destugues//! @{
502a33f8fbdSAdrien Destugues
503a33f8fbdSAdrien Destugues
504a33f8fbdSAdrien Destugues/*!
505a33f8fbdSAdrien Destugues	\fn void BBitmap::AddChild(BView* view)
506a33f8fbdSAdrien Destugues	\brief Adds a BView to the bitmap's view hierarchy.
507a33f8fbdSAdrien Destugues
508a33f8fbdSAdrien Destugues	The bitmap must accept views and the supplied view must not be child of
509a33f8fbdSAdrien Destugues	another parent.
510a33f8fbdSAdrien Destugues
511a33f8fbdSAdrien Destugues	\param view The view to be added.
512a33f8fbdSAdrien Destugues*/
513a33f8fbdSAdrien Destugues
514a33f8fbdSAdrien Destugues
515a33f8fbdSAdrien Destugues/*!
516a33f8fbdSAdrien Destugues	\fn bool BBitmap::RemoveChild(BView* view)
517a33f8fbdSAdrien Destugues	\brief Removes a BView from the bitmap's view hierarchy.
518a33f8fbdSAdrien Destugues
519a33f8fbdSAdrien Destugues	\param view The view to be removed.
520a33f8fbdSAdrien Destugues*/
521a33f8fbdSAdrien Destugues
522a33f8fbdSAdrien Destugues
523a33f8fbdSAdrien Destugues/*!
524a33f8fbdSAdrien Destugues	\fn int32 BBitmap::CountChildren() const
525a33f8fbdSAdrien Destugues	\brief Gets the number of BViews currently belonging to the bitmap.
526a33f8fbdSAdrien Destugues
527a33f8fbdSAdrien Destugues	\returns The number of BViews currently belonging to the bitmap.
528a33f8fbdSAdrien Destugues*/
529a33f8fbdSAdrien Destugues
530a33f8fbdSAdrien Destugues
531a33f8fbdSAdrien Destugues/*!
532a33f8fbdSAdrien Destugues	\fn BView* BBitmap::ChildAt(int32 index) const
533a33f8fbdSAdrien Destugues	\brief Gets the BView at a certain index in the bitmap's list of views.
534a33f8fbdSAdrien Destugues
535a33f8fbdSAdrien Destugues	\param index The index of the BView to be returned.
536a33f8fbdSAdrien Destugues	\returns The BView at index \a index or \c NULL if the index is out of
537a33f8fbdSAdrien Destugues		range.
538a33f8fbdSAdrien Destugues*/
539a33f8fbdSAdrien Destugues
540a33f8fbdSAdrien Destugues
541a33f8fbdSAdrien Destugues/*!
542a33f8fbdSAdrien Destugues	\fn BView* BBitmap::FindView(const char* viewName) const
543a33f8fbdSAdrien Destugues	\brief Accesses a bitmap's child BView with a the name \a viewName.
544a33f8fbdSAdrien Destugues
545a33f8fbdSAdrien Destugues	\param viewName The name of the BView to be returned.
546a33f8fbdSAdrien Destugues	\returns The BView with the name \a name or \c NULL if the bitmap doesn't
547a33f8fbdSAdrien Destugues		know a view with that name.
548a33f8fbdSAdrien Destugues*/
549a33f8fbdSAdrien Destugues
550a33f8fbdSAdrien Destugues
551a33f8fbdSAdrien Destugues/*!
552a33f8fbdSAdrien Destugues	\fn BView* BBitmap::FindView(BPoint point) const
553a33f8fbdSAdrien Destugues	\brief Accesses a bitmap's BView at a certain location.
554a33f8fbdSAdrien Destugues
555a33f8fbdSAdrien Destugues	\param point The location.
556a33f8fbdSAdrien Destugues	\returns The BView with located at \a point or \c NULL if the bitmap
557a33f8fbdSAdrien Destugues		doesn't know a view at this location.
558a33f8fbdSAdrien Destugues*/
559a33f8fbdSAdrien Destugues
560a33f8fbdSAdrien Destugues
561a33f8fbdSAdrien Destugues//! @}
562