diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-10-30 18:23:11 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-11-06 12:05:31 +0100 |
commit | ea6d73b55bac6eea8a1b11c1dd3e0c86ce2752b9 (patch) | |
tree | a17e56ba1bccddda464428abfc480791a8ab7f1d /vcl/unx/kf5/Kf5Tools.hxx | |
parent | 19ff1dd4a93409517186065ab5b0e200a05d5fa3 (diff) |
KF5 add initial SalBitmap implementation
Change-Id: I1f7b1894272096a0f0b23b63c3eeae310fb28c6f
Diffstat (limited to 'vcl/unx/kf5/Kf5Tools.hxx')
-rw-r--r-- | vcl/unx/kf5/Kf5Tools.hxx | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/vcl/unx/kf5/Kf5Tools.hxx b/vcl/unx/kf5/Kf5Tools.hxx index d5ba80bc0898..40c34d9d4303 100644 --- a/vcl/unx/kf5/Kf5Tools.hxx +++ b/vcl/unx/kf5/Kf5Tools.hxx @@ -20,8 +20,12 @@ #pragma once #include <QtCore/QString> +#include <QtCore/QRect> +#include <QtCore/QSize> +#include <QtGui/QImage> #include <rtl/string.hxx> +#include <tools/gen.hxx> inline OUString toOUString(const QString& s) { @@ -35,4 +39,51 @@ inline QString toQString(const OUString& s) reinterpret_cast<ushort const *>(s.getStr()), s.getLength()); } +inline QRect toQRect( const tools::Rectangle& rRect ) +{ + return QRect( rRect.Left(), rRect.Top(), + rRect.GetWidth(), rRect.GetHeight() ); +} + +inline QSize toQSize( const Size& rSize ) +{ + return QSize( rSize.Width(), rSize.Height() ); +} + +inline Size toSize( const QSize& rSize ) +{ + return Size( rSize.width(), rSize.height() ); +} + +inline QImage::Format getBitFormat( sal_uInt16 nBitCount ) +{ + switch ( nBitCount ) + { + case 1 : return QImage::Format_Mono; + case 8 : return QImage::Format_Indexed8; + case 16 : return QImage::Format_RGB16; + case 24 : return QImage::Format_RGB888; + case 32 : return QImage::Format_ARGB32; + default : + std::abort(); + break; + } + return QImage::Format_Invalid; +} + +inline sal_uInt16 getFormatBits( QImage::Format eFormat ) +{ + switch ( eFormat ) + { + case QImage::Format_Mono : return 1; + case QImage::Format_Indexed8 : return 8; + case QImage::Format_RGB16 : return 16; + case QImage::Format_RGB888 : return 24; + case QImage::Format_ARGB32 : return 32; + default : + std::abort(); + return 0; + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |