xref: /haiku/headers/os/interface/IconUtils.h (revision 445d4fd926c569e7b9ae28017da86280aaecbae2)
1 /*
2  * Copyright 2006-2023, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _ICON_UTILS_H
6 #define _ICON_UTILS_H
7 
8 
9 #include <Mime.h>
10 
11 class BBitmap;
12 class BNode;
13 
14 
15 class BIconUtils {
16 								BIconUtils();
17 								~BIconUtils();
18 								BIconUtils(const BIconUtils&);
19 			BIconUtils&			operator=(const BIconUtils&);
20 
21 public:
22 	static	status_t			GetIcon(BNode* node,
23 									const char* vectorIconAttrName,
24 									const char* smallIconAttrName,
25 									const char* largeIconAttrName,
26 									icon_size size, BBitmap* result);
27 
28 	static	status_t			GetVectorIcon(BNode* node,
29 									const char* attrName, BBitmap* result);
30 
31 	static	status_t			GetVectorIcon(const uint8* buffer,
32 									size_t size, BBitmap* result);
33 
34 	static	status_t			GetCMAP8Icon(BNode* node,
35 									const char* smallIconAttrName,
36 									const char* largeIconAttrName,
37 									icon_size size, BBitmap* icon);
38 
39 	static	status_t			GetSystemIcon(const char* iconName, BBitmap* result);
40 
41 	static	status_t			ConvertFromCMAP8(BBitmap* source,
42 									BBitmap* result);
43 	static	status_t			ConvertToCMAP8(BBitmap* source,
44 									BBitmap* result);
45 
46 	static	status_t			ConvertFromCMAP8(const uint8* data,
47 									uint32 width, uint32 height,
48 									uint32 bytesPerRow, BBitmap* result);
49 
50 	static	status_t			ConvertToCMAP8(const uint8* data,
51 									uint32 width, uint32 height,
52 									uint32 bytesPerRow, BBitmap* result);
53 };
54 
55 #endif	// _ICON_UTILS_H
56