Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qhaikuutils.cpp
Go to the documentation of this file.
1// Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qhaikuutils.h"
5
7{
8 color_space colorSpace = B_NO_COLOR_SPACE;
9 switch (format) {
11 colorSpace = B_NO_COLOR_SPACE;
12 break;
14 colorSpace = B_GRAY1;
15 break;
17 colorSpace = B_CMAP8;
18 break;
20 colorSpace = B_RGB32;
21 break;
23 colorSpace = B_RGBA32;
24 break;
26 colorSpace = B_RGB16;
27 break;
29 colorSpace = B_RGB15;
30 break;
32 colorSpace = B_RGB24;
33 break;
34 default:
35 qWarning("Cannot convert image format %d to color space", format);
36 Q_ASSERT(false);
37 break;
38 }
39
40 return colorSpace;
41}
42
44{
46 switch (colorSpace) {
47 case B_NO_COLOR_SPACE:
49 break;
50 case B_GRAY1:
52 break;
53 case B_CMAP8:
55 break;
56 case B_RGB32:
58 break;
59 case B_RGBA32:
61 break;
62 case B_RGB16:
64 break;
65 case B_RGB15:
67 break;
68 case B_RGB24:
70 break;
71 default:
72 qWarning("Cannot convert color space %d to image format", colorSpace);
73 Q_ASSERT(false);
74 break;
75 }
76
77 return format;
78}
79
Format
The following image formats are available in Qt.
Definition qimage.h:41
@ Format_RGB888
Definition qimage.h:55
@ Format_RGB32
Definition qimage.h:46
@ Format_Invalid
Definition qimage.h:42
@ Format_MonoLSB
Definition qimage.h:44
@ Format_RGB555
Definition qimage.h:53
@ Format_Indexed8
Definition qimage.h:45
@ Format_RGB16
Definition qimage.h:49
@ Format_ARGB32
Definition qimage.h:47
color_space imageFormatToColorSpace(QImage::Format format)
QImage::Format colorSpaceToImageFormat(color_space colorSpace)
#define qWarning
Definition qlogging.h:166
GLint GLsizei GLsizei GLenum format
#define Q_ASSERT(cond)
Definition qrandom.cpp:47