LibreOffice Module drawinglayer (master) 1
materialattribute3d.cxx
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
22
23
25{
27 {
28 public:
29 // materialAttribute3D definitions
30 basegfx::BColor maColor; // object color
31 basegfx::BColor maSpecular; // material specular color
32 basegfx::BColor maEmission; // material emissive color
33 sal_uInt16 mnSpecularIntensity; // material specular intensity [0..128]
34
35 ImpMaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity)
36 : maColor(rColor),
37 maSpecular(rSpecular),
38 maEmission(rEmission),
39 mnSpecularIntensity(nSpecularIntensity)
40 {
41 }
42
44 : maColor(rColor),
45 maSpecular(1.0, 1.0, 1.0),
47 {
48 }
49
52 {
53 }
54
55 // data read access
56 const basegfx::BColor& getColor() const { return maColor; }
57 const basegfx::BColor& getSpecular() const { return maSpecular; }
58 const basegfx::BColor& getEmission() const { return maEmission; }
59 sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; }
60
61 bool operator==(const ImpMaterialAttribute3D& rCandidate) const
62 {
63 return (getColor() == rCandidate.getColor()
64 && getSpecular() == rCandidate.getSpecular()
65 && getEmission() == rCandidate.getEmission()
66 && getSpecularIntensity() == rCandidate.getSpecularIntensity());
67 }
68 };
69
70 namespace
71 {
72 MaterialAttribute3D::ImplType& theGlobalDefault()
73 {
74 static MaterialAttribute3D::ImplType SINGLETON;
75 return SINGLETON;
76 }
77 }
78
80 const basegfx::BColor& rColor,
81 const basegfx::BColor& rSpecular,
82 const basegfx::BColor& rEmission,
83 sal_uInt16 nSpecularIntensity)
84 : mpMaterialAttribute3D(ImpMaterialAttribute3D(
85 rColor, rSpecular, rEmission, nSpecularIntensity))
86 {
87 }
88
90 const basegfx::BColor& rColor)
91 : mpMaterialAttribute3D(ImpMaterialAttribute3D(rColor))
92 {
93 }
94
96 : mpMaterialAttribute3D(theGlobalDefault())
97 {
98 }
99
101
103
105
107 {
108 return rCandidate.mpMaterialAttribute3D == mpMaterialAttribute3D;
109 }
110
112 {
113 return mpMaterialAttribute3D->getColor();
114 }
115
117 {
118 return mpMaterialAttribute3D->getSpecular();
119 }
120
122 {
123 return mpMaterialAttribute3D->getEmission();
124 }
125
127 {
128 return mpMaterialAttribute3D->getSpecularIntensity();
129 }
130
131} // end of namespace
132
133/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ImpMaterialAttribute3D(const basegfx::BColor &rColor, const basegfx::BColor &rSpecular, const basegfx::BColor &rEmission, sal_uInt16 nSpecularIntensity)
ImpMaterialAttribute3D(const basegfx::BColor &rColor)
bool operator==(const ImpMaterialAttribute3D &rCandidate) const
MaterialAttribute3D & operator=(const MaterialAttribute3D &)
o3tl::cow_wrapper< ImpMaterialAttribute3D, o3tl::ThreadSafeRefCountingPolicy > ImplType
bool operator==(const MaterialAttribute3D &rCandidate) const