Source: proto/spine/ui/color_pb.js

  1. // source: spine/ui/color.proto
  2. /**
  3. * @fileoverview
  4. * @enhanceable
  5. * @suppress {messageConventions} JS Compiler reports an error if a variable or
  6. * field starts with 'MSG_' and isn't a translatable message.
  7. * @public
  8. */
  9. // GENERATED CODE -- DO NOT EDIT!
  10. var jspb = require('google-protobuf');
  11. var goog = jspb;
  12. var global = Function('return this')();
  13. var spine_options_pb = require('../../spine/options_pb.js');
  14. goog.object.extend(proto, spine_options_pb);
  15. var google_protobuf_wrappers_pb = require('../../google/protobuf/wrappers_pb.js');
  16. goog.object.extend(proto, google_protobuf_wrappers_pb);
  17. goog.exportSymbol('proto.spine.ui.Color', null, global);
  18. /**
  19. * Generated by JsPbCodeGenerator.
  20. * @param {Array=} opt_data Optional initial data array, typically from a
  21. * server response, or constructed directly in Javascript. The array is used
  22. * in place and becomes part of the constructed object. It is not cloned.
  23. * If no data is provided, the constructed object will be empty, but still
  24. * valid.
  25. * @extends {jspb.Message}
  26. * @constructor
  27. */
  28. proto.spine.ui.Color = function(opt_data) {
  29. jspb.Message.initialize(this, opt_data, 0, -1, null, null);
  30. };
  31. goog.inherits(proto.spine.ui.Color, jspb.Message);
  32. if (goog.DEBUG && !COMPILED) {
  33. /**
  34. * @public
  35. * @override
  36. */
  37. proto.spine.ui.Color.displayName = 'proto.spine.ui.Color';
  38. }
  39. if (jspb.Message.GENERATE_TO_OBJECT) {
  40. /**
  41. * Creates an object representation of this proto.
  42. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  43. * Optional fields that are not set will be set to undefined.
  44. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  45. * For the list of reserved names please see:
  46. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
  47. * @param {boolean=} opt_includeInstance Deprecated. whether to include the
  48. * JSPB instance for transitional soy proto support:
  49. * http://goto/soy-param-migration
  50. * @return {!Object}
  51. */
  52. proto.spine.ui.Color.prototype.toObject = function(opt_includeInstance) {
  53. return proto.spine.ui.Color.toObject(opt_includeInstance, this);
  54. };
  55. /**
  56. * Static version of the {@see toObject} method.
  57. * @param {boolean|undefined} includeInstance Deprecated. Whether to include
  58. * the JSPB instance for transitional soy proto support:
  59. * http://goto/soy-param-migration
  60. * @param {!proto.spine.ui.Color} msg The msg instance to transform.
  61. * @return {!Object}
  62. * @suppress {unusedLocalVariables} f is only used for nested messages
  63. */
  64. proto.spine.ui.Color.toObject = function(includeInstance, msg) {
  65. var f, obj = {
  66. red: jspb.Message.getFloatingPointFieldWithDefault(msg, 1, 0.0),
  67. green: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0),
  68. blue: jspb.Message.getFloatingPointFieldWithDefault(msg, 3, 0.0),
  69. alpha: (f = msg.getAlpha()) && google_protobuf_wrappers_pb.FloatValue.toObject(includeInstance, f)
  70. };
  71. if (includeInstance) {
  72. obj.$jspbMessageInstance = msg;
  73. }
  74. return obj;
  75. };
  76. }
  77. /**
  78. * Deserializes binary data (in protobuf wire format).
  79. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  80. * @return {!proto.spine.ui.Color}
  81. */
  82. proto.spine.ui.Color.deserializeBinary = function(bytes) {
  83. var reader = new jspb.BinaryReader(bytes);
  84. var msg = new proto.spine.ui.Color;
  85. return proto.spine.ui.Color.deserializeBinaryFromReader(msg, reader);
  86. };
  87. /**
  88. * Deserializes binary data (in protobuf wire format) from the
  89. * given reader into the given message object.
  90. * @param {!proto.spine.ui.Color} msg The message object to deserialize into.
  91. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  92. * @return {!proto.spine.ui.Color}
  93. */
  94. proto.spine.ui.Color.deserializeBinaryFromReader = function(msg, reader) {
  95. while (reader.nextField()) {
  96. if (reader.isEndGroup()) {
  97. break;
  98. }
  99. var field = reader.getFieldNumber();
  100. switch (field) {
  101. case 1:
  102. var value = /** @type {number} */ (reader.readFloat());
  103. msg.setRed(value);
  104. break;
  105. case 2:
  106. var value = /** @type {number} */ (reader.readFloat());
  107. msg.setGreen(value);
  108. break;
  109. case 3:
  110. var value = /** @type {number} */ (reader.readFloat());
  111. msg.setBlue(value);
  112. break;
  113. case 4:
  114. var value = new google_protobuf_wrappers_pb.FloatValue;
  115. reader.readMessage(value,google_protobuf_wrappers_pb.FloatValue.deserializeBinaryFromReader);
  116. msg.setAlpha(value);
  117. break;
  118. default:
  119. reader.skipField();
  120. break;
  121. }
  122. }
  123. return msg;
  124. };
  125. /**
  126. * Serializes the message to binary data (in protobuf wire format).
  127. * @return {!Uint8Array}
  128. */
  129. proto.spine.ui.Color.prototype.serializeBinary = function() {
  130. var writer = new jspb.BinaryWriter();
  131. proto.spine.ui.Color.serializeBinaryToWriter(this, writer);
  132. return writer.getResultBuffer();
  133. };
  134. /**
  135. * Serializes the given message to binary data (in protobuf wire
  136. * format), writing to the given BinaryWriter.
  137. * @param {!proto.spine.ui.Color} message
  138. * @param {!jspb.BinaryWriter} writer
  139. * @suppress {unusedLocalVariables} f is only used for nested messages
  140. */
  141. proto.spine.ui.Color.serializeBinaryToWriter = function(message, writer) {
  142. var f = undefined;
  143. f = message.getRed();
  144. if (f !== 0.0) {
  145. writer.writeFloat(
  146. 1,
  147. f
  148. );
  149. }
  150. f = message.getGreen();
  151. if (f !== 0.0) {
  152. writer.writeFloat(
  153. 2,
  154. f
  155. );
  156. }
  157. f = message.getBlue();
  158. if (f !== 0.0) {
  159. writer.writeFloat(
  160. 3,
  161. f
  162. );
  163. }
  164. f = message.getAlpha();
  165. if (f != null) {
  166. writer.writeMessage(
  167. 4,
  168. f,
  169. google_protobuf_wrappers_pb.FloatValue.serializeBinaryToWriter
  170. );
  171. }
  172. };
  173. /**
  174. * optional float red = 1;
  175. * @return {number}
  176. */
  177. proto.spine.ui.Color.prototype.getRed = function() {
  178. return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0));
  179. };
  180. /**
  181. * @param {number} value
  182. * @return {!proto.spine.ui.Color} returns this
  183. */
  184. proto.spine.ui.Color.prototype.setRed = function(value) {
  185. return jspb.Message.setProto3FloatField(this, 1, value);
  186. };
  187. /**
  188. * optional float green = 2;
  189. * @return {number}
  190. */
  191. proto.spine.ui.Color.prototype.getGreen = function() {
  192. return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0));
  193. };
  194. /**
  195. * @param {number} value
  196. * @return {!proto.spine.ui.Color} returns this
  197. */
  198. proto.spine.ui.Color.prototype.setGreen = function(value) {
  199. return jspb.Message.setProto3FloatField(this, 2, value);
  200. };
  201. /**
  202. * optional float blue = 3;
  203. * @return {number}
  204. */
  205. proto.spine.ui.Color.prototype.getBlue = function() {
  206. return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 3, 0.0));
  207. };
  208. /**
  209. * @param {number} value
  210. * @return {!proto.spine.ui.Color} returns this
  211. */
  212. proto.spine.ui.Color.prototype.setBlue = function(value) {
  213. return jspb.Message.setProto3FloatField(this, 3, value);
  214. };
  215. /**
  216. * optional google.protobuf.FloatValue alpha = 4;
  217. * @return {?proto.google.protobuf.FloatValue}
  218. */
  219. proto.spine.ui.Color.prototype.getAlpha = function() {
  220. return /** @type{?proto.google.protobuf.FloatValue} */ (
  221. jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.FloatValue, 4));
  222. };
  223. /**
  224. * @param {?proto.google.protobuf.FloatValue|undefined} value
  225. * @return {!proto.spine.ui.Color} returns this
  226. */
  227. proto.spine.ui.Color.prototype.setAlpha = function(value) {
  228. return jspb.Message.setWrapperField(this, 4, value);
  229. };
  230. /**
  231. * Clears the message field making it undefined.
  232. * @return {!proto.spine.ui.Color} returns this
  233. */
  234. proto.spine.ui.Color.prototype.clearAlpha = function() {
  235. return this.setAlpha(undefined);
  236. };
  237. /**
  238. * Returns whether this field is set.
  239. * @return {boolean}
  240. */
  241. proto.spine.ui.Color.prototype.hasAlpha = function() {
  242. return jspb.Message.getField(this, 4) != null;
  243. };
  244. goog.object.extend(exports, proto.spine.ui);
  245. // Generated by Spine ProtoJs Plugin
  246. let ObjectParser = require('../../../client/parser/object-parser.js').default;
  247. let TypeParsers = require('../../../client/parser/type-parsers.js').default;
  248. proto.spine.ui.Color.Parser = function() {
  249. ObjectParser.call(this);
  250. };
  251. proto.spine.ui.Color.Parser.prototype = Object.create(ObjectParser.prototype);
  252. proto.spine.ui.Color.Parser.prototype.constructor = proto.spine.ui.Color.Parser;
  253. proto.spine.ui.Color.Parser.prototype.fromObject = function(obj) {
  254. if (obj === null) {
  255. return null;
  256. }
  257. let msg = new proto.spine.ui.Color();
  258. if (obj.red !== undefined) {
  259. if (obj.red !== null) {
  260. let value = parseFloat(obj.red);
  261. msg.setRed(value);
  262. }
  263. }
  264. if (obj.green !== undefined) {
  265. if (obj.green !== null) {
  266. let value = parseFloat(obj.green);
  267. msg.setGreen(value);
  268. }
  269. }
  270. if (obj.blue !== undefined) {
  271. if (obj.blue !== null) {
  272. let value = parseFloat(obj.blue);
  273. msg.setBlue(value);
  274. }
  275. }
  276. if (obj.alpha !== undefined) {
  277. if (obj.alpha === null) {
  278. msg.setAlpha(null);
  279. } else {
  280. let value = TypeParsers.parserFor('type.googleapis.com/google.protobuf.FloatValue').fromObject(obj.alpha);
  281. msg.setAlpha(value);
  282. }
  283. }
  284. return msg;
  285. };
  286. // Generated by Spine ProtoJs Plugin
  287. proto.spine.ui.Color.typeUrl = function() {
  288. return 'type.spine.io/spine.ui.Color';
  289. };