-
Notifications
You must be signed in to change notification settings - Fork 51
/
Color.g.cs
512 lines (481 loc) · 18 KB
/
Color.g.cs
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
/*
* Copyright 2021 Google LLC All Rights Reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file or at
* https://developers.google.com/open-source/licenses/bsd
*/
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/type/color.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021, 8981
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Type {
/// <summary>Holder for reflection information generated from google/type/color.proto</summary>
public static partial class ColorReflection {
#region Descriptor
/// <summary>File descriptor for google/type/color.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static ColorReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Chdnb29nbGUvdHlwZS9jb2xvci5wcm90bxILZ29vZ2xlLnR5cGUaHmdvb2ds",
"ZS9wcm90b2J1Zi93cmFwcGVycy5wcm90byJdCgVDb2xvchILCgNyZWQYASAB",
"KAISDQoFZ3JlZW4YAiABKAISDAoEYmx1ZRgDIAEoAhIqCgVhbHBoYRgEIAEo",
"CzIbLmdvb2dsZS5wcm90b2J1Zi5GbG9hdFZhbHVlQmAKD2NvbS5nb29nbGUu",
"dHlwZUIKQ29sb3JQcm90b1ABWjZnb29nbGUuZ29sYW5nLm9yZy9nZW5wcm90",
"by9nb29nbGVhcGlzL3R5cGUvY29sb3I7Y29sb3L4AQGiAgNHVFBiBnByb3Rv",
"Mw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Type.Color), global::Google.Type.Color.Parser, new[]{ "Red", "Green", "Blue", "Alpha" }, null, null, null, null)
}));
}
#endregion
}
#region Messages
/// <summary>
/// Represents a color in the RGBA color space. This representation is designed
/// for simplicity of conversion to/from color representations in various
/// languages over compactness. For example, the fields of this representation
/// can be trivially provided to the constructor of `java.awt.Color` in Java; it
/// can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha`
/// method in iOS; and, with just a little work, it can be easily formatted into
/// a CSS `rgba()` string in JavaScript.
///
/// This reference page doesn't carry information about the absolute color
/// space
/// that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB,
/// DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color
/// space.
///
/// When color equality needs to be decided, implementations, unless
/// documented otherwise, treat two colors as equal if all their red,
/// green, blue, and alpha values each differ by at most 1e-5.
///
/// Example (Java):
///
/// import com.google.type.Color;
///
/// // ...
/// public static java.awt.Color fromProto(Color protocolor) {
/// float alpha = protocolor.hasAlpha()
/// ? protocolor.getAlpha().getValue()
/// : 1.0;
///
/// return new java.awt.Color(
/// protocolor.getRed(),
/// protocolor.getGreen(),
/// protocolor.getBlue(),
/// alpha);
/// }
///
/// public static Color toProto(java.awt.Color color) {
/// float red = (float) color.getRed();
/// float green = (float) color.getGreen();
/// float blue = (float) color.getBlue();
/// float denominator = 255.0;
/// Color.Builder resultBuilder =
/// Color
/// .newBuilder()
/// .setRed(red / denominator)
/// .setGreen(green / denominator)
/// .setBlue(blue / denominator);
/// int alpha = color.getAlpha();
/// if (alpha != 255) {
/// result.setAlpha(
/// FloatValue
/// .newBuilder()
/// .setValue(((float) alpha) / denominator)
/// .build());
/// }
/// return resultBuilder.build();
/// }
/// // ...
///
/// Example (iOS / Obj-C):
///
/// // ...
/// static UIColor* fromProto(Color* protocolor) {
/// float red = [protocolor red];
/// float green = [protocolor green];
/// float blue = [protocolor blue];
/// FloatValue* alpha_wrapper = [protocolor alpha];
/// float alpha = 1.0;
/// if (alpha_wrapper != nil) {
/// alpha = [alpha_wrapper value];
/// }
/// return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
/// }
///
/// static Color* toProto(UIColor* color) {
/// CGFloat red, green, blue, alpha;
/// if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
/// return nil;
/// }
/// Color* result = [[Color alloc] init];
/// [result setRed:red];
/// [result setGreen:green];
/// [result setBlue:blue];
/// if (alpha <= 0.9999) {
/// [result setAlpha:floatWrapperWithValue(alpha)];
/// }
/// [result autorelease];
/// return result;
/// }
/// // ...
///
/// Example (JavaScript):
///
/// // ...
///
/// var protoToCssColor = function(rgb_color) {
/// var redFrac = rgb_color.red || 0.0;
/// var greenFrac = rgb_color.green || 0.0;
/// var blueFrac = rgb_color.blue || 0.0;
/// var red = Math.floor(redFrac * 255);
/// var green = Math.floor(greenFrac * 255);
/// var blue = Math.floor(blueFrac * 255);
///
/// if (!('alpha' in rgb_color)) {
/// return rgbToCssColor(red, green, blue);
/// }
///
/// var alphaFrac = rgb_color.alpha.value || 0.0;
/// var rgbParams = [red, green, blue].join(',');
/// return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
/// };
///
/// var rgbToCssColor = function(red, green, blue) {
/// var rgbNumber = new Number((red << 16) | (green << 8) | blue);
/// var hexString = rgbNumber.toString(16);
/// var missingZeros = 6 - hexString.length;
/// var resultBuilder = ['#'];
/// for (var i = 0; i < missingZeros; i++) {
/// resultBuilder.push('0');
/// }
/// resultBuilder.push(hexString);
/// return resultBuilder.join('');
/// };
///
/// // ...
/// </summary>
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class Color : pb::IMessage<Color>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Color> _parser = new pb::MessageParser<Color>(() => new Color());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<Color> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Type.ColorReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Color() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Color(Color other) : this() {
red_ = other.red_;
green_ = other.green_;
blue_ = other.blue_;
Alpha = other.Alpha;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Color Clone() {
return new Color(this);
}
/// <summary>Field number for the "red" field.</summary>
public const int RedFieldNumber = 1;
private float red_;
/// <summary>
/// The amount of red in the color as a value in the interval [0, 1].
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public float Red {
get { return red_; }
set {
red_ = value;
}
}
/// <summary>Field number for the "green" field.</summary>
public const int GreenFieldNumber = 2;
private float green_;
/// <summary>
/// The amount of green in the color as a value in the interval [0, 1].
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public float Green {
get { return green_; }
set {
green_ = value;
}
}
/// <summary>Field number for the "blue" field.</summary>
public const int BlueFieldNumber = 3;
private float blue_;
/// <summary>
/// The amount of blue in the color as a value in the interval [0, 1].
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public float Blue {
get { return blue_; }
set {
blue_ = value;
}
}
/// <summary>Field number for the "alpha" field.</summary>
public const int AlphaFieldNumber = 4;
private static readonly pb::FieldCodec<float?> _single_alpha_codec = pb::FieldCodec.ForStructWrapper<float>(34);
private float? alpha_;
/// <summary>
/// The fraction of this color that should be applied to the pixel. That is,
/// the final pixel color is defined by the equation:
///
/// `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)`
///
/// This means that a value of 1.0 corresponds to a solid color, whereas
/// a value of 0.0 corresponds to a completely transparent color. This
/// uses a wrapper message rather than a simple float scalar so that it is
/// possible to distinguish between a default value and the value being unset.
/// If omitted, this color object is rendered as a solid color
/// (as if the alpha value had been explicitly given a value of 1.0).
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public float? Alpha {
get { return alpha_; }
set {
alpha_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as Color);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(Color other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Red, other.Red)) return false;
if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Green, other.Green)) return false;
if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Blue, other.Blue)) return false;
if (!pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.Equals(Alpha, other.Alpha)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Red != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Red);
if (Green != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Green);
if (Blue != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Blue);
if (alpha_ != null) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.GetHashCode(Alpha);
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Red != 0F) {
output.WriteRawTag(13);
output.WriteFloat(Red);
}
if (Green != 0F) {
output.WriteRawTag(21);
output.WriteFloat(Green);
}
if (Blue != 0F) {
output.WriteRawTag(29);
output.WriteFloat(Blue);
}
if (alpha_ != null) {
_single_alpha_codec.WriteTagAndValue(output, Alpha);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Red != 0F) {
output.WriteRawTag(13);
output.WriteFloat(Red);
}
if (Green != 0F) {
output.WriteRawTag(21);
output.WriteFloat(Green);
}
if (Blue != 0F) {
output.WriteRawTag(29);
output.WriteFloat(Blue);
}
if (alpha_ != null) {
_single_alpha_codec.WriteTagAndValue(ref output, Alpha);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Red != 0F) {
size += 1 + 4;
}
if (Green != 0F) {
size += 1 + 4;
}
if (Blue != 0F) {
size += 1 + 4;
}
if (alpha_ != null) {
size += _single_alpha_codec.CalculateSizeWithTag(Alpha);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(Color other) {
if (other == null) {
return;
}
if (other.Red != 0F) {
Red = other.Red;
}
if (other.Green != 0F) {
Green = other.Green;
}
if (other.Blue != 0F) {
Blue = other.Blue;
}
if (other.alpha_ != null) {
if (alpha_ == null || other.Alpha != 0F) {
Alpha = other.Alpha;
}
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 13: {
Red = input.ReadFloat();
break;
}
case 21: {
Green = input.ReadFloat();
break;
}
case 29: {
Blue = input.ReadFloat();
break;
}
case 34: {
float? value = _single_alpha_codec.Read(input);
if (alpha_ == null || value != 0F) {
Alpha = value;
}
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 13: {
Red = input.ReadFloat();
break;
}
case 21: {
Green = input.ReadFloat();
break;
}
case 29: {
Blue = input.ReadFloat();
break;
}
case 34: {
float? value = _single_alpha_codec.Read(ref input);
if (alpha_ == null || value != 0F) {
Alpha = value;
}
break;
}
}
}
}
#endif
}
#endregion
}
#endregion Designer generated code