color.dart 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. //
  2. // Spine Runtimes License Agreement
  3. // Last updated April 5, 2025. Replaces all prior versions.
  4. //
  5. // Copyright (c) 2013-2025, Esoteric Software LLC
  6. //
  7. // Integration of the Spine Runtimes into software or otherwise creating
  8. // derivative works of the Spine Runtimes is permitted under the terms and
  9. // conditions of Section 2 of the Spine Editor License Agreement:
  10. // http://esotericsoftware.com/spine-editor-license
  11. //
  12. // Otherwise, it is permitted to integrate the Spine Runtimes into software
  13. // or otherwise create derivative works of the Spine Runtimes (collectively,
  14. // "Products"), provided that each user of the Products must obtain their own
  15. // Spine Editor license and redistribution of the Products in any form must
  16. // include this license and copyright notice.
  17. //
  18. // THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
  19. // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. // DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
  22. // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23. // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
  24. // BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
  25. // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  27. // THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. //
  29. // AUTO GENERATED FILE, DO NOT EDIT.
  30. import 'dart:ffi';
  31. import 'package:ffi/ffi.dart';
  32. import 'spine_dart_bindings_generated.dart';
  33. import '../spine_bindings.dart';
  34. /// Color wrapper
  35. class Color {
  36. final Pointer<spine_color_wrapper> _ptr;
  37. Color.fromPointer(this._ptr);
  38. /// Get the native pointer for FFI calls
  39. Pointer get nativePtr => _ptr;
  40. factory Color() {
  41. final ptr = SpineBindings.bindings.spine_color_create();
  42. return Color.fromPointer(ptr);
  43. }
  44. factory Color.fromRGBA(double r, double g, double b, double a) {
  45. final ptr = SpineBindings.bindings.spine_color_create2(r, g, b, a);
  46. return Color.fromPointer(ptr);
  47. }
  48. void dispose() {
  49. SpineBindings.bindings.spine_color_dispose(_ptr);
  50. }
  51. Color clamp() {
  52. final result = SpineBindings.bindings.spine_color_clamp(_ptr);
  53. return Color.fromPointer(result);
  54. }
  55. static double parseHex(String value, int index) {
  56. final result = SpineBindings.bindings.spine_color_parse_hex(value.toNativeUtf8().cast<Char>(), index);
  57. return result;
  58. }
  59. void rgba8888ToColor(int value) {
  60. SpineBindings.bindings.spine_color_rgba8888_to_color(_ptr, value);
  61. }
  62. void rgb888ToColor(int value) {
  63. SpineBindings.bindings.spine_color_rgb888_to_color(_ptr, value);
  64. }
  65. double get r {
  66. final result = SpineBindings.bindings.spine_color_get_r(_ptr);
  67. return result;
  68. }
  69. set r(double value) {
  70. SpineBindings.bindings.spine_color_set_r(_ptr, value);
  71. }
  72. double get g {
  73. final result = SpineBindings.bindings.spine_color_get_g(_ptr);
  74. return result;
  75. }
  76. set g(double value) {
  77. SpineBindings.bindings.spine_color_set_g(_ptr, value);
  78. }
  79. double get b {
  80. final result = SpineBindings.bindings.spine_color_get_b(_ptr);
  81. return result;
  82. }
  83. set b(double value) {
  84. SpineBindings.bindings.spine_color_set_b(_ptr, value);
  85. }
  86. double get a {
  87. final result = SpineBindings.bindings.spine_color_get_a(_ptr);
  88. return result;
  89. }
  90. set a(double value) {
  91. SpineBindings.bindings.spine_color_set_a(_ptr, value);
  92. }
  93. Color set(double r, double g, double b, double a) {
  94. final result = SpineBindings.bindings.spine_color_set_1(_ptr, r, g, b, a);
  95. return Color.fromPointer(result);
  96. }
  97. Color set2(double r, double g, double b) {
  98. final result = SpineBindings.bindings.spine_color_set_2(_ptr, r, g, b);
  99. return Color.fromPointer(result);
  100. }
  101. Color set3(Color other) {
  102. final result = SpineBindings.bindings.spine_color_set_3(_ptr, other.nativePtr.cast());
  103. return Color.fromPointer(result);
  104. }
  105. Color add(double r, double g, double b, double a) {
  106. final result = SpineBindings.bindings.spine_color_add_1(_ptr, r, g, b, a);
  107. return Color.fromPointer(result);
  108. }
  109. Color add2(double r, double g, double b) {
  110. final result = SpineBindings.bindings.spine_color_add_2(_ptr, r, g, b);
  111. return Color.fromPointer(result);
  112. }
  113. Color add3(Color other) {
  114. final result = SpineBindings.bindings.spine_color_add_3(_ptr, other.nativePtr.cast());
  115. return Color.fromPointer(result);
  116. }
  117. }