aspose_words_cloud 21.9.0 → 21.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,356 +0,0 @@
1
- # ------------------------------------------------------------------------------------
2
- # <copyright company="Aspose" file="graphics_quality_options_data.rb">
3
- # Copyright (c) 2021 Aspose.Words for Cloud
4
- # </copyright>
5
- # <summary>
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in all
14
- # copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- # SOFTWARE.
23
- # </summary>
24
- # ------------------------------------------------------------------------------------
25
-
26
- require 'date'
27
-
28
- module AsposeWordsCloud
29
-
30
- # Allows to specify additional System.Drawing.Graphics quality options.
31
- class GraphicsQualityOptionsData
32
- # Gets or sets the value, that specifies how composited images are drawn to this Graphics.
33
- attr_accessor :compositing_mode
34
-
35
- # Gets or sets the rendering quality of composited images drawn to this Graphics.
36
- attr_accessor :compositing_quality
37
-
38
- # Gets or sets the interpolation mode associated with this Graphics.
39
- attr_accessor :interpolation_mode
40
-
41
- # Gets or sets the rendering quality for this Graphics.
42
- attr_accessor :smoothing_mode
43
-
44
- # Gets or sets text layout information (such as alignment, orientation and tab stops) display manipulations (such as ellipsis insertion and national digit substitution) and OpenType features.
45
- attr_accessor :string_format
46
-
47
- # Gets or sets the rendering mode for text associated with this Graphics.
48
- attr_accessor :text_rendering_hint
49
-
50
- class EnumAttributeValidator
51
- attr_reader :datatype
52
- attr_reader :allowable_values
53
-
54
- def initialize(datatype, allowable_values)
55
- @allowable_values = allowable_values.map do |value|
56
- case datatype.to_s
57
- when /Integer/i
58
- value.to_i
59
- when /Float/i
60
- value.to_f
61
- else
62
- value
63
- end
64
- end
65
- end
66
-
67
- def valid?(value)
68
- !value || allowable_values.include?(value)
69
- end
70
- end
71
-
72
- # Attribute mapping from ruby-style variable name to JSON key.
73
- def self.attribute_map
74
- {
75
- :'compositing_mode' => :'CompositingMode',
76
- :'compositing_quality' => :'CompositingQuality',
77
- :'interpolation_mode' => :'InterpolationMode',
78
- :'smoothing_mode' => :'SmoothingMode',
79
- :'string_format' => :'StringFormat',
80
- :'text_rendering_hint' => :'TextRenderingHint'
81
- }
82
- end
83
-
84
- # Attribute type mapping.
85
- def self.swagger_types
86
- {
87
- :'compositing_mode' => :'String',
88
- :'compositing_quality' => :'String',
89
- :'interpolation_mode' => :'String',
90
- :'smoothing_mode' => :'String',
91
- :'string_format' => :'StringFormatData',
92
- :'text_rendering_hint' => :'String'
93
- }
94
- end
95
-
96
- # Initializes the object
97
- # @param [Hash] attributes Model attributes in the form of hash
98
- def initialize(attributes = {})
99
- return unless attributes.is_a?(Hash)
100
-
101
- # convert string to symbol for hash key
102
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
103
-
104
- if attributes.key?(:'CompositingMode')
105
- self.compositing_mode = attributes[:'CompositingMode']
106
- end
107
-
108
- if attributes.key?(:'CompositingQuality')
109
- self.compositing_quality = attributes[:'CompositingQuality']
110
- end
111
-
112
- if attributes.key?(:'InterpolationMode')
113
- self.interpolation_mode = attributes[:'InterpolationMode']
114
- end
115
-
116
- if attributes.key?(:'SmoothingMode')
117
- self.smoothing_mode = attributes[:'SmoothingMode']
118
- end
119
-
120
- if attributes.key?(:'StringFormat')
121
- self.string_format = attributes[:'StringFormat']
122
- end
123
-
124
- if attributes.key?(:'TextRenderingHint')
125
- self.text_rendering_hint = attributes[:'TextRenderingHint']
126
- end
127
- end
128
-
129
- # Show invalid properties with the reasons. Usually used together with valid?
130
- # @return Array for valid properies with the reasons
131
- def list_invalid_properties
132
- invalid_properties = []
133
- return invalid_properties
134
- end
135
-
136
- # Check to see if the all the properties in the model are valid
137
- # @return true if the model is valid
138
- def valid?
139
- compositing_mode_validator = EnumAttributeValidator.new('String', ["SourceOver", "SourceCopy"])
140
- return false unless compositing_mode_validator.valid?(@compositing_mode)
141
- compositing_quality_validator = EnumAttributeValidator.new('String', ["Default", "HighSpeed", "HighQuality", "GammaCorrected", "AssumeLinear", "Invalid"])
142
- return false unless compositing_quality_validator.valid?(@compositing_quality)
143
- interpolation_mode_validator = EnumAttributeValidator.new('String', ["Default", "Low", "High", "Bilinear", "Bicubic", "NearestNeighbor", "HighQualityBilinear", "HighQualityBicubic", "Invalid"])
144
- return false unless interpolation_mode_validator.valid?(@interpolation_mode)
145
- smoothing_mode_validator = EnumAttributeValidator.new('String', ["Default", "HighSpeed", "HighQuality", "None", "AntiAlias", "Invalid"])
146
- return false unless smoothing_mode_validator.valid?(@smoothing_mode)
147
- text_rendering_hint_validator = EnumAttributeValidator.new('String', ["SystemDefault", "SingleBitPerPixelGridFit", "SingleBitPerPixel", "AntiAliasGridFit", "AntiAlias", "ClearTypeGridFit"])
148
- return false unless text_rendering_hint_validator.valid?(@text_rendering_hint)
149
-
150
- return true
151
- end
152
-
153
- # Custom attribute writer method checking allowed values (enum).
154
- # @param [Object] compositing_mode Object to be assigned
155
- def compositing_mode=(compositing_mode)
156
- validator = EnumAttributeValidator.new('String', ["SourceOver", "SourceCopy"])
157
- if compositing_mode.to_i == 0
158
- unless validator.valid?(compositing_mode)
159
- raise ArgumentError, "invalid value for 'compositing_mode', must be one of #{validator.allowable_values}."
160
- end
161
- @compositing_mode = compositing_mode
162
- else
163
- @compositing_mode = validator.allowable_values[compositing_mode.to_i]
164
- end
165
- end
166
-
167
- # Custom attribute writer method checking allowed values (enum).
168
- # @param [Object] compositing_quality Object to be assigned
169
- def compositing_quality=(compositing_quality)
170
- validator = EnumAttributeValidator.new('String', ["Default", "HighSpeed", "HighQuality", "GammaCorrected", "AssumeLinear", "Invalid"])
171
- if compositing_quality.to_i == 0
172
- unless validator.valid?(compositing_quality)
173
- raise ArgumentError, "invalid value for 'compositing_quality', must be one of #{validator.allowable_values}."
174
- end
175
- @compositing_quality = compositing_quality
176
- else
177
- @compositing_quality = validator.allowable_values[compositing_quality.to_i]
178
- end
179
- end
180
-
181
- # Custom attribute writer method checking allowed values (enum).
182
- # @param [Object] interpolation_mode Object to be assigned
183
- def interpolation_mode=(interpolation_mode)
184
- validator = EnumAttributeValidator.new('String', ["Default", "Low", "High", "Bilinear", "Bicubic", "NearestNeighbor", "HighQualityBilinear", "HighQualityBicubic", "Invalid"])
185
- if interpolation_mode.to_i == 0
186
- unless validator.valid?(interpolation_mode)
187
- raise ArgumentError, "invalid value for 'interpolation_mode', must be one of #{validator.allowable_values}."
188
- end
189
- @interpolation_mode = interpolation_mode
190
- else
191
- @interpolation_mode = validator.allowable_values[interpolation_mode.to_i]
192
- end
193
- end
194
-
195
- # Custom attribute writer method checking allowed values (enum).
196
- # @param [Object] smoothing_mode Object to be assigned
197
- def smoothing_mode=(smoothing_mode)
198
- validator = EnumAttributeValidator.new('String', ["Default", "HighSpeed", "HighQuality", "None", "AntiAlias", "Invalid"])
199
- if smoothing_mode.to_i == 0
200
- unless validator.valid?(smoothing_mode)
201
- raise ArgumentError, "invalid value for 'smoothing_mode', must be one of #{validator.allowable_values}."
202
- end
203
- @smoothing_mode = smoothing_mode
204
- else
205
- @smoothing_mode = validator.allowable_values[smoothing_mode.to_i]
206
- end
207
- end
208
-
209
- # Custom attribute writer method checking allowed values (enum).
210
- # @param [Object] text_rendering_hint Object to be assigned
211
- def text_rendering_hint=(text_rendering_hint)
212
- validator = EnumAttributeValidator.new('String', ["SystemDefault", "SingleBitPerPixelGridFit", "SingleBitPerPixel", "AntiAliasGridFit", "AntiAlias", "ClearTypeGridFit"])
213
- if text_rendering_hint.to_i == 0
214
- unless validator.valid?(text_rendering_hint)
215
- raise ArgumentError, "invalid value for 'text_rendering_hint', must be one of #{validator.allowable_values}."
216
- end
217
- @text_rendering_hint = text_rendering_hint
218
- else
219
- @text_rendering_hint = validator.allowable_values[text_rendering_hint.to_i]
220
- end
221
- end
222
-
223
-
224
- # Checks equality by comparing each attribute.
225
- # @param [Object] Object to be compared
226
- def ==(other)
227
- return true if self.equal?(other)
228
- self.class == other.class &&
229
- compositing_mode == other.compositing_mode &&
230
- compositing_quality == other.compositing_quality &&
231
- interpolation_mode == other.interpolation_mode &&
232
- smoothing_mode == other.smoothing_mode &&
233
- string_format == other.string_format &&
234
- text_rendering_hint == other.text_rendering_hint
235
- end
236
-
237
- # @see the `==` method
238
- # @param [Object] Object to be compared
239
- def eql?(other)
240
- self == other
241
- end
242
-
243
- # Calculates hash code according to all attributes.
244
- # @return [Fixnum] Hash code
245
- def hash
246
- [compositing_mode, compositing_quality, interpolation_mode, smoothing_mode, string_format, text_rendering_hint].hash
247
- end
248
-
249
- # Builds the object from hash
250
- # @param [Hash] attributes Model attributes in the form of hash
251
- # @return [Object] Returns the model itself
252
- def build_from_hash(attributes)
253
- return nil unless attributes.is_a?(Hash)
254
- self.class.swagger_types.each_pair do |key, type|
255
- if type =~ /\AArray<(.*)>/i
256
- # check to ensure the input is an array given that the the attribute
257
- # is documented as an array but the input is not
258
- if attributes[self.class.attribute_map[key]].is_a?(Array)
259
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
260
- end
261
- elsif !attributes[self.class.attribute_map[key]].nil?
262
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
263
- end
264
- # or else data not found in attributes(hash), not an issue as the data can be optional
265
- end
266
-
267
- self
268
- end
269
-
270
- # Deserializes the data based on type
271
- # @param string type Data type
272
- # @param string value Value to be deserialized
273
- # @return [Object] Deserialized data
274
- def _deserialize(type, value)
275
- case type.to_sym
276
- when :DateTime
277
- Time.at(/\d/.match(value)[0].to_f).to_datetime
278
- when :Date
279
- Time.at(/\d/.match(value)[0].to_f).to_date
280
- when :String
281
- value.to_s
282
- when :Integer
283
- value.to_i
284
- when :Float
285
- value.to_f
286
- when :BOOLEAN
287
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
288
- true
289
- else
290
- false
291
- end
292
- when :Object
293
- # generic object (usually a Hash), return directly
294
- value
295
- when /\AArray<(?<inner_type>.+)>\z/
296
- inner_type = Regexp.last_match[:inner_type]
297
- value.map { |v| _deserialize(inner_type, v) }
298
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
299
- k_type = Regexp.last_match[:k_type]
300
- v_type = Regexp.last_match[:v_type]
301
- {}.tap do |hash|
302
- value.each do |k, v|
303
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
304
- end
305
- end
306
- else
307
- # model
308
- temp_model = AsposeWordsCloud.const_get(type).new
309
- temp_model.build_from_hash(value)
310
- end
311
- end
312
-
313
- # Returns the string representation of the object
314
- # @return [String] String presentation of the object
315
- def to_s
316
- to_hash.to_s
317
- end
318
-
319
- # to_body is an alias to to_hash (backward compatibility)
320
- # @return [Hash] Returns the object in the form of hash
321
- def to_body
322
- to_hash
323
- end
324
-
325
- # Returns the object in the form of hash
326
- # @return [Hash] Returns the object in the form of hash
327
- def to_hash
328
- hash = {}
329
- self.class.attribute_map.each_pair do |attr, param|
330
- value = self.send(attr)
331
- next if value.nil?
332
- hash[param] = _to_hash(value)
333
- end
334
- hash
335
- end
336
-
337
- # Outputs non-array value in the form of hash
338
- # For object, use to_hash. Otherwise, just return the value
339
- # @param [Object] value Any valid value
340
- # @return [Hash] Returns the value in the form of hash
341
- def _to_hash(value)
342
- if value.is_a?(Array)
343
- value.compact.map { |v| _to_hash(v) }
344
- elsif value.is_a?(Hash)
345
- {}.tap do |hash|
346
- value.each { |k, v| hash[k] = _to_hash(v) }
347
- end
348
- elsif value.respond_to? :to_hash
349
- value.to_hash
350
- else
351
- value
352
- end
353
- end
354
-
355
- end
356
- end