google-cloud-document_ai-v1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +201 -0
- data/README.md +139 -0
- data/lib/google-cloud-document_ai-v1.rb +21 -0
- data/lib/google/cloud/document_ai/v1.rb +38 -0
- data/lib/google/cloud/document_ai/v1/document_processor_service.rb +53 -0
- data/lib/google/cloud/document_ai/v1/document_processor_service/client.rb +581 -0
- data/lib/google/cloud/document_ai/v1/document_processor_service/credentials.rb +51 -0
- data/lib/google/cloud/document_ai/v1/document_processor_service/operations.rb +655 -0
- data/lib/google/cloud/document_ai/v1/document_processor_service/paths.rb +71 -0
- data/lib/google/cloud/document_ai/v1/version.rb +28 -0
- data/lib/google/cloud/documentai/v1/document_io_pb.rb +54 -0
- data/lib/google/cloud/documentai/v1/document_pb.rb +298 -0
- data/lib/google/cloud/documentai/v1/document_processor_service_pb.rb +107 -0
- data/lib/google/cloud/documentai/v1/document_processor_service_services_pb.rb +54 -0
- data/lib/google/cloud/documentai/v1/geometry_pb.rb +34 -0
- data/lib/google/cloud/documentai/v1/operation_metadata_pb.rb +36 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +65 -0
- data/proto_docs/google/api/resource.rb +283 -0
- data/proto_docs/google/cloud/documentai/v1/document.rb +791 -0
- data/proto_docs/google/cloud/documentai/v1/document_io.rb +100 -0
- data/proto_docs/google/cloud/documentai/v1/document_processor_service.rb +221 -0
- data/proto_docs/google/cloud/documentai/v1/geometry.rb +65 -0
- data/proto_docs/google/cloud/documentai/v1/operation_metadata.rb +65 -0
- data/proto_docs/google/longrunning/operations.rb +164 -0
- data/proto_docs/google/protobuf/any.rb +141 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +129 -0
- data/proto_docs/google/protobuf/wrappers.rb +121 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- data/proto_docs/google/type/color.rb +173 -0
- data/proto_docs/google/type/date.rb +53 -0
- data/proto_docs/google/type/datetime.rb +99 -0
- data/proto_docs/google/type/money.rb +43 -0
- data/proto_docs/google/type/postal_address.rb +135 -0
- metadata +231 -0
@@ -0,0 +1,129 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Protobuf
|
22
|
+
# A Timestamp represents a point in time independent of any time zone or local
|
23
|
+
# calendar, encoded as a count of seconds and fractions of seconds at
|
24
|
+
# nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
25
|
+
# January 1, 1970, in the proleptic Gregorian calendar which extends the
|
26
|
+
# Gregorian calendar backwards to year one.
|
27
|
+
#
|
28
|
+
# All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
29
|
+
# second table is needed for interpretation, using a [24-hour linear
|
30
|
+
# smear](https://developers.google.com/time/smear).
|
31
|
+
#
|
32
|
+
# The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
33
|
+
# restricting to that range, we ensure that we can convert to and from [RFC
|
34
|
+
# 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
35
|
+
#
|
36
|
+
# # Examples
|
37
|
+
#
|
38
|
+
# Example 1: Compute Timestamp from POSIX `time()`.
|
39
|
+
#
|
40
|
+
# Timestamp timestamp;
|
41
|
+
# timestamp.set_seconds(time(NULL));
|
42
|
+
# timestamp.set_nanos(0);
|
43
|
+
#
|
44
|
+
# Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
45
|
+
#
|
46
|
+
# struct timeval tv;
|
47
|
+
# gettimeofday(&tv, NULL);
|
48
|
+
#
|
49
|
+
# Timestamp timestamp;
|
50
|
+
# timestamp.set_seconds(tv.tv_sec);
|
51
|
+
# timestamp.set_nanos(tv.tv_usec * 1000);
|
52
|
+
#
|
53
|
+
# Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
54
|
+
#
|
55
|
+
# FILETIME ft;
|
56
|
+
# GetSystemTimeAsFileTime(&ft);
|
57
|
+
# UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
58
|
+
#
|
59
|
+
# // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
60
|
+
# // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
61
|
+
# Timestamp timestamp;
|
62
|
+
# timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
63
|
+
# timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
64
|
+
#
|
65
|
+
# Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
66
|
+
#
|
67
|
+
# long millis = System.currentTimeMillis();
|
68
|
+
#
|
69
|
+
# Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
70
|
+
# .setNanos((int) ((millis % 1000) * 1000000)).build();
|
71
|
+
#
|
72
|
+
#
|
73
|
+
# Example 5: Compute Timestamp from Java `Instant.now()`.
|
74
|
+
#
|
75
|
+
# Instant now = Instant.now();
|
76
|
+
#
|
77
|
+
# Timestamp timestamp =
|
78
|
+
# Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
79
|
+
# .setNanos(now.getNano()).build();
|
80
|
+
#
|
81
|
+
#
|
82
|
+
# Example 6: Compute Timestamp from current time in Python.
|
83
|
+
#
|
84
|
+
# timestamp = Timestamp()
|
85
|
+
# timestamp.GetCurrentTime()
|
86
|
+
#
|
87
|
+
# # JSON Mapping
|
88
|
+
#
|
89
|
+
# In JSON format, the Timestamp type is encoded as a string in the
|
90
|
+
# [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
91
|
+
# format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
|
92
|
+
# where \\{year} is always expressed using four digits while \\{month}, \\{day},
|
93
|
+
# \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
|
94
|
+
# seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
95
|
+
# are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
96
|
+
# is required. A proto3 JSON serializer should always use UTC (as indicated by
|
97
|
+
# "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
98
|
+
# able to accept both UTC and other timezones (as indicated by an offset).
|
99
|
+
#
|
100
|
+
# For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
101
|
+
# 01:30 UTC on January 15, 2017.
|
102
|
+
#
|
103
|
+
# In JavaScript, one can convert a Date object to this format using the
|
104
|
+
# standard
|
105
|
+
# [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
106
|
+
# method. In Python, a standard `datetime.datetime` object can be converted
|
107
|
+
# to this format using
|
108
|
+
# [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
109
|
+
# the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
110
|
+
# the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
111
|
+
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
112
|
+
# ) to obtain a formatter capable of generating timestamps in this format.
|
113
|
+
# @!attribute [rw] seconds
|
114
|
+
# @return [::Integer]
|
115
|
+
# Represents seconds of UTC time since Unix epoch
|
116
|
+
# 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
117
|
+
# 9999-12-31T23:59:59Z inclusive.
|
118
|
+
# @!attribute [rw] nanos
|
119
|
+
# @return [::Integer]
|
120
|
+
# Non-negative fractions of a second at nanosecond resolution. Negative
|
121
|
+
# second values with fractions must still have non-negative nanos values
|
122
|
+
# that count forward in time. Must be from 0 to 999,999,999
|
123
|
+
# inclusive.
|
124
|
+
class Timestamp
|
125
|
+
include ::Google::Protobuf::MessageExts
|
126
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Protobuf
|
22
|
+
# Wrapper message for `double`.
|
23
|
+
#
|
24
|
+
# The JSON representation for `DoubleValue` is JSON number.
|
25
|
+
# @!attribute [rw] value
|
26
|
+
# @return [::Float]
|
27
|
+
# The double value.
|
28
|
+
class DoubleValue
|
29
|
+
include ::Google::Protobuf::MessageExts
|
30
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
31
|
+
end
|
32
|
+
|
33
|
+
# Wrapper message for `float`.
|
34
|
+
#
|
35
|
+
# The JSON representation for `FloatValue` is JSON number.
|
36
|
+
# @!attribute [rw] value
|
37
|
+
# @return [::Float]
|
38
|
+
# The float value.
|
39
|
+
class FloatValue
|
40
|
+
include ::Google::Protobuf::MessageExts
|
41
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
42
|
+
end
|
43
|
+
|
44
|
+
# Wrapper message for `int64`.
|
45
|
+
#
|
46
|
+
# The JSON representation for `Int64Value` is JSON string.
|
47
|
+
# @!attribute [rw] value
|
48
|
+
# @return [::Integer]
|
49
|
+
# The int64 value.
|
50
|
+
class Int64Value
|
51
|
+
include ::Google::Protobuf::MessageExts
|
52
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
53
|
+
end
|
54
|
+
|
55
|
+
# Wrapper message for `uint64`.
|
56
|
+
#
|
57
|
+
# The JSON representation for `UInt64Value` is JSON string.
|
58
|
+
# @!attribute [rw] value
|
59
|
+
# @return [::Integer]
|
60
|
+
# The uint64 value.
|
61
|
+
class UInt64Value
|
62
|
+
include ::Google::Protobuf::MessageExts
|
63
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
64
|
+
end
|
65
|
+
|
66
|
+
# Wrapper message for `int32`.
|
67
|
+
#
|
68
|
+
# The JSON representation for `Int32Value` is JSON number.
|
69
|
+
# @!attribute [rw] value
|
70
|
+
# @return [::Integer]
|
71
|
+
# The int32 value.
|
72
|
+
class Int32Value
|
73
|
+
include ::Google::Protobuf::MessageExts
|
74
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
75
|
+
end
|
76
|
+
|
77
|
+
# Wrapper message for `uint32`.
|
78
|
+
#
|
79
|
+
# The JSON representation for `UInt32Value` is JSON number.
|
80
|
+
# @!attribute [rw] value
|
81
|
+
# @return [::Integer]
|
82
|
+
# The uint32 value.
|
83
|
+
class UInt32Value
|
84
|
+
include ::Google::Protobuf::MessageExts
|
85
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
86
|
+
end
|
87
|
+
|
88
|
+
# Wrapper message for `bool`.
|
89
|
+
#
|
90
|
+
# The JSON representation for `BoolValue` is JSON `true` and `false`.
|
91
|
+
# @!attribute [rw] value
|
92
|
+
# @return [::Boolean]
|
93
|
+
# The bool value.
|
94
|
+
class BoolValue
|
95
|
+
include ::Google::Protobuf::MessageExts
|
96
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
97
|
+
end
|
98
|
+
|
99
|
+
# Wrapper message for `string`.
|
100
|
+
#
|
101
|
+
# The JSON representation for `StringValue` is JSON string.
|
102
|
+
# @!attribute [rw] value
|
103
|
+
# @return [::String]
|
104
|
+
# The string value.
|
105
|
+
class StringValue
|
106
|
+
include ::Google::Protobuf::MessageExts
|
107
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
108
|
+
end
|
109
|
+
|
110
|
+
# Wrapper message for `bytes`.
|
111
|
+
#
|
112
|
+
# The JSON representation for `BytesValue` is JSON string.
|
113
|
+
# @!attribute [rw] value
|
114
|
+
# @return [::String]
|
115
|
+
# The bytes value.
|
116
|
+
class BytesValue
|
117
|
+
include ::Google::Protobuf::MessageExts
|
118
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Rpc
|
22
|
+
# The `Status` type defines a logical error model that is suitable for
|
23
|
+
# different programming environments, including REST APIs and RPC APIs. It is
|
24
|
+
# used by [gRPC](https://github.com/grpc). Each `Status` message contains
|
25
|
+
# three pieces of data: error code, error message, and error details.
|
26
|
+
#
|
27
|
+
# You can find out more about this error model and how to work with it in the
|
28
|
+
# [API Design Guide](https://cloud.google.com/apis/design/errors).
|
29
|
+
# @!attribute [rw] code
|
30
|
+
# @return [::Integer]
|
31
|
+
# The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
|
32
|
+
# @!attribute [rw] message
|
33
|
+
# @return [::String]
|
34
|
+
# A developer-facing error message, which should be in English. Any
|
35
|
+
# user-facing error message should be localized and sent in the
|
36
|
+
# {::Google::Rpc::Status#details google.rpc.Status.details} field, or localized by the client.
|
37
|
+
# @!attribute [rw] details
|
38
|
+
# @return [::Array<::Google::Protobuf::Any>]
|
39
|
+
# A list of messages that carry the error details. There is a common set of
|
40
|
+
# message types for APIs to use.
|
41
|
+
class Status
|
42
|
+
include ::Google::Protobuf::MessageExts
|
43
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Type
|
22
|
+
# Represents a color in the RGBA color space. This representation is designed
|
23
|
+
# for simplicity of conversion to/from color representations in various
|
24
|
+
# languages over compactness. For example, the fields of this representation
|
25
|
+
# can be trivially provided to the constructor of `java.awt.Color` in Java; it
|
26
|
+
# can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha`
|
27
|
+
# method in iOS; and, with just a little work, it can be easily formatted into
|
28
|
+
# a CSS `rgba()` string in JavaScript.
|
29
|
+
#
|
30
|
+
# This reference page doesn't carry information about the absolute color
|
31
|
+
# space
|
32
|
+
# that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB,
|
33
|
+
# DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color
|
34
|
+
# space.
|
35
|
+
#
|
36
|
+
# When color equality needs to be decided, implementations, unless
|
37
|
+
# documented otherwise, treat two colors as equal if all their red,
|
38
|
+
# green, blue, and alpha values each differ by at most 1e-5.
|
39
|
+
#
|
40
|
+
# Example (Java):
|
41
|
+
#
|
42
|
+
# import com.google.type.Color;
|
43
|
+
#
|
44
|
+
# // ...
|
45
|
+
# public static java.awt.Color fromProto(Color protocolor) {
|
46
|
+
# float alpha = protocolor.hasAlpha()
|
47
|
+
# ? protocolor.getAlpha().getValue()
|
48
|
+
# : 1.0;
|
49
|
+
#
|
50
|
+
# return new java.awt.Color(
|
51
|
+
# protocolor.getRed(),
|
52
|
+
# protocolor.getGreen(),
|
53
|
+
# protocolor.getBlue(),
|
54
|
+
# alpha);
|
55
|
+
# }
|
56
|
+
#
|
57
|
+
# public static Color toProto(java.awt.Color color) {
|
58
|
+
# float red = (float) color.getRed();
|
59
|
+
# float green = (float) color.getGreen();
|
60
|
+
# float blue = (float) color.getBlue();
|
61
|
+
# float denominator = 255.0;
|
62
|
+
# Color.Builder resultBuilder =
|
63
|
+
# Color
|
64
|
+
# .newBuilder()
|
65
|
+
# .setRed(red / denominator)
|
66
|
+
# .setGreen(green / denominator)
|
67
|
+
# .setBlue(blue / denominator);
|
68
|
+
# int alpha = color.getAlpha();
|
69
|
+
# if (alpha != 255) {
|
70
|
+
# result.setAlpha(
|
71
|
+
# FloatValue
|
72
|
+
# .newBuilder()
|
73
|
+
# .setValue(((float) alpha) / denominator)
|
74
|
+
# .build());
|
75
|
+
# }
|
76
|
+
# return resultBuilder.build();
|
77
|
+
# }
|
78
|
+
# // ...
|
79
|
+
#
|
80
|
+
# Example (iOS / Obj-C):
|
81
|
+
#
|
82
|
+
# // ...
|
83
|
+
# static UIColor* fromProto(Color* protocolor) {
|
84
|
+
# float red = [protocolor red];
|
85
|
+
# float green = [protocolor green];
|
86
|
+
# float blue = [protocolor blue];
|
87
|
+
# FloatValue* alpha_wrapper = [protocolor alpha];
|
88
|
+
# float alpha = 1.0;
|
89
|
+
# if (alpha_wrapper != nil) {
|
90
|
+
# alpha = [alpha_wrapper value];
|
91
|
+
# }
|
92
|
+
# return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
|
93
|
+
# }
|
94
|
+
#
|
95
|
+
# static Color* toProto(UIColor* color) {
|
96
|
+
# CGFloat red, green, blue, alpha;
|
97
|
+
# if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
|
98
|
+
# return nil;
|
99
|
+
# }
|
100
|
+
# Color* result = [[Color alloc] init];
|
101
|
+
# [result setRed:red];
|
102
|
+
# [result setGreen:green];
|
103
|
+
# [result setBlue:blue];
|
104
|
+
# if (alpha <= 0.9999) {
|
105
|
+
# [result setAlpha:floatWrapperWithValue(alpha)];
|
106
|
+
# }
|
107
|
+
# [result autorelease];
|
108
|
+
# return result;
|
109
|
+
# }
|
110
|
+
# // ...
|
111
|
+
#
|
112
|
+
# Example (JavaScript):
|
113
|
+
#
|
114
|
+
# // ...
|
115
|
+
#
|
116
|
+
# var protoToCssColor = function(rgb_color) {
|
117
|
+
# var redFrac = rgb_color.red || 0.0;
|
118
|
+
# var greenFrac = rgb_color.green || 0.0;
|
119
|
+
# var blueFrac = rgb_color.blue || 0.0;
|
120
|
+
# var red = Math.floor(redFrac * 255);
|
121
|
+
# var green = Math.floor(greenFrac * 255);
|
122
|
+
# var blue = Math.floor(blueFrac * 255);
|
123
|
+
#
|
124
|
+
# if (!('alpha' in rgb_color)) {
|
125
|
+
# return rgbToCssColor(red, green, blue);
|
126
|
+
# }
|
127
|
+
#
|
128
|
+
# var alphaFrac = rgb_color.alpha.value || 0.0;
|
129
|
+
# var rgbParams = [red, green, blue].join(',');
|
130
|
+
# return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
|
131
|
+
# };
|
132
|
+
#
|
133
|
+
# var rgbToCssColor = function(red, green, blue) {
|
134
|
+
# var rgbNumber = new Number((red << 16) | (green << 8) | blue);
|
135
|
+
# var hexString = rgbNumber.toString(16);
|
136
|
+
# var missingZeros = 6 - hexString.length;
|
137
|
+
# var resultBuilder = ['#'];
|
138
|
+
# for (var i = 0; i < missingZeros; i++) {
|
139
|
+
# resultBuilder.push('0');
|
140
|
+
# }
|
141
|
+
# resultBuilder.push(hexString);
|
142
|
+
# return resultBuilder.join('');
|
143
|
+
# };
|
144
|
+
#
|
145
|
+
# // ...
|
146
|
+
# @!attribute [rw] red
|
147
|
+
# @return [::Float]
|
148
|
+
# The amount of red in the color as a value in the interval [0, 1].
|
149
|
+
# @!attribute [rw] green
|
150
|
+
# @return [::Float]
|
151
|
+
# The amount of green in the color as a value in the interval [0, 1].
|
152
|
+
# @!attribute [rw] blue
|
153
|
+
# @return [::Float]
|
154
|
+
# The amount of blue in the color as a value in the interval [0, 1].
|
155
|
+
# @!attribute [rw] alpha
|
156
|
+
# @return [::Google::Protobuf::FloatValue]
|
157
|
+
# The fraction of this color that should be applied to the pixel. That is,
|
158
|
+
# the final pixel color is defined by the equation:
|
159
|
+
#
|
160
|
+
# `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)`
|
161
|
+
#
|
162
|
+
# This means that a value of 1.0 corresponds to a solid color, whereas
|
163
|
+
# a value of 0.0 corresponds to a completely transparent color. This
|
164
|
+
# uses a wrapper message rather than a simple float scalar so that it is
|
165
|
+
# possible to distinguish between a default value and the value being unset.
|
166
|
+
# If omitted, this color object is rendered as a solid color
|
167
|
+
# (as if the alpha value had been explicitly given a value of 1.0).
|
168
|
+
class Color
|
169
|
+
include ::Google::Protobuf::MessageExts
|
170
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|