/
model_hsl_effect.go
207 lines (185 loc) · 5.12 KB
/
model_hsl_effect.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/*
* --------------------------------------------------------------------------------------------------------------------
* <copyright company="Aspose">
* Copyright (c) 2018 Aspose.Slides for Cloud
* </copyright>
* <summary>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* </summary>
* --------------------------------------------------------------------------------------------------------------------
*/
package asposeslidescloud
import (
"encoding/json"
)
// Represents a Hue/Saturation/Luminance effect.
type IHslEffect interface {
// Image transform effect type
GetType() string
SetType(newValue string)
// Hue
GetHue() float64
SetHue(newValue float64)
// Saturation
GetSaturation() float64
SetSaturation(newValue float64)
// Luminance
GetLuminance() float64
SetLuminance(newValue float64)
}
type HslEffect struct {
// Image transform effect type
Type_ string `json:"Type"`
// Hue
Hue float64 `json:"Hue"`
// Saturation
Saturation float64 `json:"Saturation"`
// Luminance
Luminance float64 `json:"Luminance"`
}
func NewHslEffect() *HslEffect {
instance := new(HslEffect)
instance.Type_ = "Hsl"
return instance
}
func (this *HslEffect) GetType() string {
return this.Type_
}
func (this *HslEffect) SetType(newValue string) {
this.Type_ = newValue
}
func (this *HslEffect) GetHue() float64 {
return this.Hue
}
func (this *HslEffect) SetHue(newValue float64) {
this.Hue = newValue
}
func (this *HslEffect) GetSaturation() float64 {
return this.Saturation
}
func (this *HslEffect) SetSaturation(newValue float64) {
this.Saturation = newValue
}
func (this *HslEffect) GetLuminance() float64 {
return this.Luminance
}
func (this *HslEffect) SetLuminance(newValue float64) {
this.Luminance = newValue
}
func (this *HslEffect) UnmarshalJSON(b []byte) error {
var objMap map[string]*json.RawMessage
err := json.Unmarshal(b, &objMap)
if err != nil {
return err
}
this.Type_ = "Hsl"
if valType, ok := objMap["type"]; ok {
if valType != nil {
var valueForType string
err = json.Unmarshal(*valType, &valueForType)
if err != nil {
var valueForTypeInt int32
err = json.Unmarshal(*valType, &valueForTypeInt)
if err != nil {
return err
}
this.Type_ = string(valueForTypeInt)
} else {
this.Type_ = valueForType
}
}
}
if valTypeCap, ok := objMap["Type"]; ok {
if valTypeCap != nil {
var valueForType string
err = json.Unmarshal(*valTypeCap, &valueForType)
if err != nil {
var valueForTypeInt int32
err = json.Unmarshal(*valTypeCap, &valueForTypeInt)
if err != nil {
return err
}
this.Type_ = string(valueForTypeInt)
} else {
this.Type_ = valueForType
}
}
}
if valHue, ok := objMap["hue"]; ok {
if valHue != nil {
var valueForHue float64
err = json.Unmarshal(*valHue, &valueForHue)
if err != nil {
return err
}
this.Hue = valueForHue
}
}
if valHueCap, ok := objMap["Hue"]; ok {
if valHueCap != nil {
var valueForHue float64
err = json.Unmarshal(*valHueCap, &valueForHue)
if err != nil {
return err
}
this.Hue = valueForHue
}
}
if valSaturation, ok := objMap["saturation"]; ok {
if valSaturation != nil {
var valueForSaturation float64
err = json.Unmarshal(*valSaturation, &valueForSaturation)
if err != nil {
return err
}
this.Saturation = valueForSaturation
}
}
if valSaturationCap, ok := objMap["Saturation"]; ok {
if valSaturationCap != nil {
var valueForSaturation float64
err = json.Unmarshal(*valSaturationCap, &valueForSaturation)
if err != nil {
return err
}
this.Saturation = valueForSaturation
}
}
if valLuminance, ok := objMap["luminance"]; ok {
if valLuminance != nil {
var valueForLuminance float64
err = json.Unmarshal(*valLuminance, &valueForLuminance)
if err != nil {
return err
}
this.Luminance = valueForLuminance
}
}
if valLuminanceCap, ok := objMap["Luminance"]; ok {
if valLuminanceCap != nil {
var valueForLuminance float64
err = json.Unmarshal(*valLuminanceCap, &valueForLuminance)
if err != nil {
return err
}
this.Luminance = valueForLuminance
}
}
return nil
}