Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/inc/canvasbitmap.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
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/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#pragma once
21
22
#include <cppuhelper/implbase.hxx>
23
#include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp>
24
#include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp>
25
#include <com/sun/star/rendering/XBitmapPalette.hpp>
26
27
#include <vcl/bitmap.hxx>
28
#include <vcl/BitmapReadAccess.hxx>
29
30
namespace vcl::unotools
31
{
32
    class SAL_DLLPUBLIC_RTTI VclCanvasBitmap final :
33
        public cppu::WeakImplHelper< css::rendering::XIntegerReadOnlyBitmap,
34
                                     css::rendering::XBitmapPalette,
35
                                     css::rendering::XIntegerBitmapColorSpace >
36
    {
37
    private:
38
        ::Bitmap                                       m_aBmp;
39
        BitmapScopedInfoAccess                         m_pBmpAcc;
40
        std::optional<BitmapScopedReadAccess>          m_pBmpReadAcc;
41
        css::uno::Sequence<sal_Int8>                   m_aComponentTags;
42
        css::uno::Sequence<sal_Int32>                  m_aComponentBitCounts;
43
        css::rendering::IntegerBitmapLayout            m_aLayout;
44
        sal_Int32                                      m_nBitsPerInputPixel;
45
        sal_Int32                                      m_nBitsPerOutputPixel;
46
        sal_Int32                                      m_nRedIndex;
47
        sal_Int32                                      m_nGreenIndex;
48
        sal_Int32                                      m_nBlueIndex;
49
        sal_Int32                                      m_nAlphaIndex;
50
        sal_Int32                                      m_nIndexIndex;
51
        bool                                           m_bPalette;
52
53
        void setComponentInfo( sal_uInt32 redShift, sal_uInt32 greenShift, sal_uInt32 blueShift );
54
        BitmapScopedReadAccess& getBitmapReadAccess();
55
56
        virtual ~VclCanvasBitmap() override;
57
58
    public:
59
        // XBitmap
60
        VCL_DLLPUBLIC virtual css::geometry::IntegerSize2D SAL_CALL getSize() override;
61
        VCL_DLLPUBLIC virtual sal_Bool SAL_CALL hasAlpha(  ) override;
62
        VCL_DLLPUBLIC virtual css::uno::Reference< css::rendering::XBitmap > SAL_CALL getScaledBitmap( const css::geometry::RealSize2D& newSize, sal_Bool beFast ) override;
63
64
        // XIntegerReadOnlyBitmap
65
        VCL_DLLPUBLIC virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getData( css::rendering::IntegerBitmapLayout& bitmapLayout, const css::geometry::IntegerRectangle2D& rect ) override;
66
        VCL_DLLPUBLIC virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getPixel( css::rendering::IntegerBitmapLayout& bitmapLayout, const css::geometry::IntegerPoint2D& pos ) override;
67
        /// @throws css::uno::RuntimeException
68
        VCL_DLLPUBLIC css::uno::Reference< css::rendering::XBitmapPalette > getPalette(  );
69
        virtual css::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout(  ) override;
70
71
        // XBitmapPalette
72
        virtual sal_Int32 SAL_CALL getNumberOfEntries() override;
73
        virtual sal_Bool SAL_CALL getIndex( css::uno::Sequence< double >& entry, ::sal_Int32 nIndex ) override;
74
        virtual sal_Bool SAL_CALL setIndex( const css::uno::Sequence< double >& color, sal_Bool transparency, ::sal_Int32 nIndex ) override;
75
        virtual css::uno::Reference< css::rendering::XColorSpace > SAL_CALL getColorSpace(  ) override;
76
77
        // XIntegerBitmapColorSpace
78
        virtual ::sal_Int8 SAL_CALL getType(  ) override;
79
        virtual css::uno::Sequence< sal_Int8 > SAL_CALL getComponentTags(  ) override;
80
        virtual ::sal_Int8 SAL_CALL getRenderingIntent(  ) override;
81
        virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getProperties(  ) override;
82
        virtual css::uno::Sequence< double > SAL_CALL convertColorSpace( const css::uno::Sequence< double >& deviceColor, const css::uno::Reference< css::rendering::XColorSpace >& targetColorSpace ) override;
83
        virtual css::uno::Sequence< css::rendering::RGBColor > SAL_CALL convertToRGB( const css::uno::Sequence< double >& deviceColor ) override;
84
        virtual css::uno::Sequence< css::rendering::ARGBColor > SAL_CALL convertToARGB( const css::uno::Sequence< double >& deviceColor ) override;
85
        virtual css::uno::Sequence< css::rendering::ARGBColor > SAL_CALL convertToPARGB( const css::uno::Sequence< double >& deviceColor ) override;
86
        virtual css::uno::Sequence< double > SAL_CALL convertFromRGB( const css::uno::Sequence< css::rendering::RGBColor >& rgbColor ) override;
87
        virtual css::uno::Sequence< double > SAL_CALL convertFromARGB( const css::uno::Sequence< css::rendering::ARGBColor >& rgbColor ) override;
88
        virtual css::uno::Sequence< double > SAL_CALL convertFromPARGB( const css::uno::Sequence< css::rendering::ARGBColor >& rgbColor ) override;
89
        virtual ::sal_Int32 SAL_CALL getBitsPerPixel(  ) override;
90
        virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts(  ) override;
91
        virtual ::sal_Int8 SAL_CALL getEndianness(  ) override;
92
        virtual css::uno::Sequence<double> SAL_CALL convertFromIntegerColorSpace( const css::uno::Sequence< ::sal_Int8 >& deviceColor, const css::uno::Reference< css::rendering::XColorSpace >& targetColorSpace ) override;
93
        virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const css::uno::Sequence< ::sal_Int8 >& deviceColor, const css::uno::Reference< css::rendering::XIntegerBitmapColorSpace >& targetColorSpace ) override;
94
        VCL_DLLPUBLIC virtual css::uno::Sequence< css::rendering::RGBColor > SAL_CALL convertIntegerToRGB( const css::uno::Sequence< ::sal_Int8 >& deviceColor ) override;
95
        VCL_DLLPUBLIC virtual css::uno::Sequence< css::rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const css::uno::Sequence< ::sal_Int8 >& deviceColor ) override;
96
        virtual css::uno::Sequence< css::rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const css::uno::Sequence< ::sal_Int8 >& deviceColor ) override;
97
        VCL_DLLPUBLIC virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const css::uno::Sequence< css::rendering::RGBColor >& rgbColor ) override;
98
        VCL_DLLPUBLIC virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const css::uno::Sequence< css::rendering::ARGBColor >& rgbColor ) override;
99
        virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const css::uno::Sequence< css::rendering::ARGBColor >& rgbColor ) override;
100
101
        /** Create API wrapper for given Bitmap
102
103
            @param rBitmap
104
            Bitmap to wrap. As usual, changes to the original bitmap
105
            are not reflected in this object (copy on write).
106
         */
107
        VCL_DLLPUBLIC  explicit VclCanvasBitmap( const Bitmap& rBitmap );
108
109
        /// Retrieve contained bitmap. Call me with locked Solar mutex!
110
4
        const Bitmap& getBitmap() const { return m_aBmp; }
111
   };
112
113
}
114
115
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */