blend2d-bindings 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/ChangeLog +26 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +41 -0
  5. data/examples/test.rb +46 -0
  6. data/examples/util/setup_blend2d.rb +46 -0
  7. data/lib/blend2d.rb +95 -0
  8. data/lib/blend2d_api.rb +255 -0
  9. data/lib/blend2d_array.rb +319 -0
  10. data/lib/blend2d_bitarray.rb +275 -0
  11. data/lib/blend2d_bitset.rb +311 -0
  12. data/lib/blend2d_context.rb +1613 -0
  13. data/lib/blend2d_filesystem.rb +211 -0
  14. data/lib/blend2d_font.rb +281 -0
  15. data/lib/blend2d_fontdata.rb +209 -0
  16. data/lib/blend2d_fontdefs.rb +552 -0
  17. data/lib/blend2d_fontface.rb +345 -0
  18. data/lib/blend2d_fontfeaturesettings.rb +210 -0
  19. data/lib/blend2d_fontmanager.rb +187 -0
  20. data/lib/blend2d_fontvariationsettings.rb +210 -0
  21. data/lib/blend2d_format.rb +112 -0
  22. data/lib/blend2d_geometry.rb +424 -0
  23. data/lib/blend2d_glyphbuffer.rb +141 -0
  24. data/lib/blend2d_glyphrun.rb +101 -0
  25. data/lib/blend2d_gradient.rb +429 -0
  26. data/lib/blend2d_image.rb +291 -0
  27. data/lib/blend2d_imagecodec.rb +219 -0
  28. data/lib/blend2d_imagedecoder.rb +168 -0
  29. data/lib/blend2d_imageencoder.rb +159 -0
  30. data/lib/blend2d_matrix.rb +132 -0
  31. data/lib/blend2d_object.rb +326 -0
  32. data/lib/blend2d_path.rb +511 -0
  33. data/lib/blend2d_pattern.rb +202 -0
  34. data/lib/blend2d_pixelconverter.rb +109 -0
  35. data/lib/blend2d_random.rb +77 -0
  36. data/lib/blend2d_rgba.rb +95 -0
  37. data/lib/blend2d_runtime.rb +259 -0
  38. data/lib/blend2d_string.rb +245 -0
  39. data/lib/blend2d_var.rb +294 -0
  40. data/lib/libblend2d.aarch64.so +0 -0
  41. data/lib/libblend2d.arm64.dylib +0 -0
  42. data/lib/libblend2d.dll +0 -0
  43. data/lib/libblend2d.x86_64.dylib +0 -0
  44. data/lib/libblend2d.x86_64.so +0 -0
  45. metadata +99 -0
