LibreOffice Module drawinglayer (master) 1
fillgradientattribute.hxx
Go to the documentation of this file.
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
23#include <o3tl/cow_wrapper.hxx>
24#include <com/sun/star/awt/GradientStyle.hpp>
25#include <vector>
26
27namespace basegfx
28{
29class BColorStop;
30class BColor;
31class BColorStops;
32}
33
35{
36class ImpFillGradientAttribute;
37
39{
40public:
42
43private:
45
46public:
47 /* MCGR: Adaptions for MultiColorGradients
48
49 Direct Start/EndCOlor is no longer required, instead the
50 full color gradient is handed over as ColorStops vector.
51 To add the former Start/EndColor in a compatible way, just
52 prepare an instance of basegfx::BColorStops with the
53 StartColor at 0.0 and the EndColor at 1.0.
54
55 A rigid correction/input data will be done by the constructor,
56 including to sort the ColorStops by offset and removing invalid
57 entries (see sortAndCorrect)
58
59 To access e.g. the StartColor, use getColorStops().front(), and
60 getColorStops().back(), accordingly, for EndColor. The existence
61 of at least one entry is guaranteed, so no need to check before
62 accessing using of front()/back() calls. If only one color entry
63 exists, start == end color is assumed, so not really a gradient
64 but (existing) fallbacks to filled polygon can trigger.
65 */
67 FillGradientAttribute(css::awt::GradientStyle eStyle, double fBorder, double fOffsetX,
68 double fOffsetY, double fAngle, const basegfx::BColorStops& rColorStops,
69 sal_uInt16 nSteps = 0);
76
77 // checks if the incarnation is default constructed
78 bool isDefault() const;
79
80 // MCGR: Check if rendering cannot be handled by old vcl stuff
81 // due to various restrictions, based on local parameters. There
82 // may be even more reasons on caller's side, e.g. a
83 // ViewTransformation that uses shear/rotate/mirror (what VCL
84 // cannot do at all)
85 bool cannotBeHandledByVCL() const;
86
87 // compare operator
88 bool operator==(const FillGradientAttribute& rCandidate) const;
89
90 // data read access
91 css::awt::GradientStyle getStyle() const;
92 double getBorder() const;
93 double getOffsetX() const;
94 double getOffsetY() const;
95 double getAngle() const;
96 const basegfx::BColorStops& getColorStops() const;
97 sal_uInt16 getSteps() const;
98};
99
100} // end of namespace drawinglayer::attribute
101
102/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FillGradientAttribute & operator=(FillGradientAttribute &&)
FillGradientAttribute & operator=(const FillGradientAttribute &)
FillGradientAttribute(FillGradientAttribute &&)
FillGradientAttribute(const FillGradientAttribute &)
o3tl::cow_wrapper< ImpFillGradientAttribute > ImplType
#define DRAWINGLAYER_DLLPUBLIC
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)