Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qhaikubuffer.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 "qhaikubuffer.h"
5
6#include <Bitmap.h>
7#include <Rect.h>
8
10
11QHaikuBuffer::QHaikuBuffer()
12 : m_buffer(nullptr)
13{
14}
15
16QHaikuBuffer::QHaikuBuffer(BBitmap *buffer)
17 : m_buffer(buffer)
18{
19 // wrap buffer in an image
20 m_image = QImage(static_cast<uchar*>(m_buffer->Bits()), m_buffer->Bounds().right, m_buffer->Bounds().bottom, m_buffer->BytesPerRow(), QImage::Format_RGB32);
21}
22
23BBitmap* QHaikuBuffer::nativeBuffer() const
24{
25 return m_buffer;
26}
27
28const QImage *QHaikuBuffer::image() const
29{
30 return (m_buffer != nullptr) ? &m_image : nullptr;
31}
32
33QImage *QHaikuBuffer::image()
34{
35 return (m_buffer != nullptr) ? &m_image : nullptr;
36}
37
38QRect QHaikuBuffer::rect() const
39{
40 return m_image.rect();
41}
42
43QT_END_NAMESPACE