@@ -0,0 +1,311 @@
1
+ # Ruby-Blend2D : Yet another Blend2D wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/blend2d-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+ require_relative 'blend2d_object'
9
+
10
+ module Blend2D
11
+ extend FFI::Library
12
+ # Define/Macro
13
+
14
+
15
+ # Enum
16
+
17
+ BL_BIT_SET_INVALID_INDEX = -1
18
+ BL_BIT_SET_RANGE_MASK = -2147483648
19
+ BL_BIT_SET_SEGMENT_WORD_COUNT = 4
20
+
21
+ # Typedef
22
+
23
+ typedef :int, :BLBitSetConstants
24
+
25
+ # Struct
26
+
27
+ class BLBitSetSegment < FFI::Struct
28
+ layout(
29
+ :_startWord, :uint,
30
+ :_data, [:uint, 4],
31
+ )
32
+ def _startWord = self[:_startWord]
33
+ def _startWord=(v) self[:_startWord] = v end
34
+ def _data = self[:_data]
35
+ def _data=(v) self[:_data] = v end
36
+ def self.create_as(__startWord_, __data_)
37
+ instance = BLBitSetSegment.new
38
+ instance[:_startWord] = __startWord_
39
+ instance[:_data] = __data_
40
+ instance
41
+ end
42
+ end
43
+
44
+ class BLBitSetData < FFI::Struct
45
+ layout(
46
+ :segmentData, :pointer,
47
+ :segmentCount, :uint,
48
+ :ssoSegments, [BLBitSetSegment, 3],
49
+ )
50
+ def segmentData = self[:segmentData]
51
+ def segmentData=(v) self[:segmentData] = v end
52
+ def segmentCount = self[:segmentCount]
53
+ def segmentCount=(v) self[:segmentCount] = v end
54
+ def ssoSegments = self[:ssoSegments]
55
+ def ssoSegments=(v) self[:ssoSegments] = v end
56
+ def self.create_as(_segmentData_, _segmentCount_, _ssoSegments_)
57
+ instance = BLBitSetData.new
58
+ instance[:segmentData] = _segmentData_
59
+ instance[:segmentCount] = _segmentCount_
60
+ instance[:ssoSegments] = _ssoSegments_
61
+ instance
62
+ end
63
+ end
64
+
65
+ class BLBitSetCore < FFI::Struct
66
+ layout(
67
+ :_d, BLObjectDetail,
68
+ )
69
+ def _d = self[:_d]
70
+ def _d=(v) self[:_d] = v end
71
+ def init() = blBitSetInit(self)
72
+ def self.create()
73
+ instance = BLBitSetCore.new
74
+ blBitSetInit(instance)
75
+ instance
76
+ end
77
+ def initMove(other) = blBitSetInitMove(self, other)
78
+ def initWeak(other) = blBitSetInitWeak(self, other)
79
+ def initRange(startBit, endBit) = blBitSetInitRange(self, startBit, endBit)
80
+ def destroy() = blBitSetDestroy(self)
81
+ def reset() = blBitSetReset(self)
82
+ def assignMove(other) = blBitSetAssignMove(self, other)
83
+ def assignWeak(other) = blBitSetAssignWeak(self, other)
84
+ def assignDeep(other) = blBitSetAssignDeep(self, other)
85
+ def assignRange(startBit, endBit) = blBitSetAssignRange(self, startBit, endBit)
86
+ def assignWords(startWord, wordData, wordCount) = blBitSetAssignWords(self, startWord, wordData, wordCount)
87
+ def isEmpty() = blBitSetIsEmpty(self)
88
+ def getData(out) = blBitSetGetData(self, out)
89
+ def getSegmentCount() = blBitSetGetSegmentCount(self)
90
+ def getSegmentCapacity() = blBitSetGetSegmentCapacity(self)
91
+ def getCardinality() = blBitSetGetCardinality(self)
92
+ def getCardinalityInRange(startBit, endBit) = blBitSetGetCardinalityInRange(self, startBit, endBit)
93
+ def hasBit(bitIndex) = blBitSetHasBit(self, bitIndex)
94
+ def hasBitsInRange(startBit, endBit) = blBitSetHasBitsInRange(self, startBit, endBit)
95
+ def subsumes(b) = blBitSetSubsumes(a, b)
96
+ def intersects(b) = blBitSetIntersects(a, b)
97
+ def getRange(startOut, endOut) = blBitSetGetRange(self, startOut, endOut)
98
+ def equals(b) = blBitSetEquals(a, b)
99
+ def compare(b) = blBitSetCompare(a, b)
100
+ def clear() = blBitSetClear(self)
101
+ def shrink() = blBitSetShrink(self)
102
+ def optimize() = blBitSetOptimize(self)
103
+ def chop(startBit, endBit) = blBitSetChop(self, startBit, endBit)
104
+ def addBit(bitIndex) = blBitSetAddBit(self, bitIndex)
105
+ def addRange(rangeStartBit, rangeEndBit) = blBitSetAddRange(self, rangeStartBit, rangeEndBit)
106
+ def addWords(startWord, wordData, wordCount) = blBitSetAddWords(self, startWord, wordData, wordCount)
107
+ def clearBit(bitIndex) = blBitSetClearBit(self, bitIndex)
108
+ def clearRange(rangeStartBit, rangeEndBit) = blBitSetClearRange(self, rangeStartBit, rangeEndBit)
109
+ def builderCommit(builder, newAreaIndex) = blBitSetBuilderCommit(self, builder, newAreaIndex)
110
+ def builderAddRange(builder, startBit, endBit) = blBitSetBuilderAddRange(self, builder, startBit, endBit)
111
+ end
112
+
113
+ class BLBitSetBuilderCore < FFI::Struct
114
+ layout(
115
+ :_areaShift, :uint,
116
+ :_areaIndex, :uint,
117
+ )
118
+ def _areaShift = self[:_areaShift]
119
+ def _areaShift=(v) self[:_areaShift] = v end
120
+ def _areaIndex = self[:_areaIndex]
121
+ def _areaIndex=(v) self[:_areaIndex] = v end
122
+ def commit(builder, newAreaIndex) = blBitSetBuilderCommit(self, builder, newAreaIndex)
123
+ def addRange(builder, startBit, endBit) = blBitSetBuilderAddRange(self, builder, startBit, endBit)
124
+ def self.create_as(__areaShift_, __areaIndex_)
125
+ instance = BLBitSetBuilderCore.new
126
+ instance[:_areaShift] = __areaShift_
127
+ instance[:_areaIndex] = __areaIndex_
128
+ instance
129
+ end
130
+ end
131
+
132
+ class BLBitSetImpl < FFI::Struct
133
+ layout(
134
+ :segmentCount, :uint,
135
+ :segmentCapacity, :uint,
136
+ )
137
+ def segmentCount = self[:segmentCount]
138
+ def segmentCount=(v) self[:segmentCount] = v end
139
+ def segmentCapacity = self[:segmentCapacity]
140
+ def segmentCapacity=(v) self[:segmentCapacity] = v end
141
+ def self.create_as(_segmentCount_, _segmentCapacity_)
142
+ instance = BLBitSetImpl.new
143
+ instance[:segmentCount] = _segmentCount_
144
+ instance[:segmentCapacity] = _segmentCapacity_
145
+ instance
146
+ end
147
+ end
148
+
149
+
150
+ # Function
151
+
152
+ def self.setup_bitset_symbols(output_error = false)
153
+ symbols = [
154
+ :blBitSetInit,
155
+ :blBitSetInitMove,
156
+ :blBitSetInitWeak,
157
+ :blBitSetInitRange,
158
+ :blBitSetDestroy,
159
+ :blBitSetReset,
160
+ :blBitSetAssignMove,
161
+ :blBitSetAssignWeak,
162
+ :blBitSetAssignDeep,
163
+ :blBitSetAssignRange,
164
+ :blBitSetAssignWords,
165
+ :blBitSetIsEmpty,
166
+ :blBitSetGetData,
167
+ :blBitSetGetSegmentCount,
168
+ :blBitSetGetSegmentCapacity,
169
+ :blBitSetGetCardinality,
170
+ :blBitSetGetCardinalityInRange,
171
+ :blBitSetHasBit,
172
+ :blBitSetHasBitsInRange,
173
+ :blBitSetSubsumes,
174
+ :blBitSetIntersects,
175
+ :blBitSetGetRange,
176
+ :blBitSetEquals,
177
+ :blBitSetCompare,
178
+ :blBitSetClear,
179
+ :blBitSetShrink,
180
+ :blBitSetOptimize,
181
+ :blBitSetChop,
182
+ :blBitSetAddBit,
183
+ :blBitSetAddRange,
184
+ :blBitSetAddWords,
185
+ :blBitSetClearBit,
186
+ :blBitSetClearRange,
187
+ :blBitSetBuilderCommit,
188
+ :blBitSetBuilderAddRange,
189
+ ]
190
+ apis = {
191
+ :blBitSetInit => :blBitSetInit,
192
+ :blBitSetInitMove => :blBitSetInitMove,
193
+ :blBitSetInitWeak => :blBitSetInitWeak,
194
+ :blBitSetInitRange => :blBitSetInitRange,
195
+ :blBitSetDestroy => :blBitSetDestroy,
196
+ :blBitSetReset => :blBitSetReset,
197
+ :blBitSetAssignMove => :blBitSetAssignMove,
198
+ :blBitSetAssignWeak => :blBitSetAssignWeak,
199
+ :blBitSetAssignDeep => :blBitSetAssignDeep,
200
+ :blBitSetAssignRange => :blBitSetAssignRange,
201
+ :blBitSetAssignWords => :blBitSetAssignWords,
202
+ :blBitSetIsEmpty => :blBitSetIsEmpty,
203
+ :blBitSetGetData => :blBitSetGetData,
204
+ :blBitSetGetSegmentCount => :blBitSetGetSegmentCount,
205
+ :blBitSetGetSegmentCapacity => :blBitSetGetSegmentCapacity,
206
+ :blBitSetGetCardinality => :blBitSetGetCardinality,
207
+ :blBitSetGetCardinalityInRange => :blBitSetGetCardinalityInRange,
208
+ :blBitSetHasBit => :blBitSetHasBit,
209
+ :blBitSetHasBitsInRange => :blBitSetHasBitsInRange,
210
+ :blBitSetSubsumes => :blBitSetSubsumes,
211
+ :blBitSetIntersects => :blBitSetIntersects,
212
+ :blBitSetGetRange => :blBitSetGetRange,
213
+ :blBitSetEquals => :blBitSetEquals,
214
+ :blBitSetCompare => :blBitSetCompare,
215
+ :blBitSetClear => :blBitSetClear,
216
+ :blBitSetShrink => :blBitSetShrink,
217
+ :blBitSetOptimize => :blBitSetOptimize,
218
+ :blBitSetChop => :blBitSetChop,
219
+ :blBitSetAddBit => :blBitSetAddBit,
220
+ :blBitSetAddRange => :blBitSetAddRange,
221
+ :blBitSetAddWords => :blBitSetAddWords,
222
+ :blBitSetClearBit => :blBitSetClearBit,
223
+ :blBitSetClearRange => :blBitSetClearRange,
224
+ :blBitSetBuilderCommit => :blBitSetBuilderCommit,
225
+ :blBitSetBuilderAddRange => :blBitSetBuilderAddRange,
226
+ }
227
+ args = {
228
+ :blBitSetInit => [:pointer],
229
+ :blBitSetInitMove => [:pointer, :pointer],
230
+ :blBitSetInitWeak => [:pointer, :pointer],
231
+ :blBitSetInitRange => [:pointer, :uint, :uint],
232
+ :blBitSetDestroy => [:pointer],
233
+ :blBitSetReset => [:pointer],
234
+ :blBitSetAssignMove => [:pointer, :pointer],
235
+ :blBitSetAssignWeak => [:pointer, :pointer],
236
+ :blBitSetAssignDeep => [:pointer, :pointer],
237
+ :blBitSetAssignRange => [:pointer, :uint, :uint],
238
+ :blBitSetAssignWords => [:pointer, :uint, :pointer, :uint],
239
+ :blBitSetIsEmpty => [:pointer],
240
+ :blBitSetGetData => [:pointer, :pointer],
241
+ :blBitSetGetSegmentCount => [:pointer],
242
+ :blBitSetGetSegmentCapacity => [:pointer],
243
+ :blBitSetGetCardinality => [:pointer],
244
+ :blBitSetGetCardinalityInRange => [:pointer, :uint, :uint],
245
+ :blBitSetHasBit => [:pointer, :uint],
246
+ :blBitSetHasBitsInRange => [:pointer, :uint, :uint],
247
+ :blBitSetSubsumes => [:pointer, :pointer],
248
+ :blBitSetIntersects => [:pointer, :pointer],
249
+ :blBitSetGetRange => [:pointer, :pointer, :pointer],
250
+ :blBitSetEquals => [:pointer, :pointer],
251
+ :blBitSetCompare => [:pointer, :pointer],
252
+ :blBitSetClear => [:pointer],
253
+ :blBitSetShrink => [:pointer],
254
+ :blBitSetOptimize => [:pointer],
255
+ :blBitSetChop => [:pointer, :uint, :uint],
256
+ :blBitSetAddBit => [:pointer, :uint],
257
+ :blBitSetAddRange => [:pointer, :uint, :uint],
258
+ :blBitSetAddWords => [:pointer, :uint, :pointer, :uint],
259
+ :blBitSetClearBit => [:pointer, :uint],
260
+ :blBitSetClearRange => [:pointer, :uint, :uint],
261
+ :blBitSetBuilderCommit => [:pointer, :pointer, :uint],
262
+ :blBitSetBuilderAddRange => [:pointer, :pointer, :uint, :uint],
263
+ }
264
+ retvals = {
265
+ :blBitSetInit => :uint,
266
+ :blBitSetInitMove => :uint,
267
+ :blBitSetInitWeak => :uint,
268
+ :blBitSetInitRange => :uint,
269
+ :blBitSetDestroy => :uint,
270
+ :blBitSetReset => :uint,
271
+ :blBitSetAssignMove => :uint,
272
+ :blBitSetAssignWeak => :uint,
273
+ :blBitSetAssignDeep => :uint,
274
+ :blBitSetAssignRange => :uint,
275
+ :blBitSetAssignWords => :uint,
276
+ :blBitSetIsEmpty => :bool,
277
+ :blBitSetGetData => :uint,
278
+ :blBitSetGetSegmentCount => :uint,
279
+ :blBitSetGetSegmentCapacity => :uint,
280
+ :blBitSetGetCardinality => :uint,
281
+ :blBitSetGetCardinalityInRange => :uint,
282
+ :blBitSetHasBit => :bool,
283
+ :blBitSetHasBitsInRange => :bool,
284
+ :blBitSetSubsumes => :bool,
285
+ :blBitSetIntersects => :bool,
286
+ :blBitSetGetRange => :bool,
287
+ :blBitSetEquals => :bool,
288
+ :blBitSetCompare => :int,
289
+ :blBitSetClear => :uint,
290
+ :blBitSetShrink => :uint,
291
+ :blBitSetOptimize => :uint,
292
+ :blBitSetChop => :uint,
293
+ :blBitSetAddBit => :uint,
294
+ :blBitSetAddRange => :uint,
295
+ :blBitSetAddWords => :uint,
296
+ :blBitSetClearBit => :uint,
297
+ :blBitSetClearRange => :uint,
298
+ :blBitSetBuilderCommit => :uint,
299
+ :blBitSetBuilderAddRange => :uint,
300
+ }
301
+ symbols.each do |sym|
302
+ begin
303
+ attach_function apis[sym], sym, args[sym], retvals[sym]
304
+ rescue FFI::NotFoundError => error
305
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
306
+ end
307
+ end
308
+ end
309
+
310
+ end
311
+