blend2d-bindings 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/ChangeLog +26 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/examples/test.rb +46 -0
- data/examples/util/setup_blend2d.rb +46 -0
- data/lib/blend2d.rb +95 -0
- data/lib/blend2d_api.rb +255 -0
- data/lib/blend2d_array.rb +319 -0
- data/lib/blend2d_bitarray.rb +275 -0
- data/lib/blend2d_bitset.rb +311 -0
- data/lib/blend2d_context.rb +1613 -0
- data/lib/blend2d_filesystem.rb +211 -0
- data/lib/blend2d_font.rb +281 -0
- data/lib/blend2d_fontdata.rb +209 -0
- data/lib/blend2d_fontdefs.rb +552 -0
- data/lib/blend2d_fontface.rb +345 -0
- data/lib/blend2d_fontfeaturesettings.rb +210 -0
- data/lib/blend2d_fontmanager.rb +187 -0
- data/lib/blend2d_fontvariationsettings.rb +210 -0
- data/lib/blend2d_format.rb +112 -0
- data/lib/blend2d_geometry.rb +424 -0
- data/lib/blend2d_glyphbuffer.rb +141 -0
- data/lib/blend2d_glyphrun.rb +101 -0
- data/lib/blend2d_gradient.rb +429 -0
- data/lib/blend2d_image.rb +291 -0
- data/lib/blend2d_imagecodec.rb +219 -0
- data/lib/blend2d_imagedecoder.rb +168 -0
- data/lib/blend2d_imageencoder.rb +159 -0
- data/lib/blend2d_matrix.rb +132 -0
- data/lib/blend2d_object.rb +326 -0
- data/lib/blend2d_path.rb +511 -0
- data/lib/blend2d_pattern.rb +202 -0
- data/lib/blend2d_pixelconverter.rb +109 -0
- data/lib/blend2d_random.rb +77 -0
- data/lib/blend2d_rgba.rb +95 -0
- data/lib/blend2d_runtime.rb +259 -0
- data/lib/blend2d_string.rb +245 -0
- data/lib/blend2d_var.rb +294 -0
- data/lib/libblend2d.aarch64.so +0 -0
- data/lib/libblend2d.arm64.dylib +0 -0
- data/lib/libblend2d.dll +0 -0
- data/lib/libblend2d.x86_64.dylib +0 -0
- data/lib/libblend2d.x86_64.so +0 -0
- metadata +99 -0
@@ -0,0 +1,424 @@
|
|
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
|
+
|
9
|
+
module Blend2D
|
10
|
+
extend FFI::Library
|
11
|
+
# Define/Macro
|
12
|
+
|
13
|
+
|
14
|
+
# Enum
|
15
|
+
|
16
|
+
BL_GEOMETRY_DIRECTION_NONE = 0
|
17
|
+
BL_GEOMETRY_DIRECTION_CW = 1
|
18
|
+
BL_GEOMETRY_DIRECTION_CCW = 2
|
19
|
+
BL_GEOMETRY_DIRECTION_FORCE_UINT = -1
|
20
|
+
BL_GEOMETRY_TYPE_NONE = 0
|
21
|
+
BL_GEOMETRY_TYPE_BOXI = 1
|
22
|
+
BL_GEOMETRY_TYPE_BOXD = 2
|
23
|
+
BL_GEOMETRY_TYPE_RECTI = 3
|
24
|
+
BL_GEOMETRY_TYPE_RECTD = 4
|
25
|
+
BL_GEOMETRY_TYPE_CIRCLE = 5
|
26
|
+
BL_GEOMETRY_TYPE_ELLIPSE = 6
|
27
|
+
BL_GEOMETRY_TYPE_ROUND_RECT = 7
|
28
|
+
BL_GEOMETRY_TYPE_ARC = 8
|
29
|
+
BL_GEOMETRY_TYPE_CHORD = 9
|
30
|
+
BL_GEOMETRY_TYPE_PIE = 10
|
31
|
+
BL_GEOMETRY_TYPE_LINE = 11
|
32
|
+
BL_GEOMETRY_TYPE_TRIANGLE = 12
|
33
|
+
BL_GEOMETRY_TYPE_POLYLINEI = 13
|
34
|
+
BL_GEOMETRY_TYPE_POLYLINED = 14
|
35
|
+
BL_GEOMETRY_TYPE_POLYGONI = 15
|
36
|
+
BL_GEOMETRY_TYPE_POLYGOND = 16
|
37
|
+
BL_GEOMETRY_TYPE_ARRAY_VIEW_BOXI = 17
|
38
|
+
BL_GEOMETRY_TYPE_ARRAY_VIEW_BOXD = 18
|
39
|
+
BL_GEOMETRY_TYPE_ARRAY_VIEW_RECTI = 19
|
40
|
+
BL_GEOMETRY_TYPE_ARRAY_VIEW_RECTD = 20
|
41
|
+
BL_GEOMETRY_TYPE_PATH = 21
|
42
|
+
BL_GEOMETRY_TYPE_MAX_VALUE = 21
|
43
|
+
BL_GEOMETRY_TYPE_SIMPLE_LAST = 12
|
44
|
+
BL_GEOMETRY_TYPE_FORCE_UINT = -1
|
45
|
+
BL_FILL_RULE_NON_ZERO = 0
|
46
|
+
BL_FILL_RULE_EVEN_ODD = 1
|
47
|
+
BL_FILL_RULE_MAX_VALUE = 1
|
48
|
+
BL_FILL_RULE_FORCE_UINT = -1
|
49
|
+
BL_HIT_TEST_IN = 0
|
50
|
+
BL_HIT_TEST_PART = 1
|
51
|
+
BL_HIT_TEST_OUT = 2
|
52
|
+
BL_HIT_TEST_INVALID = -1
|
53
|
+
BL_HIT_TEST_FORCE_UINT = -1
|
54
|
+
|
55
|
+
# Typedef
|
56
|
+
|
57
|
+
typedef :int, :BLGeometryDirection
|
58
|
+
typedef :int, :BLGeometryType
|
59
|
+
typedef :int, :BLFillRule
|
60
|
+
typedef :int, :BLHitTest
|
61
|
+
|
62
|
+
# Struct
|
63
|
+
|
64
|
+
class BLPointI < FFI::Struct
|
65
|
+
layout(
|
66
|
+
:x, :int,
|
67
|
+
:y, :int,
|
68
|
+
)
|
69
|
+
def x = self[:x]
|
70
|
+
def x=(v) self[:x] = v end
|
71
|
+
def y = self[:y]
|
72
|
+
def y=(v) self[:y] = v end
|
73
|
+
def self.create_as(_x_, _y_)
|
74
|
+
instance = BLPointI.new
|
75
|
+
instance[:x] = _x_
|
76
|
+
instance[:y] = _y_
|
77
|
+
instance
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class BLSizeI < FFI::Struct
|
82
|
+
layout(
|
83
|
+
:w, :int,
|
84
|
+
:h, :int,
|
85
|
+
)
|
86
|
+
def w = self[:w]
|
87
|
+
def w=(v) self[:w] = v end
|
88
|
+
def h = self[:h]
|
89
|
+
def h=(v) self[:h] = v end
|
90
|
+
def self.create_as(_w_, _h_)
|
91
|
+
instance = BLSizeI.new
|
92
|
+
instance[:w] = _w_
|
93
|
+
instance[:h] = _h_
|
94
|
+
instance
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class BLBoxI < FFI::Struct
|
99
|
+
layout(
|
100
|
+
:x0, :int,
|
101
|
+
:y0, :int,
|
102
|
+
:x1, :int,
|
103
|
+
:y1, :int,
|
104
|
+
)
|
105
|
+
def x0 = self[:x0]
|
106
|
+
def x0=(v) self[:x0] = v end
|
107
|
+
def y0 = self[:y0]
|
108
|
+
def y0=(v) self[:y0] = v end
|
109
|
+
def x1 = self[:x1]
|
110
|
+
def x1=(v) self[:x1] = v end
|
111
|
+
def y1 = self[:y1]
|
112
|
+
def y1=(v) self[:y1] = v end
|
113
|
+
def self.create_as(_x0_, _y0_, _x1_, _y1_)
|
114
|
+
instance = BLBoxI.new
|
115
|
+
instance[:x0] = _x0_
|
116
|
+
instance[:y0] = _y0_
|
117
|
+
instance[:x1] = _x1_
|
118
|
+
instance[:y1] = _y1_
|
119
|
+
instance
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
class BLRectI < FFI::Struct
|
124
|
+
layout(
|
125
|
+
:x, :int,
|
126
|
+
:y, :int,
|
127
|
+
:w, :int,
|
128
|
+
:h, :int,
|
129
|
+
)
|
130
|
+
def x = self[:x]
|
131
|
+
def x=(v) self[:x] = v end
|
132
|
+
def y = self[:y]
|
133
|
+
def y=(v) self[:y] = v end
|
134
|
+
def w = self[:w]
|
135
|
+
def w=(v) self[:w] = v end
|
136
|
+
def h = self[:h]
|
137
|
+
def h=(v) self[:h] = v end
|
138
|
+
def self.create_as(_x_, _y_, _w_, _h_)
|
139
|
+
instance = BLRectI.new
|
140
|
+
instance[:x] = _x_
|
141
|
+
instance[:y] = _y_
|
142
|
+
instance[:w] = _w_
|
143
|
+
instance[:h] = _h_
|
144
|
+
instance
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
class BLPoint < FFI::Struct
|
149
|
+
layout(
|
150
|
+
:x, :double,
|
151
|
+
:y, :double,
|
152
|
+
)
|
153
|
+
def x = self[:x]
|
154
|
+
def x=(v) self[:x] = v end
|
155
|
+
def y = self[:y]
|
156
|
+
def y=(v) self[:y] = v end
|
157
|
+
def self.create_as(_x_, _y_)
|
158
|
+
instance = BLPoint.new
|
159
|
+
instance[:x] = _x_
|
160
|
+
instance[:y] = _y_
|
161
|
+
instance
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
class BLSize < FFI::Struct
|
166
|
+
layout(
|
167
|
+
:w, :double,
|
168
|
+
:h, :double,
|
169
|
+
)
|
170
|
+
def w = self[:w]
|
171
|
+
def w=(v) self[:w] = v end
|
172
|
+
def h = self[:h]
|
173
|
+
def h=(v) self[:h] = v end
|
174
|
+
def self.create_as(_w_, _h_)
|
175
|
+
instance = BLSize.new
|
176
|
+
instance[:w] = _w_
|
177
|
+
instance[:h] = _h_
|
178
|
+
instance
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
class BLBox < FFI::Struct
|
183
|
+
layout(
|
184
|
+
:x0, :double,
|
185
|
+
:y0, :double,
|
186
|
+
:x1, :double,
|
187
|
+
:y1, :double,
|
188
|
+
)
|
189
|
+
def x0 = self[:x0]
|
190
|
+
def x0=(v) self[:x0] = v end
|
191
|
+
def y0 = self[:y0]
|
192
|
+
def y0=(v) self[:y0] = v end
|
193
|
+
def x1 = self[:x1]
|
194
|
+
def x1=(v) self[:x1] = v end
|
195
|
+
def y1 = self[:y1]
|
196
|
+
def y1=(v) self[:y1] = v end
|
197
|
+
def self.create_as(_x0_, _y0_, _x1_, _y1_)
|
198
|
+
instance = BLBox.new
|
199
|
+
instance[:x0] = _x0_
|
200
|
+
instance[:y0] = _y0_
|
201
|
+
instance[:x1] = _x1_
|
202
|
+
instance[:y1] = _y1_
|
203
|
+
instance
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
class BLRect < FFI::Struct
|
208
|
+
layout(
|
209
|
+
:x, :double,
|
210
|
+
:y, :double,
|
211
|
+
:w, :double,
|
212
|
+
:h, :double,
|
213
|
+
)
|
214
|
+
def x = self[:x]
|
215
|
+
def x=(v) self[:x] = v end
|
216
|
+
def y = self[:y]
|
217
|
+
def y=(v) self[:y] = v end
|
218
|
+
def w = self[:w]
|
219
|
+
def w=(v) self[:w] = v end
|
220
|
+
def h = self[:h]
|
221
|
+
def h=(v) self[:h] = v end
|
222
|
+
def self.create_as(_x_, _y_, _w_, _h_)
|
223
|
+
instance = BLRect.new
|
224
|
+
instance[:x] = _x_
|
225
|
+
instance[:y] = _y_
|
226
|
+
instance[:w] = _w_
|
227
|
+
instance[:h] = _h_
|
228
|
+
instance
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
class BLLine < FFI::Struct
|
233
|
+
layout(
|
234
|
+
:x0, :double,
|
235
|
+
:y0, :double,
|
236
|
+
:x1, :double,
|
237
|
+
:y1, :double,
|
238
|
+
)
|
239
|
+
def x0 = self[:x0]
|
240
|
+
def x0=(v) self[:x0] = v end
|
241
|
+
def y0 = self[:y0]
|
242
|
+
def y0=(v) self[:y0] = v end
|
243
|
+
def x1 = self[:x1]
|
244
|
+
def x1=(v) self[:x1] = v end
|
245
|
+
def y1 = self[:y1]
|
246
|
+
def y1=(v) self[:y1] = v end
|
247
|
+
def self.create_as(_x0_, _y0_, _x1_, _y1_)
|
248
|
+
instance = BLLine.new
|
249
|
+
instance[:x0] = _x0_
|
250
|
+
instance[:y0] = _y0_
|
251
|
+
instance[:x1] = _x1_
|
252
|
+
instance[:y1] = _y1_
|
253
|
+
instance
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
class BLTriangle < FFI::Struct
|
258
|
+
layout(
|
259
|
+
:x0, :double,
|
260
|
+
:y0, :double,
|
261
|
+
:x1, :double,
|
262
|
+
:y1, :double,
|
263
|
+
:x2, :double,
|
264
|
+
:y2, :double,
|
265
|
+
)
|
266
|
+
def x0 = self[:x0]
|
267
|
+
def x0=(v) self[:x0] = v end
|
268
|
+
def y0 = self[:y0]
|
269
|
+
def y0=(v) self[:y0] = v end
|
270
|
+
def x1 = self[:x1]
|
271
|
+
def x1=(v) self[:x1] = v end
|
272
|
+
def y1 = self[:y1]
|
273
|
+
def y1=(v) self[:y1] = v end
|
274
|
+
def x2 = self[:x2]
|
275
|
+
def x2=(v) self[:x2] = v end
|
276
|
+
def y2 = self[:y2]
|
277
|
+
def y2=(v) self[:y2] = v end
|
278
|
+
def self.create_as(_x0_, _y0_, _x1_, _y1_, _x2_, _y2_)
|
279
|
+
instance = BLTriangle.new
|
280
|
+
instance[:x0] = _x0_
|
281
|
+
instance[:y0] = _y0_
|
282
|
+
instance[:x1] = _x1_
|
283
|
+
instance[:y1] = _y1_
|
284
|
+
instance[:x2] = _x2_
|
285
|
+
instance[:y2] = _y2_
|
286
|
+
instance
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
class BLRoundRect < FFI::Struct
|
291
|
+
layout(
|
292
|
+
:x, :double,
|
293
|
+
:y, :double,
|
294
|
+
:w, :double,
|
295
|
+
:h, :double,
|
296
|
+
:rx, :double,
|
297
|
+
:ry, :double,
|
298
|
+
)
|
299
|
+
def x = self[:x]
|
300
|
+
def x=(v) self[:x] = v end
|
301
|
+
def y = self[:y]
|
302
|
+
def y=(v) self[:y] = v end
|
303
|
+
def w = self[:w]
|
304
|
+
def w=(v) self[:w] = v end
|
305
|
+
def h = self[:h]
|
306
|
+
def h=(v) self[:h] = v end
|
307
|
+
def rx = self[:rx]
|
308
|
+
def rx=(v) self[:rx] = v end
|
309
|
+
def ry = self[:ry]
|
310
|
+
def ry=(v) self[:ry] = v end
|
311
|
+
def self.create_as(_x_, _y_, _w_, _h_, _rx_, _ry_)
|
312
|
+
instance = BLRoundRect.new
|
313
|
+
instance[:x] = _x_
|
314
|
+
instance[:y] = _y_
|
315
|
+
instance[:w] = _w_
|
316
|
+
instance[:h] = _h_
|
317
|
+
instance[:rx] = _rx_
|
318
|
+
instance[:ry] = _ry_
|
319
|
+
instance
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
class BLCircle < FFI::Struct
|
324
|
+
layout(
|
325
|
+
:cx, :double,
|
326
|
+
:cy, :double,
|
327
|
+
:r, :double,
|
328
|
+
)
|
329
|
+
def cx = self[:cx]
|
330
|
+
def cx=(v) self[:cx] = v end
|
331
|
+
def cy = self[:cy]
|
332
|
+
def cy=(v) self[:cy] = v end
|
333
|
+
def r = self[:r]
|
334
|
+
def r=(v) self[:r] = v end
|
335
|
+
def self.create_as(_cx_, _cy_, _r_)
|
336
|
+
instance = BLCircle.new
|
337
|
+
instance[:cx] = _cx_
|
338
|
+
instance[:cy] = _cy_
|
339
|
+
instance[:r] = _r_
|
340
|
+
instance
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
class BLEllipse < FFI::Struct
|
345
|
+
layout(
|
346
|
+
:cx, :double,
|
347
|
+
:cy, :double,
|
348
|
+
:rx, :double,
|
349
|
+
:ry, :double,
|
350
|
+
)
|
351
|
+
def cx = self[:cx]
|
352
|
+
def cx=(v) self[:cx] = v end
|
353
|
+
def cy = self[:cy]
|
354
|
+
def cy=(v) self[:cy] = v end
|
355
|
+
def rx = self[:rx]
|
356
|
+
def rx=(v) self[:rx] = v end
|
357
|
+
def ry = self[:ry]
|
358
|
+
def ry=(v) self[:ry] = v end
|
359
|
+
def self.create_as(_cx_, _cy_, _rx_, _ry_)
|
360
|
+
instance = BLEllipse.new
|
361
|
+
instance[:cx] = _cx_
|
362
|
+
instance[:cy] = _cy_
|
363
|
+
instance[:rx] = _rx_
|
364
|
+
instance[:ry] = _ry_
|
365
|
+
instance
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
class BLArc < FFI::Struct
|
370
|
+
layout(
|
371
|
+
:cx, :double,
|
372
|
+
:cy, :double,
|
373
|
+
:rx, :double,
|
374
|
+
:ry, :double,
|
375
|
+
:start, :double,
|
376
|
+
:sweep, :double,
|
377
|
+
)
|
378
|
+
def cx = self[:cx]
|
379
|
+
def cx=(v) self[:cx] = v end
|
380
|
+
def cy = self[:cy]
|
381
|
+
def cy=(v) self[:cy] = v end
|
382
|
+
def rx = self[:rx]
|
383
|
+
def rx=(v) self[:rx] = v end
|
384
|
+
def ry = self[:ry]
|
385
|
+
def ry=(v) self[:ry] = v end
|
386
|
+
def start = self[:start]
|
387
|
+
def start=(v) self[:start] = v end
|
388
|
+
def sweep = self[:sweep]
|
389
|
+
def sweep=(v) self[:sweep] = v end
|
390
|
+
def self.create_as(_cx_, _cy_, _rx_, _ry_, _start_, _sweep_)
|
391
|
+
instance = BLArc.new
|
392
|
+
instance[:cx] = _cx_
|
393
|
+
instance[:cy] = _cy_
|
394
|
+
instance[:rx] = _rx_
|
395
|
+
instance[:ry] = _ry_
|
396
|
+
instance[:start] = _start_
|
397
|
+
instance[:sweep] = _sweep_
|
398
|
+
instance
|
399
|
+
end
|
400
|
+
end
|
401
|
+
|
402
|
+
|
403
|
+
# Function
|
404
|
+
|
405
|
+
def self.setup_geometry_symbols(output_error = false)
|
406
|
+
symbols = [
|
407
|
+
]
|
408
|
+
apis = {
|
409
|
+
}
|
410
|
+
args = {
|
411
|
+
}
|
412
|
+
retvals = {
|
413
|
+
}
|
414
|
+
symbols.each do |sym|
|
415
|
+
begin
|
416
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
417
|
+
rescue FFI::NotFoundError => error
|
418
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
419
|
+
end
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
end
|
424
|
+
|
@@ -0,0 +1,141 @@
|
|
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_fontdefs'
|
9
|
+
require_relative 'blend2d_glyphrun'
|
10
|
+
|
11
|
+
module Blend2D
|
12
|
+
extend FFI::Library
|
13
|
+
# Define/Macro
|
14
|
+
|
15
|
+
|
16
|
+
# Enum
|
17
|
+
|
18
|
+
|
19
|
+
# Typedef
|
20
|
+
|
21
|
+
|
22
|
+
class BLGlyphBufferImpl_Contents < FFI::Struct
|
23
|
+
layout(
|
24
|
+
:content, :pointer,
|
25
|
+
:placementData, :pointer,
|
26
|
+
:size, :ulong,
|
27
|
+
:reserved, :uint,
|
28
|
+
:flags, :uint,
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
class BLGlyphBufferImpl_Data < FFI::Union
|
33
|
+
layout(
|
34
|
+
:contents, BLGlyphBufferImpl_Contents,
|
35
|
+
:glyphRun, BLGlyphRun,
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
class BLGlyphBufferImpl < FFI::Struct
|
40
|
+
layout(
|
41
|
+
:data, BLGlyphBufferImpl_Data,
|
42
|
+
:infoData, :pointer,
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
class BLGlyphBufferCore < FFI::Struct
|
47
|
+
layout(
|
48
|
+
:impl, :pointer,
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
# Struct
|
54
|
+
|
55
|
+
|
56
|
+
# Function
|
57
|
+
|
58
|
+
def self.setup_glyphbuffer_symbols(output_error = false)
|
59
|
+
symbols = [
|
60
|
+
:blGlyphBufferInit,
|
61
|
+
:blGlyphBufferInitMove,
|
62
|
+
:blGlyphBufferDestroy,
|
63
|
+
:blGlyphBufferReset,
|
64
|
+
:blGlyphBufferClear,
|
65
|
+
:blGlyphBufferGetSize,
|
66
|
+
:blGlyphBufferGetFlags,
|
67
|
+
:blGlyphBufferGetGlyphRun,
|
68
|
+
:blGlyphBufferGetContent,
|
69
|
+
:blGlyphBufferGetInfoData,
|
70
|
+
:blGlyphBufferGetPlacementData,
|
71
|
+
:blGlyphBufferSetText,
|
72
|
+
:blGlyphBufferSetGlyphs,
|
73
|
+
:blGlyphBufferSetGlyphsFromStruct,
|
74
|
+
:blGlyphBufferSetDebugSink,
|
75
|
+
:blGlyphBufferResetDebugSink,
|
76
|
+
]
|
77
|
+
apis = {
|
78
|
+
:blGlyphBufferInit => :blGlyphBufferInit,
|
79
|
+
:blGlyphBufferInitMove => :blGlyphBufferInitMove,
|
80
|
+
:blGlyphBufferDestroy => :blGlyphBufferDestroy,
|
81
|
+
:blGlyphBufferReset => :blGlyphBufferReset,
|
82
|
+
:blGlyphBufferClear => :blGlyphBufferClear,
|
83
|
+
:blGlyphBufferGetSize => :blGlyphBufferGetSize,
|
84
|
+
:blGlyphBufferGetFlags => :blGlyphBufferGetFlags,
|
85
|
+
:blGlyphBufferGetGlyphRun => :blGlyphBufferGetGlyphRun,
|
86
|
+
:blGlyphBufferGetContent => :blGlyphBufferGetContent,
|
87
|
+
:blGlyphBufferGetInfoData => :blGlyphBufferGetInfoData,
|
88
|
+
:blGlyphBufferGetPlacementData => :blGlyphBufferGetPlacementData,
|
89
|
+
:blGlyphBufferSetText => :blGlyphBufferSetText,
|
90
|
+
:blGlyphBufferSetGlyphs => :blGlyphBufferSetGlyphs,
|
91
|
+
:blGlyphBufferSetGlyphsFromStruct => :blGlyphBufferSetGlyphsFromStruct,
|
92
|
+
:blGlyphBufferSetDebugSink => :blGlyphBufferSetDebugSink,
|
93
|
+
:blGlyphBufferResetDebugSink => :blGlyphBufferResetDebugSink,
|
94
|
+
}
|
95
|
+
args = {
|
96
|
+
:blGlyphBufferInit => [:pointer],
|
97
|
+
:blGlyphBufferInitMove => [:pointer, :pointer],
|
98
|
+
:blGlyphBufferDestroy => [:pointer],
|
99
|
+
:blGlyphBufferReset => [:pointer],
|
100
|
+
:blGlyphBufferClear => [:pointer],
|
101
|
+
:blGlyphBufferGetSize => [:pointer],
|
102
|
+
:blGlyphBufferGetFlags => [:pointer],
|
103
|
+
:blGlyphBufferGetGlyphRun => [:pointer],
|
104
|
+
:blGlyphBufferGetContent => [:pointer],
|
105
|
+
:blGlyphBufferGetInfoData => [:pointer],
|
106
|
+
:blGlyphBufferGetPlacementData => [:pointer],
|
107
|
+
:blGlyphBufferSetText => [:pointer, :pointer, :ulong_long, :int],
|
108
|
+
:blGlyphBufferSetGlyphs => [:pointer, :pointer, :ulong_long],
|
109
|
+
:blGlyphBufferSetGlyphsFromStruct => [:pointer, :pointer, :ulong_long, :ulong_long, :int64],
|
110
|
+
:blGlyphBufferSetDebugSink => [:pointer, :BLDebugMessageSinkFunc, :pointer],
|
111
|
+
:blGlyphBufferResetDebugSink => [:pointer],
|
112
|
+
}
|
113
|
+
retvals = {
|
114
|
+
:blGlyphBufferInit => :uint,
|
115
|
+
:blGlyphBufferInitMove => :uint,
|
116
|
+
:blGlyphBufferDestroy => :uint,
|
117
|
+
:blGlyphBufferReset => :uint,
|
118
|
+
:blGlyphBufferClear => :uint,
|
119
|
+
:blGlyphBufferGetSize => :ulong_long,
|
120
|
+
:blGlyphBufferGetFlags => :uint,
|
121
|
+
:blGlyphBufferGetGlyphRun => :pointer,
|
122
|
+
:blGlyphBufferGetContent => :pointer,
|
123
|
+
:blGlyphBufferGetInfoData => :pointer,
|
124
|
+
:blGlyphBufferGetPlacementData => :pointer,
|
125
|
+
:blGlyphBufferSetText => :uint,
|
126
|
+
:blGlyphBufferSetGlyphs => :uint,
|
127
|
+
:blGlyphBufferSetGlyphsFromStruct => :uint,
|
128
|
+
:blGlyphBufferSetDebugSink => :uint,
|
129
|
+
:blGlyphBufferResetDebugSink => :uint,
|
130
|
+
}
|
131
|
+
symbols.each do |sym|
|
132
|
+
begin
|
133
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
134
|
+
rescue FFI::NotFoundError => error
|
135
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
|
@@ -0,0 +1,101 @@
|
|
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_fontdefs'
|
9
|
+
|
10
|
+
module Blend2D
|
11
|
+
extend FFI::Library
|
12
|
+
# Define/Macro
|
13
|
+
|
14
|
+
|
15
|
+
# Enum
|
16
|
+
|
17
|
+
BL_GLYPH_RUN_NO_FLAGS = 0
|
18
|
+
BL_GLYPH_RUN_FLAG_UCS4_CONTENT = 268435456
|
19
|
+
BL_GLYPH_RUN_FLAG_INVALID_TEXT = 536870912
|
20
|
+
BL_GLYPH_RUN_FLAG_UNDEFINED_GLYPHS = 1073741824
|
21
|
+
BL_GLYPH_RUN_FLAG_INVALID_FONT_DATA = -2147483648
|
22
|
+
BL_GLYPH_RUN_FLAG_FORCE_UINT = -1
|
23
|
+
BL_GLYPH_PLACEMENT_TYPE_NONE = 0
|
24
|
+
BL_GLYPH_PLACEMENT_TYPE_ADVANCE_OFFSET = 1
|
25
|
+
BL_GLYPH_PLACEMENT_TYPE_DESIGN_UNITS = 2
|
26
|
+
BL_GLYPH_PLACEMENT_TYPE_USER_UNITS = 3
|
27
|
+
BL_GLYPH_PLACEMENT_TYPE_ABSOLUTE_UNITS = 4
|
28
|
+
BL_GLYPH_PLACEMENT_TYPE_MAX_VALUE = 4
|
29
|
+
BL_GLYPH_PLACEMENT_TYPE_FORCE_UINT = -1
|
30
|
+
|
31
|
+
# Typedef
|
32
|
+
|
33
|
+
typedef :int, :BLGlyphRunFlags
|
34
|
+
typedef :int, :BLGlyphPlacementType
|
35
|
+
|
36
|
+
# Struct
|
37
|
+
|
38
|
+
class BLGlyphRun < FFI::Struct
|
39
|
+
layout(
|
40
|
+
:glyphData, :pointer,
|
41
|
+
:placementData, :pointer,
|
42
|
+
:size, :ulong_long,
|
43
|
+
:reserved, :uchar,
|
44
|
+
:placementType, :uchar,
|
45
|
+
:glyphAdvance, :char,
|
46
|
+
:placementAdvance, :char,
|
47
|
+
:flags, :uint,
|
48
|
+
)
|
49
|
+
def glyphData = self[:glyphData]
|
50
|
+
def glyphData=(v) self[:glyphData] = v end
|
51
|
+
def placementData = self[:placementData]
|
52
|
+
def placementData=(v) self[:placementData] = v end
|
53
|
+
def size = self[:size]
|
54
|
+
def size=(v) self[:size] = v end
|
55
|
+
def reserved = self[:reserved]
|
56
|
+
def reserved=(v) self[:reserved] = v end
|
57
|
+
def placementType = self[:placementType]
|
58
|
+
def placementType=(v) self[:placementType] = v end
|
59
|
+
def glyphAdvance = self[:glyphAdvance]
|
60
|
+
def glyphAdvance=(v) self[:glyphAdvance] = v end
|
61
|
+
def placementAdvance = self[:placementAdvance]
|
62
|
+
def placementAdvance=(v) self[:placementAdvance] = v end
|
63
|
+
def flags = self[:flags]
|
64
|
+
def flags=(v) self[:flags] = v end
|
65
|
+
def self.create_as(_glyphData_, _placementData_, _size_, _reserved_, _placementType_, _glyphAdvance_, _placementAdvance_, _flags_)
|
66
|
+
instance = BLGlyphRun.new
|
67
|
+
instance[:glyphData] = _glyphData_
|
68
|
+
instance[:placementData] = _placementData_
|
69
|
+
instance[:size] = _size_
|
70
|
+
instance[:reserved] = _reserved_
|
71
|
+
instance[:placementType] = _placementType_
|
72
|
+
instance[:glyphAdvance] = _glyphAdvance_
|
73
|
+
instance[:placementAdvance] = _placementAdvance_
|
74
|
+
instance[:flags] = _flags_
|
75
|
+
instance
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
# Function
|
81
|
+
|
82
|
+
def self.setup_glyphrun_symbols(output_error = false)
|
83
|
+
symbols = [
|
84
|
+
]
|
85
|
+
apis = {
|
86
|
+
}
|
87
|
+
args = {
|
88
|
+
}
|
89
|
+
retvals = {
|
90
|
+
}
|
91
|
+
symbols.each do |sym|
|
92
|
+
begin
|
93
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
94
|
+
rescue FFI::NotFoundError => error
|
95
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|