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,345 @@
|
|
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_array'
|
9
|
+
require_relative 'blend2d_bitset'
|
10
|
+
require_relative 'blend2d_filesystem'
|
11
|
+
require_relative 'blend2d_fontdata'
|
12
|
+
require_relative 'blend2d_fontdefs'
|
13
|
+
require_relative 'blend2d_geometry'
|
14
|
+
require_relative 'blend2d_glyphbuffer'
|
15
|
+
require_relative 'blend2d_object'
|
16
|
+
require_relative 'blend2d_path'
|
17
|
+
require_relative 'blend2d_string'
|
18
|
+
|
19
|
+
module Blend2D
|
20
|
+
extend FFI::Library
|
21
|
+
# Define/Macro
|
22
|
+
|
23
|
+
|
24
|
+
# Enum
|
25
|
+
|
26
|
+
BL_FONT_FACE_NO_FLAGS = 0
|
27
|
+
BL_FONT_FACE_FLAG_TYPOGRAPHIC_NAMES = 1
|
28
|
+
BL_FONT_FACE_FLAG_TYPOGRAPHIC_METRICS = 2
|
29
|
+
BL_FONT_FACE_FLAG_CHAR_TO_GLYPH_MAPPING = 4
|
30
|
+
BL_FONT_FACE_FLAG_HORIZONTAL_METIRCS = 16
|
31
|
+
BL_FONT_FACE_FLAG_VERTICAL_METRICS = 32
|
32
|
+
BL_FONT_FACE_FLAG_HORIZONTAL_KERNING = 64
|
33
|
+
BL_FONT_FACE_FLAG_VERTICAL_KERNING = 128
|
34
|
+
BL_FONT_FACE_FLAG_OPENTYPE_FEATURES = 256
|
35
|
+
BL_FONT_FACE_FLAG_PANOSE_DATA = 512
|
36
|
+
BL_FONT_FACE_FLAG_UNICODE_COVERAGE = 1024
|
37
|
+
BL_FONT_FACE_FLAG_BASELINE_Y_EQUALS_0 = 4096
|
38
|
+
BL_FONT_FACE_FLAG_LSB_POINT_X_EQUALS_0 = 8192
|
39
|
+
BL_FONT_FACE_FLAG_VARIATION_SEQUENCES = 268435456
|
40
|
+
BL_FONT_FACE_FLAG_OPENTYPE_VARIATIONS = 536870912
|
41
|
+
BL_FONT_FACE_FLAG_SYMBOL_FONT = 1073741824
|
42
|
+
BL_FONT_FACE_FLAG_LAST_RESORT_FONT = -2147483648
|
43
|
+
BL_FONT_FACE_FLAG_FORCE_UINT = -1
|
44
|
+
BL_FONT_FACE_DIAG_NO_FLAGS = 0
|
45
|
+
BL_FONT_FACE_DIAG_WRONG_NAME_DATA = 1
|
46
|
+
BL_FONT_FACE_DIAG_FIXED_NAME_DATA = 2
|
47
|
+
BL_FONT_FACE_DIAG_WRONG_KERN_DATA = 4
|
48
|
+
BL_FONT_FACE_DIAG_FIXED_KERN_DATA = 8
|
49
|
+
BL_FONT_FACE_DIAG_WRONG_CMAP_DATA = 16
|
50
|
+
BL_FONT_FACE_DIAG_WRONG_CMAP_FORMAT = 32
|
51
|
+
BL_FONT_FACE_DIAG_FORCE_UINT = -1
|
52
|
+
BL_FONT_OUTLINE_TYPE_NONE = 0
|
53
|
+
BL_FONT_OUTLINE_TYPE_TRUETYPE = 1
|
54
|
+
BL_FONT_OUTLINE_TYPE_CFF = 2
|
55
|
+
BL_FONT_OUTLINE_TYPE_CFF2 = 3
|
56
|
+
BL_FONT_OUTLINE_TYPE_MAX_VALUE = 3
|
57
|
+
BL_FONT_OUTLINE_TYPE_FORCE_UINT = -1
|
58
|
+
|
59
|
+
# Typedef
|
60
|
+
|
61
|
+
typedef :int, :BLFontFaceFlags
|
62
|
+
typedef :int, :BLFontFaceDiagFlags
|
63
|
+
typedef :int, :BLFontOutlineType
|
64
|
+
|
65
|
+
# Struct
|
66
|
+
|
67
|
+
class BLFontFaceInfo < FFI::Struct
|
68
|
+
layout(
|
69
|
+
:faceType, :uchar,
|
70
|
+
:outlineType, :uchar,
|
71
|
+
:reserved8, [:uchar, 2],
|
72
|
+
:glyphCount, :uint,
|
73
|
+
:revision, :uint,
|
74
|
+
:faceIndex, :uint,
|
75
|
+
:faceFlags, :uint,
|
76
|
+
:diagFlags, :uint,
|
77
|
+
:reserved, [:uint, 2],
|
78
|
+
)
|
79
|
+
def faceType = self[:faceType]
|
80
|
+
def faceType=(v) self[:faceType] = v end
|
81
|
+
def outlineType = self[:outlineType]
|
82
|
+
def outlineType=(v) self[:outlineType] = v end
|
83
|
+
def reserved8 = self[:reserved8]
|
84
|
+
def reserved8=(v) self[:reserved8] = v end
|
85
|
+
def glyphCount = self[:glyphCount]
|
86
|
+
def glyphCount=(v) self[:glyphCount] = v end
|
87
|
+
def revision = self[:revision]
|
88
|
+
def revision=(v) self[:revision] = v end
|
89
|
+
def faceIndex = self[:faceIndex]
|
90
|
+
def faceIndex=(v) self[:faceIndex] = v end
|
91
|
+
def faceFlags = self[:faceFlags]
|
92
|
+
def faceFlags=(v) self[:faceFlags] = v end
|
93
|
+
def diagFlags = self[:diagFlags]
|
94
|
+
def diagFlags=(v) self[:diagFlags] = v end
|
95
|
+
def reserved = self[:reserved]
|
96
|
+
def reserved=(v) self[:reserved] = v end
|
97
|
+
def self.create_as(_faceType_, _outlineType_, _reserved8_, _glyphCount_, _revision_, _faceIndex_, _faceFlags_, _diagFlags_, _reserved_)
|
98
|
+
instance = BLFontFaceInfo.new
|
99
|
+
instance[:faceType] = _faceType_
|
100
|
+
instance[:outlineType] = _outlineType_
|
101
|
+
instance[:reserved8] = _reserved8_
|
102
|
+
instance[:glyphCount] = _glyphCount_
|
103
|
+
instance[:revision] = _revision_
|
104
|
+
instance[:faceIndex] = _faceIndex_
|
105
|
+
instance[:faceFlags] = _faceFlags_
|
106
|
+
instance[:diagFlags] = _diagFlags_
|
107
|
+
instance[:reserved] = _reserved_
|
108
|
+
instance
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
class BLFontFaceCore < FFI::Struct
|
113
|
+
layout(
|
114
|
+
:_d, BLObjectDetail,
|
115
|
+
)
|
116
|
+
def _d = self[:_d]
|
117
|
+
def _d=(v) self[:_d] = v end
|
118
|
+
def init() = blFontFaceInit(self)
|
119
|
+
def self.create()
|
120
|
+
instance = BLFontFaceCore.new
|
121
|
+
blFontFaceInit(instance)
|
122
|
+
instance
|
123
|
+
end
|
124
|
+
def initMove(other) = blFontFaceInitMove(self, other)
|
125
|
+
def initWeak(other) = blFontFaceInitWeak(self, other)
|
126
|
+
def destroy() = blFontFaceDestroy(self)
|
127
|
+
def reset() = blFontFaceReset(self)
|
128
|
+
def assignMove(other) = blFontFaceAssignMove(self, other)
|
129
|
+
def assignWeak(other) = blFontFaceAssignWeak(self, other)
|
130
|
+
def equals(b) = blFontFaceEquals(a, b)
|
131
|
+
def createFromFile(fileName, readFlags) = blFontFaceCreateFromFile(self, fileName, readFlags)
|
132
|
+
def createFromData(fontData, faceIndex) = blFontFaceCreateFromData(self, fontData, faceIndex)
|
133
|
+
def getFullName(out) = blFontFaceGetFullName(self, out)
|
134
|
+
def getFamilyName(out) = blFontFaceGetFamilyName(self, out)
|
135
|
+
def getSubfamilyName(out) = blFontFaceGetSubfamilyName(self, out)
|
136
|
+
def getPostScriptName(out) = blFontFaceGetPostScriptName(self, out)
|
137
|
+
def getFaceInfo(out) = blFontFaceGetFaceInfo(self, out)
|
138
|
+
def getDesignMetrics(out) = blFontFaceGetDesignMetrics(self, out)
|
139
|
+
def getUnicodeCoverage(out) = blFontFaceGetUnicodeCoverage(self, out)
|
140
|
+
def getCharacterCoverage(out) = blFontFaceGetCharacterCoverage(self, out)
|
141
|
+
def hasScriptTag(scriptTag) = blFontFaceHasScriptTag(self, scriptTag)
|
142
|
+
def hasFeatureTag(featureTag) = blFontFaceHasFeatureTag(self, featureTag)
|
143
|
+
def hasVariationTag(variationTag) = blFontFaceHasVariationTag(self, variationTag)
|
144
|
+
def getScriptTags(out) = blFontFaceGetScriptTags(self, out)
|
145
|
+
def getFeatureTags(out) = blFontFaceGetFeatureTags(self, out)
|
146
|
+
def getVariationTags(out) = blFontFaceGetVariationTags(self, out)
|
147
|
+
end
|
148
|
+
|
149
|
+
class BLFontFaceVirt < FFI::Struct
|
150
|
+
layout(
|
151
|
+
:base, BLObjectVirtBase,
|
152
|
+
)
|
153
|
+
def base = self[:base]
|
154
|
+
def base=(v) self[:base] = v end
|
155
|
+
def self.create_as(_base_)
|
156
|
+
instance = BLFontFaceVirt.new
|
157
|
+
instance[:base] = _base_
|
158
|
+
instance
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
class BLFontFaceImpl < FFI::Struct
|
163
|
+
layout(
|
164
|
+
:virt, :pointer,
|
165
|
+
:weight, :ushort,
|
166
|
+
:stretch, :uchar,
|
167
|
+
:style, :uchar,
|
168
|
+
:faceInfo, BLFontFaceInfo,
|
169
|
+
:uniqueId, :ulong_long,
|
170
|
+
:data, BLFontDataCore,
|
171
|
+
:fullName, BLStringCore,
|
172
|
+
:familyName, BLStringCore,
|
173
|
+
:subfamilyName, BLStringCore,
|
174
|
+
:postScriptName, BLStringCore,
|
175
|
+
:designMetrics, BLFontDesignMetrics,
|
176
|
+
:unicodeCoverage, BLFontUnicodeCoverage,
|
177
|
+
:panose, BLFontPanose,
|
178
|
+
)
|
179
|
+
def virt = self[:virt]
|
180
|
+
def virt=(v) self[:virt] = v end
|
181
|
+
def weight = self[:weight]
|
182
|
+
def weight=(v) self[:weight] = v end
|
183
|
+
def stretch = self[:stretch]
|
184
|
+
def stretch=(v) self[:stretch] = v end
|
185
|
+
def style = self[:style]
|
186
|
+
def style=(v) self[:style] = v end
|
187
|
+
def faceInfo = self[:faceInfo]
|
188
|
+
def faceInfo=(v) self[:faceInfo] = v end
|
189
|
+
def uniqueId = self[:uniqueId]
|
190
|
+
def uniqueId=(v) self[:uniqueId] = v end
|
191
|
+
def data = self[:data]
|
192
|
+
def data=(v) self[:data] = v end
|
193
|
+
def fullName = self[:fullName]
|
194
|
+
def fullName=(v) self[:fullName] = v end
|
195
|
+
def familyName = self[:familyName]
|
196
|
+
def familyName=(v) self[:familyName] = v end
|
197
|
+
def subfamilyName = self[:subfamilyName]
|
198
|
+
def subfamilyName=(v) self[:subfamilyName] = v end
|
199
|
+
def postScriptName = self[:postScriptName]
|
200
|
+
def postScriptName=(v) self[:postScriptName] = v end
|
201
|
+
def designMetrics = self[:designMetrics]
|
202
|
+
def designMetrics=(v) self[:designMetrics] = v end
|
203
|
+
def unicodeCoverage = self[:unicodeCoverage]
|
204
|
+
def unicodeCoverage=(v) self[:unicodeCoverage] = v end
|
205
|
+
def panose = self[:panose]
|
206
|
+
def panose=(v) self[:panose] = v end
|
207
|
+
def self.create_as(_virt_, _weight_, _stretch_, _style_, _faceInfo_, _uniqueId_, _data_, _fullName_, _familyName_, _subfamilyName_, _postScriptName_, _designMetrics_, _unicodeCoverage_, _panose_)
|
208
|
+
instance = BLFontFaceImpl.new
|
209
|
+
instance[:virt] = _virt_
|
210
|
+
instance[:weight] = _weight_
|
211
|
+
instance[:stretch] = _stretch_
|
212
|
+
instance[:style] = _style_
|
213
|
+
instance[:faceInfo] = _faceInfo_
|
214
|
+
instance[:uniqueId] = _uniqueId_
|
215
|
+
instance[:data] = _data_
|
216
|
+
instance[:fullName] = _fullName_
|
217
|
+
instance[:familyName] = _familyName_
|
218
|
+
instance[:subfamilyName] = _subfamilyName_
|
219
|
+
instance[:postScriptName] = _postScriptName_
|
220
|
+
instance[:designMetrics] = _designMetrics_
|
221
|
+
instance[:unicodeCoverage] = _unicodeCoverage_
|
222
|
+
instance[:panose] = _panose_
|
223
|
+
instance
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
|
228
|
+
# Function
|
229
|
+
|
230
|
+
def self.setup_fontface_symbols(output_error = false)
|
231
|
+
symbols = [
|
232
|
+
:blFontFaceInit,
|
233
|
+
:blFontFaceInitMove,
|
234
|
+
:blFontFaceInitWeak,
|
235
|
+
:blFontFaceDestroy,
|
236
|
+
:blFontFaceReset,
|
237
|
+
:blFontFaceAssignMove,
|
238
|
+
:blFontFaceAssignWeak,
|
239
|
+
:blFontFaceEquals,
|
240
|
+
:blFontFaceCreateFromFile,
|
241
|
+
:blFontFaceCreateFromData,
|
242
|
+
:blFontFaceGetFullName,
|
243
|
+
:blFontFaceGetFamilyName,
|
244
|
+
:blFontFaceGetSubfamilyName,
|
245
|
+
:blFontFaceGetPostScriptName,
|
246
|
+
:blFontFaceGetFaceInfo,
|
247
|
+
:blFontFaceGetDesignMetrics,
|
248
|
+
:blFontFaceGetUnicodeCoverage,
|
249
|
+
:blFontFaceGetCharacterCoverage,
|
250
|
+
:blFontFaceHasScriptTag,
|
251
|
+
:blFontFaceHasFeatureTag,
|
252
|
+
:blFontFaceHasVariationTag,
|
253
|
+
:blFontFaceGetScriptTags,
|
254
|
+
:blFontFaceGetFeatureTags,
|
255
|
+
:blFontFaceGetVariationTags,
|
256
|
+
]
|
257
|
+
apis = {
|
258
|
+
:blFontFaceInit => :blFontFaceInit,
|
259
|
+
:blFontFaceInitMove => :blFontFaceInitMove,
|
260
|
+
:blFontFaceInitWeak => :blFontFaceInitWeak,
|
261
|
+
:blFontFaceDestroy => :blFontFaceDestroy,
|
262
|
+
:blFontFaceReset => :blFontFaceReset,
|
263
|
+
:blFontFaceAssignMove => :blFontFaceAssignMove,
|
264
|
+
:blFontFaceAssignWeak => :blFontFaceAssignWeak,
|
265
|
+
:blFontFaceEquals => :blFontFaceEquals,
|
266
|
+
:blFontFaceCreateFromFile => :blFontFaceCreateFromFile,
|
267
|
+
:blFontFaceCreateFromData => :blFontFaceCreateFromData,
|
268
|
+
:blFontFaceGetFullName => :blFontFaceGetFullName,
|
269
|
+
:blFontFaceGetFamilyName => :blFontFaceGetFamilyName,
|
270
|
+
:blFontFaceGetSubfamilyName => :blFontFaceGetSubfamilyName,
|
271
|
+
:blFontFaceGetPostScriptName => :blFontFaceGetPostScriptName,
|
272
|
+
:blFontFaceGetFaceInfo => :blFontFaceGetFaceInfo,
|
273
|
+
:blFontFaceGetDesignMetrics => :blFontFaceGetDesignMetrics,
|
274
|
+
:blFontFaceGetUnicodeCoverage => :blFontFaceGetUnicodeCoverage,
|
275
|
+
:blFontFaceGetCharacterCoverage => :blFontFaceGetCharacterCoverage,
|
276
|
+
:blFontFaceHasScriptTag => :blFontFaceHasScriptTag,
|
277
|
+
:blFontFaceHasFeatureTag => :blFontFaceHasFeatureTag,
|
278
|
+
:blFontFaceHasVariationTag => :blFontFaceHasVariationTag,
|
279
|
+
:blFontFaceGetScriptTags => :blFontFaceGetScriptTags,
|
280
|
+
:blFontFaceGetFeatureTags => :blFontFaceGetFeatureTags,
|
281
|
+
:blFontFaceGetVariationTags => :blFontFaceGetVariationTags,
|
282
|
+
}
|
283
|
+
args = {
|
284
|
+
:blFontFaceInit => [:pointer],
|
285
|
+
:blFontFaceInitMove => [:pointer, :pointer],
|
286
|
+
:blFontFaceInitWeak => [:pointer, :pointer],
|
287
|
+
:blFontFaceDestroy => [:pointer],
|
288
|
+
:blFontFaceReset => [:pointer],
|
289
|
+
:blFontFaceAssignMove => [:pointer, :pointer],
|
290
|
+
:blFontFaceAssignWeak => [:pointer, :pointer],
|
291
|
+
:blFontFaceEquals => [:pointer, :pointer],
|
292
|
+
:blFontFaceCreateFromFile => [:pointer, :pointer, :int],
|
293
|
+
:blFontFaceCreateFromData => [:pointer, :pointer, :uint],
|
294
|
+
:blFontFaceGetFullName => [:pointer, :pointer],
|
295
|
+
:blFontFaceGetFamilyName => [:pointer, :pointer],
|
296
|
+
:blFontFaceGetSubfamilyName => [:pointer, :pointer],
|
297
|
+
:blFontFaceGetPostScriptName => [:pointer, :pointer],
|
298
|
+
:blFontFaceGetFaceInfo => [:pointer, :pointer],
|
299
|
+
:blFontFaceGetDesignMetrics => [:pointer, :pointer],
|
300
|
+
:blFontFaceGetUnicodeCoverage => [:pointer, :pointer],
|
301
|
+
:blFontFaceGetCharacterCoverage => [:pointer, :pointer],
|
302
|
+
:blFontFaceHasScriptTag => [:pointer, :uint],
|
303
|
+
:blFontFaceHasFeatureTag => [:pointer, :uint],
|
304
|
+
:blFontFaceHasVariationTag => [:pointer, :uint],
|
305
|
+
:blFontFaceGetScriptTags => [:pointer, :pointer],
|
306
|
+
:blFontFaceGetFeatureTags => [:pointer, :pointer],
|
307
|
+
:blFontFaceGetVariationTags => [:pointer, :pointer],
|
308
|
+
}
|
309
|
+
retvals = {
|
310
|
+
:blFontFaceInit => :uint,
|
311
|
+
:blFontFaceInitMove => :uint,
|
312
|
+
:blFontFaceInitWeak => :uint,
|
313
|
+
:blFontFaceDestroy => :uint,
|
314
|
+
:blFontFaceReset => :uint,
|
315
|
+
:blFontFaceAssignMove => :uint,
|
316
|
+
:blFontFaceAssignWeak => :uint,
|
317
|
+
:blFontFaceEquals => :bool,
|
318
|
+
:blFontFaceCreateFromFile => :uint,
|
319
|
+
:blFontFaceCreateFromData => :uint,
|
320
|
+
:blFontFaceGetFullName => :uint,
|
321
|
+
:blFontFaceGetFamilyName => :uint,
|
322
|
+
:blFontFaceGetSubfamilyName => :uint,
|
323
|
+
:blFontFaceGetPostScriptName => :uint,
|
324
|
+
:blFontFaceGetFaceInfo => :uint,
|
325
|
+
:blFontFaceGetDesignMetrics => :uint,
|
326
|
+
:blFontFaceGetUnicodeCoverage => :uint,
|
327
|
+
:blFontFaceGetCharacterCoverage => :uint,
|
328
|
+
:blFontFaceHasScriptTag => :bool,
|
329
|
+
:blFontFaceHasFeatureTag => :bool,
|
330
|
+
:blFontFaceHasVariationTag => :bool,
|
331
|
+
:blFontFaceGetScriptTags => :uint,
|
332
|
+
:blFontFaceGetFeatureTags => :uint,
|
333
|
+
:blFontFaceGetVariationTags => :uint,
|
334
|
+
}
|
335
|
+
symbols.each do |sym|
|
336
|
+
begin
|
337
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
338
|
+
rescue FFI::NotFoundError => error
|
339
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
340
|
+
end
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
end
|
345
|
+
|
@@ -0,0 +1,210 @@
|
|
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_array'
|
9
|
+
require_relative 'blend2d_bitset'
|
10
|
+
require_relative 'blend2d_filesystem'
|
11
|
+
require_relative 'blend2d_fontdefs'
|
12
|
+
require_relative 'blend2d_geometry'
|
13
|
+
require_relative 'blend2d_glyphbuffer'
|
14
|
+
require_relative 'blend2d_object'
|
15
|
+
require_relative 'blend2d_path'
|
16
|
+
require_relative 'blend2d_string'
|
17
|
+
|
18
|
+
module Blend2D
|
19
|
+
extend FFI::Library
|
20
|
+
# Define/Macro
|
21
|
+
|
22
|
+
|
23
|
+
# Enum
|
24
|
+
|
25
|
+
|
26
|
+
# Typedef
|
27
|
+
|
28
|
+
|
29
|
+
# Struct
|
30
|
+
|
31
|
+
class BLFontFeatureSettingsCore < FFI::Struct
|
32
|
+
layout(
|
33
|
+
:_d, BLObjectDetail,
|
34
|
+
)
|
35
|
+
def _d = self[:_d]
|
36
|
+
def _d=(v) self[:_d] = v end
|
37
|
+
def init() = blFontFeatureSettingsInit(self)
|
38
|
+
def self.create()
|
39
|
+
instance = BLFontFeatureSettingsCore.new
|
40
|
+
blFontFeatureSettingsInit(instance)
|
41
|
+
instance
|
42
|
+
end
|
43
|
+
def initMove(other) = blFontFeatureSettingsInitMove(self, other)
|
44
|
+
def initWeak(other) = blFontFeatureSettingsInitWeak(self, other)
|
45
|
+
def destroy() = blFontFeatureSettingsDestroy(self)
|
46
|
+
def reset() = blFontFeatureSettingsReset(self)
|
47
|
+
def clear() = blFontFeatureSettingsClear(self)
|
48
|
+
def shrink() = blFontFeatureSettingsShrink(self)
|
49
|
+
def assignMove(other) = blFontFeatureSettingsAssignMove(self, other)
|
50
|
+
def assignWeak(other) = blFontFeatureSettingsAssignWeak(self, other)
|
51
|
+
def getSize() = blFontFeatureSettingsGetSize(self)
|
52
|
+
def getCapacity() = blFontFeatureSettingsGetCapacity(self)
|
53
|
+
def getView(out) = blFontFeatureSettingsGetView(self, out)
|
54
|
+
def hasValue(featureTag) = blFontFeatureSettingsHasValue(self, featureTag)
|
55
|
+
def getValue(featureTag) = blFontFeatureSettingsGetValue(self, featureTag)
|
56
|
+
def setValue(featureTag, value) = blFontFeatureSettingsSetValue(self, featureTag, value)
|
57
|
+
def removeValue(featureTag) = blFontFeatureSettingsRemoveValue(self, featureTag)
|
58
|
+
def equals(b) = blFontFeatureSettingsEquals(a, b)
|
59
|
+
end
|
60
|
+
|
61
|
+
class BLFontFeatureSettingsImpl < FFI::Struct
|
62
|
+
layout(
|
63
|
+
:data, :pointer,
|
64
|
+
:size, :ulong_long,
|
65
|
+
:capacity, :ulong_long,
|
66
|
+
)
|
67
|
+
def data = self[:data]
|
68
|
+
def data=(v) self[:data] = v end
|
69
|
+
def size = self[:size]
|
70
|
+
def size=(v) self[:size] = v end
|
71
|
+
def capacity = self[:capacity]
|
72
|
+
def capacity=(v) self[:capacity] = v end
|
73
|
+
def self.create_as(_data_, _size_, _capacity_)
|
74
|
+
instance = BLFontFeatureSettingsImpl.new
|
75
|
+
instance[:data] = _data_
|
76
|
+
instance[:size] = _size_
|
77
|
+
instance[:capacity] = _capacity_
|
78
|
+
instance
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class BLFontFeatureItem < FFI::Struct
|
83
|
+
layout(
|
84
|
+
:tag, :uint,
|
85
|
+
:value, :uint,
|
86
|
+
)
|
87
|
+
def tag = self[:tag]
|
88
|
+
def tag=(v) self[:tag] = v end
|
89
|
+
def value = self[:value]
|
90
|
+
def value=(v) self[:value] = v end
|
91
|
+
def self.create_as(_tag_, _value_)
|
92
|
+
instance = BLFontFeatureItem.new
|
93
|
+
instance[:tag] = _tag_
|
94
|
+
instance[:value] = _value_
|
95
|
+
instance
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
class BLFontFeatureSettingsView < FFI::Struct
|
100
|
+
layout(
|
101
|
+
:data, :pointer,
|
102
|
+
:size, :ulong_long,
|
103
|
+
:ssoData, [BLFontFeatureItem, 36],
|
104
|
+
)
|
105
|
+
def data = self[:data]
|
106
|
+
def data=(v) self[:data] = v end
|
107
|
+
def size = self[:size]
|
108
|
+
def size=(v) self[:size] = v end
|
109
|
+
def ssoData = self[:ssoData]
|
110
|
+
def ssoData=(v) self[:ssoData] = v end
|
111
|
+
def self.create_as(_data_, _size_, _ssoData_)
|
112
|
+
instance = BLFontFeatureSettingsView.new
|
113
|
+
instance[:data] = _data_
|
114
|
+
instance[:size] = _size_
|
115
|
+
instance[:ssoData] = _ssoData_
|
116
|
+
instance
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
# Function
|
122
|
+
|
123
|
+
def self.setup_fontfeaturesettings_symbols(output_error = false)
|
124
|
+
symbols = [
|
125
|
+
:blFontFeatureSettingsInit,
|
126
|
+
:blFontFeatureSettingsInitMove,
|
127
|
+
:blFontFeatureSettingsInitWeak,
|
128
|
+
:blFontFeatureSettingsDestroy,
|
129
|
+
:blFontFeatureSettingsReset,
|
130
|
+
:blFontFeatureSettingsClear,
|
131
|
+
:blFontFeatureSettingsShrink,
|
132
|
+
:blFontFeatureSettingsAssignMove,
|
133
|
+
:blFontFeatureSettingsAssignWeak,
|
134
|
+
:blFontFeatureSettingsGetSize,
|
135
|
+
:blFontFeatureSettingsGetCapacity,
|
136
|
+
:blFontFeatureSettingsGetView,
|
137
|
+
:blFontFeatureSettingsHasValue,
|
138
|
+
:blFontFeatureSettingsGetValue,
|
139
|
+
:blFontFeatureSettingsSetValue,
|
140
|
+
:blFontFeatureSettingsRemoveValue,
|
141
|
+
:blFontFeatureSettingsEquals,
|
142
|
+
]
|
143
|
+
apis = {
|
144
|
+
:blFontFeatureSettingsInit => :blFontFeatureSettingsInit,
|
145
|
+
:blFontFeatureSettingsInitMove => :blFontFeatureSettingsInitMove,
|
146
|
+
:blFontFeatureSettingsInitWeak => :blFontFeatureSettingsInitWeak,
|
147
|
+
:blFontFeatureSettingsDestroy => :blFontFeatureSettingsDestroy,
|
148
|
+
:blFontFeatureSettingsReset => :blFontFeatureSettingsReset,
|
149
|
+
:blFontFeatureSettingsClear => :blFontFeatureSettingsClear,
|
150
|
+
:blFontFeatureSettingsShrink => :blFontFeatureSettingsShrink,
|
151
|
+
:blFontFeatureSettingsAssignMove => :blFontFeatureSettingsAssignMove,
|
152
|
+
:blFontFeatureSettingsAssignWeak => :blFontFeatureSettingsAssignWeak,
|
153
|
+
:blFontFeatureSettingsGetSize => :blFontFeatureSettingsGetSize,
|
154
|
+
:blFontFeatureSettingsGetCapacity => :blFontFeatureSettingsGetCapacity,
|
155
|
+
:blFontFeatureSettingsGetView => :blFontFeatureSettingsGetView,
|
156
|
+
:blFontFeatureSettingsHasValue => :blFontFeatureSettingsHasValue,
|
157
|
+
:blFontFeatureSettingsGetValue => :blFontFeatureSettingsGetValue,
|
158
|
+
:blFontFeatureSettingsSetValue => :blFontFeatureSettingsSetValue,
|
159
|
+
:blFontFeatureSettingsRemoveValue => :blFontFeatureSettingsRemoveValue,
|
160
|
+
:blFontFeatureSettingsEquals => :blFontFeatureSettingsEquals,
|
161
|
+
}
|
162
|
+
args = {
|
163
|
+
:blFontFeatureSettingsInit => [:pointer],
|
164
|
+
:blFontFeatureSettingsInitMove => [:pointer, :pointer],
|
165
|
+
:blFontFeatureSettingsInitWeak => [:pointer, :pointer],
|
166
|
+
:blFontFeatureSettingsDestroy => [:pointer],
|
167
|
+
:blFontFeatureSettingsReset => [:pointer],
|
168
|
+
:blFontFeatureSettingsClear => [:pointer],
|
169
|
+
:blFontFeatureSettingsShrink => [:pointer],
|
170
|
+
:blFontFeatureSettingsAssignMove => [:pointer, :pointer],
|
171
|
+
:blFontFeatureSettingsAssignWeak => [:pointer, :pointer],
|
172
|
+
:blFontFeatureSettingsGetSize => [:pointer],
|
173
|
+
:blFontFeatureSettingsGetCapacity => [:pointer],
|
174
|
+
:blFontFeatureSettingsGetView => [:pointer, :pointer],
|
175
|
+
:blFontFeatureSettingsHasValue => [:pointer, :uint],
|
176
|
+
:blFontFeatureSettingsGetValue => [:pointer, :uint],
|
177
|
+
:blFontFeatureSettingsSetValue => [:pointer, :uint, :uint],
|
178
|
+
:blFontFeatureSettingsRemoveValue => [:pointer, :uint],
|
179
|
+
:blFontFeatureSettingsEquals => [:pointer, :pointer],
|
180
|
+
}
|
181
|
+
retvals = {
|
182
|
+
:blFontFeatureSettingsInit => :uint,
|
183
|
+
:blFontFeatureSettingsInitMove => :uint,
|
184
|
+
:blFontFeatureSettingsInitWeak => :uint,
|
185
|
+
:blFontFeatureSettingsDestroy => :uint,
|
186
|
+
:blFontFeatureSettingsReset => :uint,
|
187
|
+
:blFontFeatureSettingsClear => :uint,
|
188
|
+
:blFontFeatureSettingsShrink => :uint,
|
189
|
+
:blFontFeatureSettingsAssignMove => :uint,
|
190
|
+
:blFontFeatureSettingsAssignWeak => :uint,
|
191
|
+
:blFontFeatureSettingsGetSize => :ulong_long,
|
192
|
+
:blFontFeatureSettingsGetCapacity => :ulong_long,
|
193
|
+
:blFontFeatureSettingsGetView => :uint,
|
194
|
+
:blFontFeatureSettingsHasValue => :bool,
|
195
|
+
:blFontFeatureSettingsGetValue => :uint,
|
196
|
+
:blFontFeatureSettingsSetValue => :uint,
|
197
|
+
:blFontFeatureSettingsRemoveValue => :uint,
|
198
|
+
:blFontFeatureSettingsEquals => :bool,
|
199
|
+
}
|
200
|
+
symbols.each do |sym|
|
201
|
+
begin
|
202
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
203
|
+
rescue FFI::NotFoundError => error
|
204
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
210
|
+
|