/** Copyright 2011-2023 Haiku, Inc. All rights reserved.* Distributed under the terms of the MIT License.** Authors:* Adrien Destugues, pulkomandy@pulkomandy.tk** Corresponds to:* headers/os/interface/IconUtils.h hrev57019* src/kits/interface/IconUtils.cpp hrev57019*//*!\file IconUtils.h\ingroup interface\ingroup libbe\brief Vector icon handling utility class*//*!\class BIconUtils\ingroup interface\ingroup libbe\brief The BIconUtils class provide utility methods for managing anddrawing vector icons.Haiku icons are stored in the HVIF (Haiku Vector Icon Format). This formatwas designed specifically for this purpose, and allows the icon data to besmall enough to fit in file's inodes. This way, the icon can be displayedlike any other file attribute, without extra disk access.This class provide only static methods to allow access to the icon data andrendering to BBitmaps for later use in an application. It also supportsolder icons in bitmap format. These may still be useful at very smallsizes. Note you can't create an instance of BIconUtils, just call thestatic methods.\since Haiku R1*//*!\fn static status_t BIconUtils::GetIcon(BNode* node,const char* vectorIconAttrName, const char* smallIconAttrName,const char* largeIconAttrName, icon_size size, BBitmap* result)\brief Utility function to import an icon from a node.Utility function to import an icon from the node thathas either of the provided attribute names. Which icon typeis preferred (vector, small or large B_CMAP8 icon) dependson the colorspace of the provided bitmap.\note If the colorspace is B_CMAP8, B_CMAP8 icons are preferred. In thatcase, the bitmap size must also match the provided icon_size "size"!\since Haiku R1*//*!\fn static status_t BIconUtils::GetVectorIcon(BNode* node,const char* attrName, BBitmap* result)\brief Utility function to import a vector icon in "flat icon" format.Utility function to import a vector icon in "flat icon"format from a BNode attribute into the preallocated BBitmap \a result.The colorspace of result needs to be B_RGBA32 or atleast B_RGB32 (though that makes less sense). The iconwill be scaled from its "native" size of 64x64 to thesize of the bitmap.\note The scale is derived from the bitmap width, the bitmap should havesquare dimension, or the icon will be cut off at the bottom (or haveroom left).\since Haiku R1*//*!\fn static status_t BIconUtils::GetVectorIcon(const uint8* buffer,size_t size, BBitmap* result)\brief Utility function to import a vector icon in "flat icon" format.Utility function to import a vector icon in "flat icon"format from the given \a buffer into the preallocated BBitmap \a result.The colorspace of result needs to be B_RGBA32 or atleast B_RGB32 (though that makes less sense). The iconwill be scaled from its "native" size of 64x64 to thesize of the bitmap.\note The scale is derived from the bitmap width, the bitmap should havesquare dimension, or the icon will be cut off at the bottom (or haveroom left).\since Haiku R1*//*!\fn static status_t BIconUtils::GetCMAP8Icon(BNode* node,const char* smallIconAttrName, const char* largeIconAttrName,icon_size size, BBitmap* icon)\brief Utility function to import an "old" BeOS icon in B_CMAP8 colorspace.Utility function to import an "old" BeOS icon in B_CMAP8 colorspace fromeither the small icon attribute or the large icon attribute as given in\a smallIconAttrName and \a largeIconAttrName. Which icon is loaded dependson the given \a size.\since Haiku R1*//*\fn static status_t BIconUtils::GetSystemIcon(const char* iconName, BBitmap* result)\brief Load an icon from the set of system icons.To provide some uniformity between different applications, a base set of icons is providedwith Haiku. Whenever possible, these should be used instead of application specific icons,to ensure consistency and ease of discovering application functions.The available icons follow the FreeDesktop icon-naming-spec convention. At this time thefollowing icons are available:- Flag icons for 245 countries- dialog-error, dialog-information, and dialog-warning- As an extension not available in FreeDesktop specifications, dialog-idea is also availableand corresponds to the icon used in BAlert of type B_IDEA_ALERT.The icon is automatically scaled to fit the \a result bitmap, which must be allocated andvalid before calling this function.\return B_OK if the icon could be loaded into the \a result BBitmap. B_ENTRY_NOT_FOUND if therequested icon is not currently available.\since Haiku R1*//*!\fn static status_t BIconUtils::ConvertFromCMAP8(BBitmap* source,BBitmap* result)\brief Converts an old-style icon to another colorspace.Utility function to convert from old icon colorspace into colorspace ofBBitmap \a result\note result should be in B_RGBA32 colorspace, and source in B_CMAP8.\since Haiku R1*//*!\fn static status_t BIconUtils::ConvertToCMAP8(BBitmap* source,BBitmap* result)\brief Converts a true-color icon to CMAP8 colorspace.Utility function to convert data from source into \a result colorspace.Call this to convert a picture to a format suitable for storage as anold-style icon.\note result should be in B_CMAP8 colorspace, and source in B_RGBA32.\since Haiku R1*//*!\fn static status_t BIconUtils::ConvertFromCMAP8(const uint8* data,uint32 width, uint32 height, uint32 bytesPerRow, BBitmap* result);\brief Convert raw data in B_CMAP8 colorspace to a B_RGBA32 BBitmap.\since Haiku R1*//*!\fn static status_t BIconUtils::ConvertToCMAP8(const uint8* data,uint32 width, uint32 height, uint32 bytesPerRow, BBitmap* result);\brief Convert B_RGBA32 raw data into a B_CMAP8 BBitmap.\since Haiku R1*/