227 lines
34 KiB
HTML
227 lines
34 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Classes And Methods - The Interface Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
|
||
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
|
||
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheInterfaceKit.html" title="The Interface Kit" /><link rel="prev" href="BAlert.html" title="BAlert" /><link rel="next" href="BBox.html" title="BBox" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BAlert.html" title="BAlert"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheInterfaceKit.html" title="The Interface Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BBox.html" title="BBox"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Classes And Methods - The Interface Kit</div></div><div id="headerB">Prev: <a href="BAlert.html">BAlert</a> Up: <a href="TheInterfaceKit.html">The Interface Kit</a> Next: <a href="BBox.html">BBox</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap"></a>BBitmap</h2></div></div></div><a id="id969661" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td>–</td></tr><tr><td>Mix-in Classes:</td><td><a class="link" href="BArchivable.html" title="BArchivable">BArchivable</a></td></tr><tr><td>Declared In:</td><td><code class="filename">interface/Bitmap.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libbe.so</code></td></tr><tr><td>Allocation:</td><td>Constructor only</td></tr></tbody></table></td><td>
|
||
<a class="link overview" href="BBitmap_Overview.html" title="BBitmap">Class Overview</a>
|
||
<div class="toc"><ul><li><span class="section"><a href="BBitmap.html#BBitmap_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BBitmap.html#BBitmap_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BBitmap.html#BBitmap_StaticFunctions">Static Functions</a></span></li><li><span class="section"><a href="BBitmap.html#BBitmap_ArchivedFields">Archived Fields</a></span></li></ul></div>
|
||
</td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_Constructor"></a>BBitmap()</h4></div></div></div><div class="synopsisgroup">
|
||
<code class="constructorsynopsis cpp"><span class="methodname">BBitmap</span>(<span class="methodparam"><span class="type"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> </span><span class="parameter">bounds</span></span>,<br /> <span class="methodparam"><span class="type">color_space </span><span class="parameter">space</span></span>,<br /> <span class="methodparam"><span class="type">bool </span><span class="parameter">acceptsViews</span><span class="initializer"> = <span class="constant">false</span></span></span>,<br /> <span class="methodparam"><span class="type">bool </span><span class="parameter">needsContiguousMemory</span><span class="initializer"> = <span class="constant">false</span></span></span>);</code>
|
||
|
||
<code class="constructorsynopsis cpp"><span class="methodname">BBitmap</span>(<span class="methodparam"><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="parameter">archive</span></span>);</code>
|
||
</div><p>
|
||
Creates a new <code class="classname">BBitmap</code> object that can hold a bitmap whose size and depth
|
||
are described by <code class="parameter">bounds</code> and <code class="parameter">space</code>.
|
||
The bitmap data is uninitialized; you set the data through
|
||
<a class="link" href="BBitmap.html#BBitmap_Bits" title="Bits()"><code class="methodname">Bits()</code></a> /
|
||
<a class="link" href="BBitmap.html#BBitmap_SetBits" title="SetBits()"><code class="methodname">SetBits()</code></a>,
|
||
or by drawing into an attached
|
||
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>
|
||
(see "<a class="link" href="BBitmap_Overview.html#BBitmap_Overview_Using_A_View" title="Using a View to Draw into a Bitmap">Using a View to Draw into a Bitmap</a>").
|
||
</p><div class="admonition warning"><div class="title">Warning</div><div class="graphic"><img class="icon" alt="Warning" width="32" src="./images/admonitions/Stop_32.png" /><div class="text"><p>The <code class="classname">BBitmap</code> class insists that a
|
||
<a class="link" href="BApplication.html" title="BApplication"><code class="classname">BApplication</code></a>
|
||
object be present (but not necessarily running).</p></div></div></div><p>
|
||
If <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>s are to be used,
|
||
the <code class="parameter">acceptsViews</code> argument must be set to <code class="constant">true</code>.
|
||
Furthermore (in this case), the origin of the <code class="parameter">bounds</code> rectangle must be
|
||
0.0
|
||
</p><p>
|
||
If the <code class="parameter">needsContiguousMemory</code> flag is
|
||
<code class="constant">true</code>, the <code class="classname">BBitmap</code> will make sure
|
||
that the (physical) memory it allocates is one contiguous physical chunk.
|
||
This should matter only to drivers doing direct DMA into physical memory.
|
||
</p><p>
|
||
The possible color spaces are enumerated in the section
|
||
"<a class="link" href="TheInterfaceKit_Drawing.html#TheInterfaceKit_Drawing_Color_Spaces" title="Color Spaces">Color Spaces</a>".
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_Destructor"></a>~BBitmap()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BBitmap</span>();</code><p>
|
||
Frees all memory allocated to hold image data, deletes any
|
||
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>s used to
|
||
create the image, gets rid of the off-screen window that held the views,
|
||
and severs the <code class="classname">BBitmap</code>'s connection to the
|
||
<span class="application">Application Server</span>.
|
||
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_MemberFunctions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_AddChild"></a>AddChild()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">AddChild</span>(<span class="methodparam"><span class="type"><a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>* </span><span class="parameter">aView</span></span>);</code><p>
|
||
Adds <code class="parameter">aView</code> (and all its children) to this
|
||
<code class="classname">BBitmap</code>'s view hierarchy, and
|
||
causes <a class="link" href="BView.html#BView_AttachedToWindow" title="AttachedToWindow(), AllAttached()"><code class="methodname">AttachedToWindow()</code></a>
|
||
to be sent to the newly add children.
|
||
</p><div class="admonition warning"><div class="title">Warning</div><div class="graphic"><img class="icon" alt="Warning" width="32" src="./images/admonitions/Stop_32.png" /><div class="text"><p>If <code class="parameter">aView</code> already has a parent, the application may crash. Be sure to
|
||
remove the view from a previous parent before trying to add it to a
|
||
bitmap.</p></div></div></div><p>
|
||
<code class="methodname">AddChild()</code> fails if the <code class="classname">BBitmap</code>
|
||
was not constructed to accept views.
|
||
</p><p>
|
||
See also:
|
||
<a class="link" href="BWindow.html#BWindow_AddChild" title="AddChild(), RemoveChild(), ChildAt(), CountChildren()"><code class="methodname">BWindow::AddChild()</code></a>,
|
||
<a class="link" href="BView.html#BView_AttachedToWindow" title="AttachedToWindow(), AllAttached()"><code class="methodname">BView::AttachedToWindow()</code></a>,
|
||
<a class="link" href="BBitmap.html#BBitmap_RemoveChild" title="RemoveChild"><code class="methodname">RemoveChild()</code></a>,
|
||
the <code class="classname">BBitmap</code> <a class="link" href="BBitmap.html#BBitmap_Constructor" title="BBitmap()">constructor</a>
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_Archive"></a>Archive()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">status_t </span><span class="methodname">Archive</span>(<span class="methodparam"><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="parameter">archive</span></span>,<br /> <span class="methodparam"><span class="type">bool </span><span class="parameter">deep</span><span class="initializer"> = <span class="constant">true</span></span></span>) <span class="modifier">const</span>;</code><p>
|
||
Calls the inherited version of
|
||
<a class="link" href="BArchivable.html#BArchivable_Archive" title="Archive()"><code class="methodname">Archive()</code></a> and stores the
|
||
<code class="classname">BBitmap</code> in the
|
||
<a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> archive.
|
||
</p><p>
|
||
See also:
|
||
<a class="link" href="BArchivable.html#BArchivable_Archive" title="Archive()"><code class="methodname">BArchivable::Archive()</code></a>,
|
||
<a class="link" href="BBitmap.html#BBitmap_Instantiate" title="Instantiate()"><code class="methodname">Instantiate()</code></a> static function
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_Bits"></a>Bits()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">void* </span><span class="methodname">Bits</span>() <span class="modifier">const</span>;</code><p>
|
||
Returns a pointer to the bitmap data. The length of the data can be
|
||
obtained by calling <a class="link" href="BBitmap.html#BBitmap_BitsLength" title="BitsLength()"><code class="methodname">BitsLength()</code></a>—or it can be calculated from the
|
||
height of the bitmap (the number of rows) and
|
||
<a class="link" href="BBitmap.html#BBitmap_BytesPerRow" title="BytesPerRow()"><code class="methodname">BytesPerRow()</code></a>.
|
||
</p><p>
|
||
The data is in the format specified by
|
||
<a class="link" href="BBitmap.html#BBitmap_ColorSpace" title="ColorSpace()"><code class="methodname">ColorSpace()</code></a>.
|
||
</p><p>
|
||
This pointer is valid throughout the entire lifespan of the object.
|
||
</p><p>
|
||
See also:
|
||
<a class="link" href="BBitmap.html#BBitmap_Bounds" title="Bounds()"><code class="methodname">Bounds()</code></a>,
|
||
<a class="link" href="BBitmap.html#BBitmap_BytesPerRow" title="BytesPerRow()"><code class="methodname">BytesPerRow()</code></a>,
|
||
<a class="link" href="BBitmap.html#BBitmap_BitsLength" title="BitsLength()"><code class="methodname">BitsLength()</code></a>
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_BitsLength"></a>BitsLength()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">int32 </span><span class="methodname">BitsLength</span>() <span class="modifier">const</span>;</code><p>
|
||
Returns the number of bytes that were allocated to store the bitmap data.
|
||
</p><p>
|
||
See also:
|
||
<a class="link" href="BBitmap.html#BBitmap_Bits" title="Bits()"><code class="methodname">Bits()</code></a>,
|
||
<a class="link" href="BBitmap.html#BBitmap_BytesPerRow" title="BytesPerRow()"><code class="methodname">BytesPerRow()</code></a>
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_Bounds"></a>Bounds()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> </span><span class="methodname">Bounds</span>() <span class="modifier">const</span>;</code><p>
|
||
Returns the bounds rectangle that defines the size and coordinate system
|
||
of the bitmap. This should be identical to the rectangle used in
|
||
constructing the object.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_BytesPerRow"></a>BytesPerRow()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">int32 </span><span class="methodname">BytesPerRow</span>() <span class="modifier">const</span>;</code><p>
|
||
Returns how many bytes of data are required to specify a row of pixels.
|
||
This may include slop space required by the graphics hardware; you should
|
||
always use this call to determine the width of a row of pixels in bytes
|
||
instead of assuming that it will be the number of pixels multiplied by
|
||
the size of a pixel in bytes.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_ChildAt"></a><a id="BBitmap_CountChildren"></a>
|
||
ChildAt(), CountChildren()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>* </span><span class="methodname">ChildAt</span>(<span class="methodparam"><span class="type">int32 </span><span class="parameter">index</span></span>) <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">int32 </span><span class="methodname">CountChildren</span>() <span class="modifier">const</span>;</code><p>
|
||
<code class="methodname">ChildAt()</code> returns the child
|
||
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> at <code class="parameter">index</code>,
|
||
or <code class="constant">NULL</code> if there's no child
|
||
at <code class="parameter">index</code>. Indices begin at 0 and count only
|
||
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>s that were added to the
|
||
<code class="classname">BBitmap</code> (added as children of the top view of the <code class="classname">BBitmap</code>'s off-screen
|
||
window) and not subsequently removed.
|
||
</p><p>
|
||
<code class="methodname">CountChildren()</code> returns the number of
|
||
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>s
|
||
the <code class="classname">BBitmap</code> currently has.
|
||
(It counts only <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>s that were added directly to the <code class="classname">BBitmap</code>, not
|
||
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>s farther down the view hierarchy.)
|
||
</p><p>
|
||
These functions fail if the <code class="classname">BBitmap</code> wasn't constructed to accept views.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_ColorSpace"></a>ColorSpace()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">color_space </span><span class="methodname">ColorSpace</span>() <span class="modifier">const</span>;</code><p>
|
||
Returns the color space of the data being stored (not necessarily the
|
||
color space of the data passed to the
|
||
<a class="link" href="BBitmap.html#BBitmap_SetBits" title="SetBits()"><code class="methodname">SetBits()</code></a> function). Once set by
|
||
the <code class="classname">BBitmap</code> constructor, the color space doesn't change.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_FindView"></a>FindView()</h4></div></div></div><div class="synopsisgroup">
|
||
<code class="methodsynopsis cpp"><span class="type"><a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>* </span><span class="methodname">FindView</span>(<span class="methodparam"><span class="type"><a class="link" href="BPoint.html" title="BPoint"><code class="classname">BPoint</code></a> </span><span class="parameter">point</span></span>) <span class="modifier">const</span>;</code>
|
||
|
||
<code class="methodsynopsis cpp"><span class="type"><a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>* </span><span class="methodname">FindView</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">name</span></span>) <span class="modifier">const</span>;</code>
|
||
</div><p>
|
||
Returns the <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>
|
||
at <code class="parameter">point</code> within the bitmap or the <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> tagged
|
||
with <code class="parameter">name</code>. The point must be somewhere within the
|
||
<code class="classname">BBitmap</code>'s bounds
|
||
rectangle, which must have the coordinate origin, (0.0, 0.0), at its left
|
||
top corner.
|
||
</p><p>
|
||
If the <code class="classname">BBitmap</code> doesn't accept views, this function fails. If no view
|
||
draws at the <code class="parameter">point</code> given, or no view associated with the <code class="classname">BBitmap</code> has the
|
||
<code class="parameter">name</code> given, it returns <code class="constant">NULL</code>.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_IsValid"></a>IsValid()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsValid</span>() <span class="modifier">const</span>;</code><p>
|
||
Returns <code class="constant">true</code> if there's memory for the bitmap (if the address returned by
|
||
<a class="link" href="BBitmap.html#BBitmap_Bits" title="Bits()"><code class="methodname">Bits()</code></a> is valid), and <code class="constant">false</code> if not.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_Lock"></a><a id="BBitmap_Unlock"></a>
|
||
<a id="BBitmap_IsLocked"></a>
|
||
Lock(), Unlock(), IsLocked()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">Lock</span>();</code><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">Unlock</span>();</code><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsLocked</span>() <span class="modifier">const</span>;</code><p>
|
||
These functions lock and unlock the off-screen window where
|
||
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>s
|
||
associated with the <code class="classname">BBitmap</code> draw. Locking works for this window and its
|
||
views just as it does for ordinary on-screen windows.
|
||
</p><p>
|
||
<code class="methodname">Lock()</code> returns <code class="constant">false</code> if the <code class="classname">BBitmap</code> doesn't accept views or if its
|
||
off-screen window is unlockable (and therefore unusable) for some reason.
|
||
Otherwise, it doesn't return until it has the window locked and can
|
||
return <code class="constant">true</code>.
|
||
</p><p>
|
||
<code class="methodname">IsLocked()</code> returns <code class="constant">false</code> if the <code class="classname">BBitmap</code> doesn't accept views. Otherwise,
|
||
it returns the lock status of its off-screen window.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_RemoveChild"></a>RemoveChild</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">bool </span><span class="methodname">RemoveChild</span>(<span class="methodparam"><span class="type"><a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>* </span><span class="parameter">aView</span></span>);</code><p>
|
||
Removes <code class="parameter">aView</code> from the hierarchy of views associated with the <code class="classname">BBitmap</code>,
|
||
but only if <code class="parameter">aView</code> was added to the hierarchy by calling <code class="classname">BBitmap</code>'s version
|
||
of the <a class="link" href="BView.html#BView_AddChild" title="AddChild(), RemoveChild()"><code class="methodname">AddChild()</code></a> function.
|
||
</p><p>
|
||
If <code class="parameter">aView</code> is successfully removed, <code class="methodname">RemoveChild()</code> returns <code class="constant">true</code>. If not, it
|
||
returns <code class="constant">false</code>.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_SetBits"></a>SetBits()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">SetBits</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">void* </span><span class="parameter">data</span></span>,<br /> <span class="methodparam"><span class="type">int32 </span><span class="parameter">length</span></span>,<br /> <span class="methodparam"><span class="type">int32 </span><span class="parameter">offset</span></span>,<br /> <span class="methodparam"><span class="type">color_space </span><span class="parameter">mode</span></span>);</code><p>
|
||
Assigns <code class="parameter">length</code> bytes of <code class="parameter">data</code> to the <code class="classname">BBitmap</code> object. The new data is
|
||
copied into the bitmap beginning <code class="parameter">offset</code> bytes (not pixels) from the start
|
||
of allocated memory. To set data beginning with the first (left top)
|
||
pixel in the image, the <code class="parameter">offset</code> should be 0; to set data beginning with,
|
||
for example, the sixth pixel in the first row of a <code class="constant">B_RGB32</code> image, the
|
||
offset should be 20. The offset counts any padding required to align rows
|
||
of data.
|
||
</p><p>
|
||
This function is intended to be used for importing existing data from a
|
||
different format rather than for setting individual pixels in the bitmap.
|
||
If you're interested in coloring individual pixels, use
|
||
<a class="link" href="BBitmap.html#BBitmap_Bits" title="Bits()"><code class="methodname">Bits()</code></a> to obtain
|
||
direct access to the bitmap data.
|
||
</p><p>
|
||
The source data is specified in the <code class="parameter">mode</code> color space, which may or may
|
||
not be the same as the color space that the <code class="classname">BBitmap</code> uses to store the
|
||
data. If not, the following conversions are automatically made:
|
||
</p><ul class="itemizedlist"><li><p>
|
||
<code class="constant">B_GRAY1</code> and <code class="constant">B_RGB32</code> to <code class="constant">B_CMAP8</code>.
|
||
</p></li><li><p>
|
||
<code class="constant">B_CMAP8</code> and <code class="constant">B_GRAY1</code> to <code class="constant">B_RGB32</code>.
|
||
</p></li></ul><div class="admonition note"><div class="title">Note</div><div class="graphic"><img class="icon" alt="Note" width="32" src="./images/admonitions/Info_32.png" /><div class="text"><p>These are the only color conversions <code class="methodname">SetBits()</code> understands; all other
|
||
conversions must be performed manually.</p></div></div></div><p>
|
||
Colors may be dithered in a conversion to <code class="constant">B_CMAP8</code> so that the resulting
|
||
image will match the original as closely as possible, despite the lost
|
||
information.
|
||
</p><p>
|
||
If the color space <code class="parameter">mode</code> is <code class="constant">B_RGB32</code>, the <code class="parameter">data</code> should be triplets of three
|
||
8-bit components—red, green, and blue, in that order—without
|
||
an alpha component. Although stored as 32-bit quantities with the
|
||
components in BGRA order, the input data is only 24 bits in RGB order.
|
||
Rows of source data do not need to be aligned.
|
||
</p><p>
|
||
However, if the source data is in any <code class="parameter">mode</code> other than <code class="constant">B_RGB32</code>, padding
|
||
must be added so that each row is aligned on a <span class="type">int32</span> word boundary.
|
||
</p><div class="admonition warning"><div class="title">Warning</div><div class="graphic"><img class="icon" alt="Warning" width="32" src="./images/admonitions/Stop_32.png" /><div class="text"><p><code class="methodname">SetBits()</code> works only on
|
||
<code class="classname">BBitmap</code>s in <code class="constant">B_GRAY1</code>,
|
||
<code class="constant">B_CMAP8</code>, and <code class="constant">B_RGB32</code> color
|
||
spaces; all other conversions must be carried out manually.</p></div></div></div><p>
|
||
This function works for all <code class="classname">BBitmap</code>s, whether or not <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>s are also
|
||
enlisted to produce the image.
|
||
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_StaticFunctions"></a>Static Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_Instantiate"></a>Instantiate()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">static </span><span class="type"><a class="link" href="BArchivable.html" title="BArchivable"><code class="classname">BArchivable</code></a>* </span><span class="methodname">Instantiate</span>(<span class="methodparam"><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="parameter">archive</span></span>);</code><p>
|
||
Returns a new <code class="classname">BBitmap</code> object—or <code class="constant">NULL</code>, if the <code class="parameter">archive</code> message
|
||
doesn't contain data for a <code class="classname">BBitmap</code> object. The new object is allocated by
|
||
new and created with the version of the constructor that takes a <a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>
|
||
archive.
|
||
</p><p>
|
||
See also:
|
||
<a class="link" href="BArchivable.html#BArchivable_Instantiate" title="Instantiate()"><code class="methodname">BArchivable::Instantiate()</code></a>,
|
||
<a class="link" href="TheSupportKit_Functions.html#instantiate_object" title="instantiate_object()"><code class="function">instantiate_object()</code></a>,
|
||
<a class="link" href="BBitmap.html#BBitmap_Archive" title="Archive()"><code class="methodname">Archive()</code></a>
|
||
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BBitmap_ArchivedFields"></a>Archived Fields</h3></div></div></div><p>
|
||
The <a class="link" href="BBitmap.html#BBitmap_Archive" title="Archive()"><code class="methodname">Archive()</code></a>
|
||
function adds the following fields to its <a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> argument:
|
||
</p><div class="informaltable"><table border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Field</th><th>Type code</th><th>Description</th></tr></thead><tbody><tr><td><code class="varname">_frame</code></td><td><code class="constant">B_RECT_TYPE</code></td><td>The <code class="classname">BBitmap</code>'s bounds rectangle.</td></tr><tr><td><code class="varname">_cspace</code></td><td><code class="constant">B_INT32_TYPE</code></td><td>The color_space of the data.</td></tr><tr><td><code class="varname">_view_ok</code></td><td><code class="constant">B_BOOL_TYPE</code></td><td>Always <code class="constant">true</code>, indicating the <code class="classname">BBitmap</code> accepts views
|
||
(only present in deep copy archives of <code class="classname">BBitmap</code>s accepting views).</td></tr><tr><td><code class="varname">_data</code></td><td><code class="constant">B_RAW_TYPE</code></td><td>The bitmap data (present only if <code class="varname">_view_ok</code> not present).</td></tr><tr><td><code class="varname">_continguous</code></td><td><code class="constant">B_BOOL_TYPE</code></td><td>Whether the <code class="classname">BBitmap</code> requires memory in one
|
||
contiguous chunk.</td></tr></tbody></table></div><p>
|
||
If the <code class="varname">_view_ok</code> field is present, the child views of the BBitmap are
|
||
additionally archived in the <code class="varname">_views</code> array of
|
||
<a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessages</code></a>. See the
|
||
description of the <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>
|
||
<a class="link" href="BView.html#BView_ArchivedFields" title="Archived Fields">Archived Fields</a> for more information on those
|
||
fields.
|
||
</p></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BAlert.html">BAlert</a> Up: <a href="TheInterfaceKit.html">The Interface Kit</a> Next: <a href="BBox.html">BBox</a> </div><div id="footerB"><div id="footerBL"><a href="BAlert.html" title="BAlert"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheInterfaceKit.html" title="The Interface Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BBox.html" title="BBox"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
|
||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
|
||
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>
|