* added a little documentation to BIconUtils in the header

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18401 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2006-08-05 13:53:54 +00:00
parent 70f4b8c0ae
commit 6b422a8c22
2 changed files with 18 additions and 1 deletions
+6 -1
View File
@@ -96,7 +96,7 @@ BIconUtils::GetVectorIcon(const uint8* buffer, size_t size,
renderer.Render(); renderer.Render();
// TODO: would be nice to get rid of this // TODO: would be nice to get rid of this
// (B_RGBA32_PREMULTIPLIED or better yes, new blending_mode) // (B_RGBA32_PREMULTIPLIED or better yet, new blending_mode)
// NOTE: probably not necessary only because // NOTE: probably not necessary only because
// transparent colors are "black" in all existing icons // transparent colors are "black" in all existing icons
// lighter transparent colors should be too dark if // lighter transparent colors should be too dark if
@@ -106,6 +106,8 @@ BIconUtils::GetVectorIcon(const uint8* buffer, size_t size,
return B_OK; return B_OK;
} }
// #pragma mark -
// ConvertFromCMAP8 // ConvertFromCMAP8
status_t status_t
BIconUtils::ConvertFromCMAP8(BBitmap* source, BBitmap* result) BIconUtils::ConvertFromCMAP8(BBitmap* source, BBitmap* result)
@@ -117,6 +119,9 @@ BIconUtils::ConvertFromCMAP8(BBitmap* source, BBitmap* result)
if (ret < B_OK) if (ret < B_OK)
return ret; return ret;
if (source->ColorSpace() != B_CMAP8)
return B_BAD_VALUE;
uint8* src = (uint8*)source->Bits(); uint8* src = (uint8*)source->Bits();
uint32 srcBPR = source->BytesPerRow(); uint32 srcBPR = source->BytesPerRow();
uint32 width = source->Bounds().IntegerWidth() + 1; uint32 width = source->Bounds().IntegerWidth() + 1;
+12
View File
@@ -23,6 +23,15 @@ class BIconUtils {
public: public:
// Utility functions to import a vector icon in "flat icon"
// format from a BNode attribute or from a flat buffer in
// memory into the preallocated BBitmap "result".
// The colorspace of result needs to be B_RGBA32 or at
// least B_RGB32 (though that makes less sense). The icon
// will be scaled from it's "native" size of 64x64 to the
// size of the bitmap, the scale is derived from the bitmap
// width, the bitmap should have square dimension, or the
// icon will be cut off at the bottom (or have room left).
static status_t GetVectorIcon(BNode* node, static status_t GetVectorIcon(BNode* node,
const char* attrName, const char* attrName,
BBitmap* result); BBitmap* result);
@@ -32,6 +41,9 @@ class BIconUtils {
BBitmap* result); BBitmap* result);
// Utility functions to convert from old icon colorspace
// into colorspace of BBitmap "result" (should be B_RGBA32
// to make any sense).
static status_t ConvertFromCMAP8(BBitmap* source, static status_t ConvertFromCMAP8(BBitmap* source,
BBitmap* result); BBitmap* result);