atlas_attachment_loader.dart 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. import 'atlas.dart';
  35. import 'atlas_region.dart';
  36. import 'attachment_loader.dart';
  37. import 'bounding_box_attachment.dart';
  38. import 'clipping_attachment.dart';
  39. import 'mesh_attachment.dart';
  40. import 'path_attachment.dart';
  41. import 'point_attachment.dart';
  42. import 'region_attachment.dart';
  43. import 'sequence.dart';
  44. import 'skin.dart';
  45. /// AtlasAttachmentLoader wrapper
  46. class AtlasAttachmentLoader implements AttachmentLoader {
  47. final Pointer<spine_atlas_attachment_loader_wrapper> _ptr;
  48. AtlasAttachmentLoader.fromPointer(this._ptr);
  49. /// Get the native pointer for FFI calls
  50. @override
  51. Pointer get nativePtr => _ptr;
  52. factory AtlasAttachmentLoader(Atlas atlas) {
  53. final ptr = SpineBindings.bindings.spine_atlas_attachment_loader_create(atlas.nativePtr.cast());
  54. return AtlasAttachmentLoader.fromPointer(ptr);
  55. }
  56. void dispose() {
  57. SpineBindings.bindings.spine_atlas_attachment_loader_dispose(_ptr);
  58. }
  59. @override
  60. RegionAttachment? newRegionAttachment(Skin skin, String name, String path, Sequence? sequence) {
  61. final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_region_attachment(
  62. _ptr,
  63. skin.nativePtr.cast(),
  64. name.toNativeUtf8().cast<Char>(),
  65. path.toNativeUtf8().cast<Char>(),
  66. sequence?.nativePtr.cast() ?? Pointer.fromAddress(0));
  67. return result.address == 0 ? null : RegionAttachment.fromPointer(result);
  68. }
  69. @override
  70. MeshAttachment? newMeshAttachment(Skin skin, String name, String path, Sequence? sequence) {
  71. final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_mesh_attachment(
  72. _ptr,
  73. skin.nativePtr.cast(),
  74. name.toNativeUtf8().cast<Char>(),
  75. path.toNativeUtf8().cast<Char>(),
  76. sequence?.nativePtr.cast() ?? Pointer.fromAddress(0));
  77. return result.address == 0 ? null : MeshAttachment.fromPointer(result);
  78. }
  79. @override
  80. BoundingBoxAttachment? newBoundingBoxAttachment(Skin skin, String name) {
  81. final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_bounding_box_attachment(
  82. _ptr, skin.nativePtr.cast(), name.toNativeUtf8().cast<Char>());
  83. return result.address == 0 ? null : BoundingBoxAttachment.fromPointer(result);
  84. }
  85. @override
  86. PathAttachment? newPathAttachment(Skin skin, String name) {
  87. final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_path_attachment(
  88. _ptr, skin.nativePtr.cast(), name.toNativeUtf8().cast<Char>());
  89. return result.address == 0 ? null : PathAttachment.fromPointer(result);
  90. }
  91. @override
  92. PointAttachment? newPointAttachment(Skin skin, String name) {
  93. final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_point_attachment(
  94. _ptr, skin.nativePtr.cast(), name.toNativeUtf8().cast<Char>());
  95. return result.address == 0 ? null : PointAttachment.fromPointer(result);
  96. }
  97. @override
  98. ClippingAttachment? newClippingAttachment(Skin skin, String name) {
  99. final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_clipping_attachment(
  100. _ptr, skin.nativePtr.cast(), name.toNativeUtf8().cast<Char>());
  101. return result.address == 0 ? null : ClippingAttachment.fromPointer(result);
  102. }
  103. AtlasRegion? findRegion(String name) {
  104. final result =
  105. SpineBindings.bindings.spine_atlas_attachment_loader_find_region(_ptr, name.toNativeUtf8().cast<Char>());
  106. return result.address == 0 ? null : AtlasRegion.fromPointer(result);
  107. }
  108. }