1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
13 #include <sal/types.h>
18 /** Pixel format of the bitmap in bits per pixel */
19 enum class PixelFormat
28 /** Is it a pixel format that forces creation of a palette */
29 constexpr bool isPalettePixelFormat(PixelFormat ePixelFormat
)
31 assert(ePixelFormat
!= PixelFormat::INVALID
);
32 return sal_uInt16(ePixelFormat
) <= 8;
35 constexpr sal_uInt16
pixelFormatBitCount(PixelFormat ePixelFormat
)
37 return sal_uInt16(ePixelFormat
);
40 constexpr sal_Int64
numberOfColors(PixelFormat ePixelFormat
)
42 return sal_Int64(1) << sal_Int64(ePixelFormat
);
45 constexpr PixelFormat
bitDepthToPixelFormat(sal_uInt16 nBitDepth
)
50 return PixelFormat::N1_BPP
;
55 return PixelFormat::N8_BPP
;
57 return PixelFormat::N24_BPP
;
59 return PixelFormat::N32_BPP
;
63 return PixelFormat::INVALID
;
66 } // end namespace vcl
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */