Line data Source code
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 : #include <drawinglayer/attribute/sdrlightattribute3d.hxx>
21 : #include <basegfx/color/bcolor.hxx>
22 : #include <basegfx/vector/b3dvector.hxx>
23 : #include <rtl/instance.hxx>
24 :
25 :
26 :
27 : namespace drawinglayer
28 : {
29 : namespace attribute
30 : {
31 57 : class ImpSdr3DLightAttribute
32 : {
33 : public:
34 : // 3D light attribute definitions
35 : basegfx::BColor maColor;
36 : basegfx::B3DVector maDirection;
37 :
38 : // bitfield
39 : bool mbSpecular : 1;
40 :
41 19 : ImpSdr3DLightAttribute(
42 : const basegfx::BColor& rColor,
43 : const basegfx::B3DVector& rDirection,
44 : bool bSpecular)
45 : : maColor(rColor),
46 : maDirection(rDirection),
47 19 : mbSpecular(bSpecular)
48 : {
49 19 : }
50 :
51 : // data read access
52 16025 : const basegfx::BColor& getColor() const { return maColor; }
53 18818 : const basegfx::B3DVector& getDirection() const { return maDirection; }
54 16025 : bool getSpecular() const { return mbSpecular; }
55 :
56 6 : bool operator==(const ImpSdr3DLightAttribute& rCandidate) const
57 : {
58 6 : return (getColor() == rCandidate.getColor()
59 6 : && getDirection() == rCandidate.getDirection()
60 12 : && getSpecular() == rCandidate.getSpecular());
61 : }
62 : };
63 :
64 : namespace
65 : {
66 : struct theGlobalDefault :
67 : public rtl::Static< Sdr3DLightAttribute::ImplType, theGlobalDefault > {};
68 : }
69 :
70 19 : Sdr3DLightAttribute::Sdr3DLightAttribute(
71 : const basegfx::BColor& rColor,
72 : const basegfx::B3DVector& rDirection,
73 : bool bSpecular)
74 : : mpSdr3DLightAttribute(ImpSdr3DLightAttribute(
75 19 : rColor, rDirection, bSpecular))
76 : {
77 19 : }
78 :
79 57 : Sdr3DLightAttribute::Sdr3DLightAttribute(const Sdr3DLightAttribute& rCandidate)
80 57 : : mpSdr3DLightAttribute(rCandidate.mpSdr3DLightAttribute)
81 : {
82 57 : }
83 :
84 76 : Sdr3DLightAttribute::~Sdr3DLightAttribute()
85 : {
86 76 : }
87 :
88 0 : Sdr3DLightAttribute& Sdr3DLightAttribute::operator=(const Sdr3DLightAttribute& rCandidate)
89 : {
90 0 : mpSdr3DLightAttribute = rCandidate.mpSdr3DLightAttribute;
91 0 : return *this;
92 : }
93 :
94 6 : bool Sdr3DLightAttribute::operator==(const Sdr3DLightAttribute& rCandidate) const
95 : {
96 6 : return rCandidate.mpSdr3DLightAttribute == mpSdr3DLightAttribute;
97 : }
98 :
99 16013 : const basegfx::BColor& Sdr3DLightAttribute::getColor() const
100 : {
101 16013 : return mpSdr3DLightAttribute->getColor();
102 : }
103 :
104 18806 : const basegfx::B3DVector& Sdr3DLightAttribute::getDirection() const
105 : {
106 18806 : return mpSdr3DLightAttribute->getDirection();
107 : }
108 :
109 16013 : bool Sdr3DLightAttribute::getSpecular() const
110 : {
111 16013 : return mpSdr3DLightAttribute->getSpecular();
112 : }
113 :
114 : } // end of namespace attribute
115 : } // end of namespace drawinglayer
116 :
117 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|