Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/cppcanvas/canvas.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 <sal/types.h>
23
#include <memory>
24
25
namespace basegfx
26
{
27
    class B2DHomMatrix;
28
    class B2DPolyPolygon;
29
}
30
31
namespace com::sun::star::rendering
32
{
33
    class  XCanvas;
34
    struct ViewState;
35
}
36
37
namespace com::sun::star::uno { template <class interface_type> class Reference; }
38
39
/* Definition of BitmapCanvas */
40
41
namespace cppcanvas
42
{
43
    class PolyPolygon;
44
    class Canvas;
45
46
    // forward declaration, since tools::PolyPolygon also references Canvas
47
    typedef std::shared_ptr< PolyPolygon > PolyPolygonSharedPtr;
48
49
    // forward declaration, since cloneCanvas() also references Canvas
50
    typedef std::shared_ptr< Canvas > CanvasSharedPtr;
51
52
    /** Canvas interface
53
     */
54
    class Canvas
55
    {
56
    public:
57
        /** Extra pixel used when canvas anti-aliases.
58
59
            Enlarge the bounding box of drawing primitives by this
60
            amount in both dimensions, and on both sides of the
61
            bounds, to account for extra pixel touched outside the
62
            actual primitive bounding box, when the canvas
63
            performs anti-aliasing.
64
         */
65
        static constexpr auto ANTIALIASING_EXTRA_SIZE=2;
66
67
0
        Canvas() = default;
68
0
        Canvas(Canvas const &) = default;
69
        Canvas(Canvas &&) = default;
70
        Canvas & operator =(Canvas const &) = default;
71
        Canvas & operator =(Canvas &&) = default;
72
73
0
        virtual ~Canvas() {}
74
75
        virtual void                             setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
76
        virtual ::basegfx::B2DHomMatrix          getTransformation() const = 0;
77
78
        virtual void                             setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
79
        virtual void                             setClip() = 0;
80
81
        /** Get current clip
82
83
            @return NULL, if no clip is set, otherwise the current clip poly-polygon
84
         */
85
        virtual ::basegfx::B2DPolyPolygon const* getClip() const = 0;
86
87
        virtual CanvasSharedPtr                  clone() const = 0;
88
        virtual void                             clear() const = 0;
89
90
        // this should be considered private. if RTTI gets enabled
91
        // someday, remove that to a separate interface
92
        virtual css::uno::Reference<
93
            css::rendering::XCanvas >           getUNOCanvas() const = 0;
94
        virtual css::rendering::ViewState       getViewState() const = 0;
95
    };
96
97
}
98
99
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */