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,291 @@
|
|
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_format'
|
10
|
+
require_relative 'blend2d_geometry'
|
11
|
+
require_relative 'blend2d_imagecodec'
|
12
|
+
require_relative 'blend2d_object'
|
13
|
+
|
14
|
+
module Blend2D
|
15
|
+
extend FFI::Library
|
16
|
+
# Define/Macro
|
17
|
+
|
18
|
+
|
19
|
+
# Enum
|
20
|
+
|
21
|
+
BL_IMAGE_INFO_FLAG_NO_FLAGS = 0
|
22
|
+
BL_IMAGE_INFO_FLAG_PROGRESSIVE = 1
|
23
|
+
BL_IMAGE_INFO_FLAG_FORCE_UINT = -1
|
24
|
+
BL_IMAGE_SCALE_FILTER_NONE = 0
|
25
|
+
BL_IMAGE_SCALE_FILTER_NEAREST = 1
|
26
|
+
BL_IMAGE_SCALE_FILTER_BILINEAR = 2
|
27
|
+
BL_IMAGE_SCALE_FILTER_BICUBIC = 3
|
28
|
+
BL_IMAGE_SCALE_FILTER_LANCZOS = 4
|
29
|
+
BL_IMAGE_SCALE_FILTER_MAX_VALUE = 4
|
30
|
+
BL_IMAGE_SCALE_FILTER_FORCE_UINT = -1
|
31
|
+
|
32
|
+
# Typedef
|
33
|
+
|
34
|
+
typedef :int, :BLImageInfoFlags
|
35
|
+
typedef :int, :BLImageScaleFilter
|
36
|
+
|
37
|
+
# Struct
|
38
|
+
|
39
|
+
class BLImageData < FFI::Struct
|
40
|
+
layout(
|
41
|
+
:pixelData, :pointer,
|
42
|
+
:stride, :int64,
|
43
|
+
:size, BLSizeI,
|
44
|
+
:format, :uint,
|
45
|
+
:flags, :uint,
|
46
|
+
)
|
47
|
+
def pixelData = self[:pixelData]
|
48
|
+
def pixelData=(v) self[:pixelData] = v end
|
49
|
+
def stride = self[:stride]
|
50
|
+
def stride=(v) self[:stride] = v end
|
51
|
+
def size = self[:size]
|
52
|
+
def size=(v) self[:size] = v end
|
53
|
+
def format = self[:format]
|
54
|
+
def format=(v) self[:format] = v end
|
55
|
+
def flags = self[:flags]
|
56
|
+
def flags=(v) self[:flags] = v end
|
57
|
+
def self.create_as(_pixelData_, _stride_, _size_, _format_, _flags_)
|
58
|
+
instance = BLImageData.new
|
59
|
+
instance[:pixelData] = _pixelData_
|
60
|
+
instance[:stride] = _stride_
|
61
|
+
instance[:size] = _size_
|
62
|
+
instance[:format] = _format_
|
63
|
+
instance[:flags] = _flags_
|
64
|
+
instance
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
class BLImageInfo < FFI::Struct
|
69
|
+
layout(
|
70
|
+
:size, BLSizeI,
|
71
|
+
:density, BLSize,
|
72
|
+
:flags, :uint,
|
73
|
+
:depth, :ushort,
|
74
|
+
:planeCount, :ushort,
|
75
|
+
:frameCount, :ulong_long,
|
76
|
+
:format, [:char, 16],
|
77
|
+
:compression, [:char, 16],
|
78
|
+
)
|
79
|
+
def size = self[:size]
|
80
|
+
def size=(v) self[:size] = v end
|
81
|
+
def density = self[:density]
|
82
|
+
def density=(v) self[:density] = v end
|
83
|
+
def flags = self[:flags]
|
84
|
+
def flags=(v) self[:flags] = v end
|
85
|
+
def depth = self[:depth]
|
86
|
+
def depth=(v) self[:depth] = v end
|
87
|
+
def planeCount = self[:planeCount]
|
88
|
+
def planeCount=(v) self[:planeCount] = v end
|
89
|
+
def frameCount = self[:frameCount]
|
90
|
+
def frameCount=(v) self[:frameCount] = v end
|
91
|
+
def format = self[:format]
|
92
|
+
def format=(v) self[:format] = v end
|
93
|
+
def compression = self[:compression]
|
94
|
+
def compression=(v) self[:compression] = v end
|
95
|
+
def self.create_as(_size_, _density_, _flags_, _depth_, _planeCount_, _frameCount_, _format_, _compression_)
|
96
|
+
instance = BLImageInfo.new
|
97
|
+
instance[:size] = _size_
|
98
|
+
instance[:density] = _density_
|
99
|
+
instance[:flags] = _flags_
|
100
|
+
instance[:depth] = _depth_
|
101
|
+
instance[:planeCount] = _planeCount_
|
102
|
+
instance[:frameCount] = _frameCount_
|
103
|
+
instance[:format] = _format_
|
104
|
+
instance[:compression] = _compression_
|
105
|
+
instance
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
class BLImageCore < FFI::Struct
|
110
|
+
layout(
|
111
|
+
:_d, BLObjectDetail,
|
112
|
+
)
|
113
|
+
def _d = self[:_d]
|
114
|
+
def _d=(v) self[:_d] = v end
|
115
|
+
def init() = blImageInit(self)
|
116
|
+
def self.create()
|
117
|
+
instance = BLImageCore.new
|
118
|
+
blImageInit(instance)
|
119
|
+
instance
|
120
|
+
end
|
121
|
+
def initMove(other) = blImageInitMove(self, other)
|
122
|
+
def initWeak(other) = blImageInitWeak(self, other)
|
123
|
+
def initAs(w, h, format) = blImageInitAs(self, w, h, format)
|
124
|
+
def self.create_as(w, h, format)
|
125
|
+
instance = BLImageCore.new
|
126
|
+
blImageInitAs(instance, w, h, format)
|
127
|
+
instance
|
128
|
+
end
|
129
|
+
def initAsFromData(w, h, format, pixelData, stride, accessFlags, destroyFunc, userData) = blImageInitAsFromData(self, w, h, format, pixelData, stride, accessFlags, destroyFunc, userData)
|
130
|
+
def destroy() = blImageDestroy(self)
|
131
|
+
def reset() = blImageReset(self)
|
132
|
+
def assignMove(other) = blImageAssignMove(self, other)
|
133
|
+
def assignWeak(other) = blImageAssignWeak(self, other)
|
134
|
+
def assignDeep(other) = blImageAssignDeep(self, other)
|
135
|
+
def create(w, h, format) = blImageCreate(self, w, h, format)
|
136
|
+
def createFromData(w, h, format, pixelData, stride, accessFlags, destroyFunc, userData) = blImageCreateFromData(self, w, h, format, pixelData, stride, accessFlags, destroyFunc, userData)
|
137
|
+
def getData(dataOut) = blImageGetData(self, dataOut)
|
138
|
+
def makeMutable(dataOut) = blImageMakeMutable(self, dataOut)
|
139
|
+
def convert(format) = blImageConvert(self, format)
|
140
|
+
def equals(b) = blImageEquals(a, b)
|
141
|
+
def scale(src, size, filter) = blImageScale(dst, src, size, filter)
|
142
|
+
def readFromFile(fileName, codecs) = blImageReadFromFile(self, fileName, codecs)
|
143
|
+
def readFromData(data, size, codecs) = blImageReadFromData(self, data, size, codecs)
|
144
|
+
def writeToFile(fileName, codec) = blImageWriteToFile(self, fileName, codec)
|
145
|
+
def writeToData(dst, codec) = blImageWriteToData(self, dst, codec)
|
146
|
+
end
|
147
|
+
|
148
|
+
class BLImageImpl < FFI::Struct
|
149
|
+
layout(
|
150
|
+
:pixelData, :pointer,
|
151
|
+
:stride, :int64,
|
152
|
+
:size, BLSizeI,
|
153
|
+
:format, :uchar,
|
154
|
+
:flags, :uchar,
|
155
|
+
:depth, :ushort,
|
156
|
+
:reserved, [:uchar, 4],
|
157
|
+
)
|
158
|
+
def pixelData = self[:pixelData]
|
159
|
+
def pixelData=(v) self[:pixelData] = v end
|
160
|
+
def stride = self[:stride]
|
161
|
+
def stride=(v) self[:stride] = v end
|
162
|
+
def size = self[:size]
|
163
|
+
def size=(v) self[:size] = v end
|
164
|
+
def format = self[:format]
|
165
|
+
def format=(v) self[:format] = v end
|
166
|
+
def flags = self[:flags]
|
167
|
+
def flags=(v) self[:flags] = v end
|
168
|
+
def depth = self[:depth]
|
169
|
+
def depth=(v) self[:depth] = v end
|
170
|
+
def reserved = self[:reserved]
|
171
|
+
def reserved=(v) self[:reserved] = v end
|
172
|
+
def self.create_as(_pixelData_, _stride_, _size_, _format_, _flags_, _depth_, _reserved_)
|
173
|
+
instance = BLImageImpl.new
|
174
|
+
instance[:pixelData] = _pixelData_
|
175
|
+
instance[:stride] = _stride_
|
176
|
+
instance[:size] = _size_
|
177
|
+
instance[:format] = _format_
|
178
|
+
instance[:flags] = _flags_
|
179
|
+
instance[:depth] = _depth_
|
180
|
+
instance[:reserved] = _reserved_
|
181
|
+
instance
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
|
186
|
+
# Function
|
187
|
+
|
188
|
+
def self.setup_image_symbols(output_error = false)
|
189
|
+
symbols = [
|
190
|
+
:blImageInit,
|
191
|
+
:blImageInitMove,
|
192
|
+
:blImageInitWeak,
|
193
|
+
:blImageInitAs,
|
194
|
+
:blImageInitAsFromData,
|
195
|
+
:blImageDestroy,
|
196
|
+
:blImageReset,
|
197
|
+
:blImageAssignMove,
|
198
|
+
:blImageAssignWeak,
|
199
|
+
:blImageAssignDeep,
|
200
|
+
:blImageCreate,
|
201
|
+
:blImageCreateFromData,
|
202
|
+
:blImageGetData,
|
203
|
+
:blImageMakeMutable,
|
204
|
+
:blImageConvert,
|
205
|
+
:blImageEquals,
|
206
|
+
:blImageScale,
|
207
|
+
:blImageReadFromFile,
|
208
|
+
:blImageReadFromData,
|
209
|
+
:blImageWriteToFile,
|
210
|
+
:blImageWriteToData,
|
211
|
+
]
|
212
|
+
apis = {
|
213
|
+
:blImageInit => :blImageInit,
|
214
|
+
:blImageInitMove => :blImageInitMove,
|
215
|
+
:blImageInitWeak => :blImageInitWeak,
|
216
|
+
:blImageInitAs => :blImageInitAs,
|
217
|
+
:blImageInitAsFromData => :blImageInitAsFromData,
|
218
|
+
:blImageDestroy => :blImageDestroy,
|
219
|
+
:blImageReset => :blImageReset,
|
220
|
+
:blImageAssignMove => :blImageAssignMove,
|
221
|
+
:blImageAssignWeak => :blImageAssignWeak,
|
222
|
+
:blImageAssignDeep => :blImageAssignDeep,
|
223
|
+
:blImageCreate => :blImageCreate,
|
224
|
+
:blImageCreateFromData => :blImageCreateFromData,
|
225
|
+
:blImageGetData => :blImageGetData,
|
226
|
+
:blImageMakeMutable => :blImageMakeMutable,
|
227
|
+
:blImageConvert => :blImageConvert,
|
228
|
+
:blImageEquals => :blImageEquals,
|
229
|
+
:blImageScale => :blImageScale,
|
230
|
+
:blImageReadFromFile => :blImageReadFromFile,
|
231
|
+
:blImageReadFromData => :blImageReadFromData,
|
232
|
+
:blImageWriteToFile => :blImageWriteToFile,
|
233
|
+
:blImageWriteToData => :blImageWriteToData,
|
234
|
+
}
|
235
|
+
args = {
|
236
|
+
:blImageInit => [:pointer],
|
237
|
+
:blImageInitMove => [:pointer, :pointer],
|
238
|
+
:blImageInitWeak => [:pointer, :pointer],
|
239
|
+
:blImageInitAs => [:pointer, :int, :int, :int],
|
240
|
+
:blImageInitAsFromData => [:pointer, :int, :int, :int, :pointer, :int64, :int, :BLDestroyExternalDataFunc, :pointer],
|
241
|
+
:blImageDestroy => [:pointer],
|
242
|
+
:blImageReset => [:pointer],
|
243
|
+
:blImageAssignMove => [:pointer, :pointer],
|
244
|
+
:blImageAssignWeak => [:pointer, :pointer],
|
245
|
+
:blImageAssignDeep => [:pointer, :pointer],
|
246
|
+
:blImageCreate => [:pointer, :int, :int, :int],
|
247
|
+
:blImageCreateFromData => [:pointer, :int, :int, :int, :pointer, :int64, :int, :BLDestroyExternalDataFunc, :pointer],
|
248
|
+
:blImageGetData => [:pointer, :pointer],
|
249
|
+
:blImageMakeMutable => [:pointer, :pointer],
|
250
|
+
:blImageConvert => [:pointer, :int],
|
251
|
+
:blImageEquals => [:pointer, :pointer],
|
252
|
+
:blImageScale => [:pointer, :pointer, :pointer, :int],
|
253
|
+
:blImageReadFromFile => [:pointer, :pointer, :pointer],
|
254
|
+
:blImageReadFromData => [:pointer, :pointer, :ulong_long, :pointer],
|
255
|
+
:blImageWriteToFile => [:pointer, :pointer, :pointer],
|
256
|
+
:blImageWriteToData => [:pointer, :pointer, :pointer],
|
257
|
+
}
|
258
|
+
retvals = {
|
259
|
+
:blImageInit => :uint,
|
260
|
+
:blImageInitMove => :uint,
|
261
|
+
:blImageInitWeak => :uint,
|
262
|
+
:blImageInitAs => :uint,
|
263
|
+
:blImageInitAsFromData => :uint,
|
264
|
+
:blImageDestroy => :uint,
|
265
|
+
:blImageReset => :uint,
|
266
|
+
:blImageAssignMove => :uint,
|
267
|
+
:blImageAssignWeak => :uint,
|
268
|
+
:blImageAssignDeep => :uint,
|
269
|
+
:blImageCreate => :uint,
|
270
|
+
:blImageCreateFromData => :uint,
|
271
|
+
:blImageGetData => :uint,
|
272
|
+
:blImageMakeMutable => :uint,
|
273
|
+
:blImageConvert => :uint,
|
274
|
+
:blImageEquals => :bool,
|
275
|
+
:blImageScale => :uint,
|
276
|
+
:blImageReadFromFile => :uint,
|
277
|
+
:blImageReadFromData => :uint,
|
278
|
+
:blImageWriteToFile => :uint,
|
279
|
+
:blImageWriteToData => :uint,
|
280
|
+
}
|
281
|
+
symbols.each do |sym|
|
282
|
+
begin
|
283
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
284
|
+
rescue FFI::NotFoundError => error
|
285
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
end
|
291
|
+
|
@@ -0,0 +1,219 @@
|
|
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_object'
|
10
|
+
require_relative 'blend2d_string'
|
11
|
+
|
12
|
+
module Blend2D
|
13
|
+
extend FFI::Library
|
14
|
+
# Define/Macro
|
15
|
+
|
16
|
+
|
17
|
+
# Enum
|
18
|
+
|
19
|
+
BL_IMAGE_CODEC_NO_FEATURES = 0
|
20
|
+
BL_IMAGE_CODEC_FEATURE_READ = 1
|
21
|
+
BL_IMAGE_CODEC_FEATURE_WRITE = 2
|
22
|
+
BL_IMAGE_CODEC_FEATURE_LOSSLESS = 4
|
23
|
+
BL_IMAGE_CODEC_FEATURE_LOSSY = 8
|
24
|
+
BL_IMAGE_CODEC_FEATURE_MULTI_FRAME = 16
|
25
|
+
BL_IMAGE_CODEC_FEATURE_IPTC = 268435456
|
26
|
+
BL_IMAGE_CODEC_FEATURE_EXIF = 536870912
|
27
|
+
BL_IMAGE_CODEC_FEATURE_XMP = 1073741824
|
28
|
+
BL_IMAGE_CODEC_FEATURE_FORCE_UINT = -1
|
29
|
+
|
30
|
+
# Typedef
|
31
|
+
|
32
|
+
typedef :int, :BLImageCodecFeatures
|
33
|
+
|
34
|
+
# Struct
|
35
|
+
|
36
|
+
class BLImageCodecCore < FFI::Struct
|
37
|
+
layout(
|
38
|
+
:_d, BLObjectDetail,
|
39
|
+
)
|
40
|
+
def _d = self[:_d]
|
41
|
+
def _d=(v) self[:_d] = v end
|
42
|
+
def init() = blImageCodecInit(self)
|
43
|
+
def self.create()
|
44
|
+
instance = BLImageCodecCore.new
|
45
|
+
blImageCodecInit(instance)
|
46
|
+
instance
|
47
|
+
end
|
48
|
+
def initMove(other) = blImageCodecInitMove(self, other)
|
49
|
+
def initWeak(other) = blImageCodecInitWeak(self, other)
|
50
|
+
def initByName(name, size, codecs) = blImageCodecInitByName(self, name, size, codecs)
|
51
|
+
def destroy() = blImageCodecDestroy(self)
|
52
|
+
def reset() = blImageCodecReset(self)
|
53
|
+
def assignMove(other) = blImageCodecAssignMove(self, other)
|
54
|
+
def assignWeak(other) = blImageCodecAssignWeak(self, other)
|
55
|
+
def findByName(name, size, codecs) = blImageCodecFindByName(self, name, size, codecs)
|
56
|
+
def findByExtension(name, size, codecs) = blImageCodecFindByExtension(self, name, size, codecs)
|
57
|
+
def findByData(data, size, codecs) = blImageCodecFindByData(self, data, size, codecs)
|
58
|
+
def inspectData(data, size) = blImageCodecInspectData(self, data, size)
|
59
|
+
def createDecoder(dst) = blImageCodecCreateDecoder(self, dst)
|
60
|
+
def createEncoder(dst) = blImageCodecCreateEncoder(self, dst)
|
61
|
+
def arrayInitBuiltInCodecs() = blImageCodecArrayInitBuiltInCodecs(self)
|
62
|
+
def arrayAssignBuiltInCodecs() = blImageCodecArrayAssignBuiltInCodecs(self)
|
63
|
+
def addToBuiltIn() = blImageCodecAddToBuiltIn(codec)
|
64
|
+
def removeFromBuiltIn() = blImageCodecRemoveFromBuiltIn(codec)
|
65
|
+
end
|
66
|
+
|
67
|
+
class BLImageCodecVirt < FFI::Struct
|
68
|
+
layout(
|
69
|
+
:base, BLObjectVirtBase,
|
70
|
+
:inspectData, :pointer,
|
71
|
+
:createDecoder, :pointer,
|
72
|
+
:createEncoder, :pointer,
|
73
|
+
)
|
74
|
+
def base = self[:base]
|
75
|
+
def base=(v) self[:base] = v end
|
76
|
+
def inspectData = self[:inspectData]
|
77
|
+
def inspectData=(v) self[:inspectData] = v end
|
78
|
+
def createDecoder = self[:createDecoder]
|
79
|
+
def createDecoder=(v) self[:createDecoder] = v end
|
80
|
+
def createEncoder = self[:createEncoder]
|
81
|
+
def createEncoder=(v) self[:createEncoder] = v end
|
82
|
+
def self.create_as(_base_, _inspectData_, _createDecoder_, _createEncoder_)
|
83
|
+
instance = BLImageCodecVirt.new
|
84
|
+
instance[:base] = _base_
|
85
|
+
instance[:inspectData] = _inspectData_
|
86
|
+
instance[:createDecoder] = _createDecoder_
|
87
|
+
instance[:createEncoder] = _createEncoder_
|
88
|
+
instance
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
class BLImageCodecImpl < FFI::Struct
|
93
|
+
layout(
|
94
|
+
:virt, :pointer,
|
95
|
+
:name, BLStringCore,
|
96
|
+
:vendor, BLStringCore,
|
97
|
+
:mimeType, BLStringCore,
|
98
|
+
:extensions, BLStringCore,
|
99
|
+
:features, :uint,
|
100
|
+
)
|
101
|
+
def virt = self[:virt]
|
102
|
+
def virt=(v) self[:virt] = v end
|
103
|
+
def name = self[:name]
|
104
|
+
def name=(v) self[:name] = v end
|
105
|
+
def vendor = self[:vendor]
|
106
|
+
def vendor=(v) self[:vendor] = v end
|
107
|
+
def mimeType = self[:mimeType]
|
108
|
+
def mimeType=(v) self[:mimeType] = v end
|
109
|
+
def extensions = self[:extensions]
|
110
|
+
def extensions=(v) self[:extensions] = v end
|
111
|
+
def features = self[:features]
|
112
|
+
def features=(v) self[:features] = v end
|
113
|
+
def self.create_as(_virt_, _name_, _vendor_, _mimeType_, _extensions_, _features_)
|
114
|
+
instance = BLImageCodecImpl.new
|
115
|
+
instance[:virt] = _virt_
|
116
|
+
instance[:name] = _name_
|
117
|
+
instance[:vendor] = _vendor_
|
118
|
+
instance[:mimeType] = _mimeType_
|
119
|
+
instance[:extensions] = _extensions_
|
120
|
+
instance[:features] = _features_
|
121
|
+
instance
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
# Function
|
127
|
+
|
128
|
+
def self.setup_imagecodec_symbols(output_error = false)
|
129
|
+
symbols = [
|
130
|
+
:blImageCodecInit,
|
131
|
+
:blImageCodecInitMove,
|
132
|
+
:blImageCodecInitWeak,
|
133
|
+
:blImageCodecInitByName,
|
134
|
+
:blImageCodecDestroy,
|
135
|
+
:blImageCodecReset,
|
136
|
+
:blImageCodecAssignMove,
|
137
|
+
:blImageCodecAssignWeak,
|
138
|
+
:blImageCodecFindByName,
|
139
|
+
:blImageCodecFindByExtension,
|
140
|
+
:blImageCodecFindByData,
|
141
|
+
:blImageCodecInspectData,
|
142
|
+
:blImageCodecCreateDecoder,
|
143
|
+
:blImageCodecCreateEncoder,
|
144
|
+
:blImageCodecArrayInitBuiltInCodecs,
|
145
|
+
:blImageCodecArrayAssignBuiltInCodecs,
|
146
|
+
:blImageCodecAddToBuiltIn,
|
147
|
+
:blImageCodecRemoveFromBuiltIn,
|
148
|
+
]
|
149
|
+
apis = {
|
150
|
+
:blImageCodecInit => :blImageCodecInit,
|
151
|
+
:blImageCodecInitMove => :blImageCodecInitMove,
|
152
|
+
:blImageCodecInitWeak => :blImageCodecInitWeak,
|
153
|
+
:blImageCodecInitByName => :blImageCodecInitByName,
|
154
|
+
:blImageCodecDestroy => :blImageCodecDestroy,
|
155
|
+
:blImageCodecReset => :blImageCodecReset,
|
156
|
+
:blImageCodecAssignMove => :blImageCodecAssignMove,
|
157
|
+
:blImageCodecAssignWeak => :blImageCodecAssignWeak,
|
158
|
+
:blImageCodecFindByName => :blImageCodecFindByName,
|
159
|
+
:blImageCodecFindByExtension => :blImageCodecFindByExtension,
|
160
|
+
:blImageCodecFindByData => :blImageCodecFindByData,
|
161
|
+
:blImageCodecInspectData => :blImageCodecInspectData,
|
162
|
+
:blImageCodecCreateDecoder => :blImageCodecCreateDecoder,
|
163
|
+
:blImageCodecCreateEncoder => :blImageCodecCreateEncoder,
|
164
|
+
:blImageCodecArrayInitBuiltInCodecs => :blImageCodecArrayInitBuiltInCodecs,
|
165
|
+
:blImageCodecArrayAssignBuiltInCodecs => :blImageCodecArrayAssignBuiltInCodecs,
|
166
|
+
:blImageCodecAddToBuiltIn => :blImageCodecAddToBuiltIn,
|
167
|
+
:blImageCodecRemoveFromBuiltIn => :blImageCodecRemoveFromBuiltIn,
|
168
|
+
}
|
169
|
+
args = {
|
170
|
+
:blImageCodecInit => [:pointer],
|
171
|
+
:blImageCodecInitMove => [:pointer, :pointer],
|
172
|
+
:blImageCodecInitWeak => [:pointer, :pointer],
|
173
|
+
:blImageCodecInitByName => [:pointer, :pointer, :ulong_long, :pointer],
|
174
|
+
:blImageCodecDestroy => [:pointer],
|
175
|
+
:blImageCodecReset => [:pointer],
|
176
|
+
:blImageCodecAssignMove => [:pointer, :pointer],
|
177
|
+
:blImageCodecAssignWeak => [:pointer, :pointer],
|
178
|
+
:blImageCodecFindByName => [:pointer, :pointer, :ulong_long, :pointer],
|
179
|
+
:blImageCodecFindByExtension => [:pointer, :pointer, :ulong_long, :pointer],
|
180
|
+
:blImageCodecFindByData => [:pointer, :pointer, :ulong_long, :pointer],
|
181
|
+
:blImageCodecInspectData => [:pointer, :pointer, :ulong_long],
|
182
|
+
:blImageCodecCreateDecoder => [:pointer, :pointer],
|
183
|
+
:blImageCodecCreateEncoder => [:pointer, :pointer],
|
184
|
+
:blImageCodecArrayInitBuiltInCodecs => [:pointer],
|
185
|
+
:blImageCodecArrayAssignBuiltInCodecs => [:pointer],
|
186
|
+
:blImageCodecAddToBuiltIn => [:pointer],
|
187
|
+
:blImageCodecRemoveFromBuiltIn => [:pointer],
|
188
|
+
}
|
189
|
+
retvals = {
|
190
|
+
:blImageCodecInit => :uint,
|
191
|
+
:blImageCodecInitMove => :uint,
|
192
|
+
:blImageCodecInitWeak => :uint,
|
193
|
+
:blImageCodecInitByName => :uint,
|
194
|
+
:blImageCodecDestroy => :uint,
|
195
|
+
:blImageCodecReset => :uint,
|
196
|
+
:blImageCodecAssignMove => :uint,
|
197
|
+
:blImageCodecAssignWeak => :uint,
|
198
|
+
:blImageCodecFindByName => :uint,
|
199
|
+
:blImageCodecFindByExtension => :uint,
|
200
|
+
:blImageCodecFindByData => :uint,
|
201
|
+
:blImageCodecInspectData => :uint,
|
202
|
+
:blImageCodecCreateDecoder => :uint,
|
203
|
+
:blImageCodecCreateEncoder => :uint,
|
204
|
+
:blImageCodecArrayInitBuiltInCodecs => :uint,
|
205
|
+
:blImageCodecArrayAssignBuiltInCodecs => :uint,
|
206
|
+
:blImageCodecAddToBuiltIn => :uint,
|
207
|
+
:blImageCodecRemoveFromBuiltIn => :uint,
|
208
|
+
}
|
209
|
+
symbols.each do |sym|
|
210
|
+
begin
|
211
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
212
|
+
rescue FFI::NotFoundError => error
|
213
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
|
@@ -0,0 +1,168 @@
|
|
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_imagecodec'
|
9
|
+
require_relative 'blend2d_object'
|
10
|
+
require_relative 'blend2d_string'
|
11
|
+
|
12
|
+
module Blend2D
|
13
|
+
extend FFI::Library
|
14
|
+
# Define/Macro
|
15
|
+
|
16
|
+
|
17
|
+
# Enum
|
18
|
+
|
19
|
+
|
20
|
+
# Typedef
|
21
|
+
|
22
|
+
|
23
|
+
# Struct
|
24
|
+
|
25
|
+
class BLImageDecoderCore < FFI::Struct
|
26
|
+
layout(
|
27
|
+
:_d, BLObjectDetail,
|
28
|
+
)
|
29
|
+
def _d = self[:_d]
|
30
|
+
def _d=(v) self[:_d] = v end
|
31
|
+
def init() = blImageDecoderInit(self)
|
32
|
+
def self.create()
|
33
|
+
instance = BLImageDecoderCore.new
|
34
|
+
blImageDecoderInit(instance)
|
35
|
+
instance
|
36
|
+
end
|
37
|
+
def initMove(other) = blImageDecoderInitMove(self, other)
|
38
|
+
def initWeak(other) = blImageDecoderInitWeak(self, other)
|
39
|
+
def destroy() = blImageDecoderDestroy(self)
|
40
|
+
def reset() = blImageDecoderReset(self)
|
41
|
+
def assignMove(other) = blImageDecoderAssignMove(self, other)
|
42
|
+
def assignWeak(other) = blImageDecoderAssignWeak(self, other)
|
43
|
+
def restart() = blImageDecoderRestart(self)
|
44
|
+
def readInfo(infoOut, data, size) = blImageDecoderReadInfo(self, infoOut, data, size)
|
45
|
+
def readFrame(imageOut, data, size) = blImageDecoderReadFrame(self, imageOut, data, size)
|
46
|
+
end
|
47
|
+
|
48
|
+
class BLImageDecoderVirt < FFI::Struct
|
49
|
+
layout(
|
50
|
+
:base, BLObjectVirtBase,
|
51
|
+
:restart, :pointer,
|
52
|
+
:readInfo, :pointer,
|
53
|
+
:readFrame, :pointer,
|
54
|
+
)
|
55
|
+
def base = self[:base]
|
56
|
+
def base=(v) self[:base] = v end
|
57
|
+
def restart = self[:restart]
|
58
|
+
def restart=(v) self[:restart] = v end
|
59
|
+
def readInfo = self[:readInfo]
|
60
|
+
def readInfo=(v) self[:readInfo] = v end
|
61
|
+
def readFrame = self[:readFrame]
|
62
|
+
def readFrame=(v) self[:readFrame] = v end
|
63
|
+
def self.create_as(_base_, _restart_, _readInfo_, _readFrame_)
|
64
|
+
instance = BLImageDecoderVirt.new
|
65
|
+
instance[:base] = _base_
|
66
|
+
instance[:restart] = _restart_
|
67
|
+
instance[:readInfo] = _readInfo_
|
68
|
+
instance[:readFrame] = _readFrame_
|
69
|
+
instance
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
class BLImageDecoderImpl < FFI::Struct
|
74
|
+
layout(
|
75
|
+
:virt, :pointer,
|
76
|
+
:codec, BLImageCodecCore,
|
77
|
+
:lastResult, :uint,
|
78
|
+
:handle, :pointer,
|
79
|
+
:frameIndex, :ulong_long,
|
80
|
+
:bufferIndex, :ulong_long,
|
81
|
+
)
|
82
|
+
def virt = self[:virt]
|
83
|
+
def virt=(v) self[:virt] = v end
|
84
|
+
def codec = self[:codec]
|
85
|
+
def codec=(v) self[:codec] = v end
|
86
|
+
def lastResult = self[:lastResult]
|
87
|
+
def lastResult=(v) self[:lastResult] = v end
|
88
|
+
def handle = self[:handle]
|
89
|
+
def handle=(v) self[:handle] = v end
|
90
|
+
def frameIndex = self[:frameIndex]
|
91
|
+
def frameIndex=(v) self[:frameIndex] = v end
|
92
|
+
def bufferIndex = self[:bufferIndex]
|
93
|
+
def bufferIndex=(v) self[:bufferIndex] = v end
|
94
|
+
def self.create_as(_virt_, _codec_, _lastResult_, _handle_, _frameIndex_, _bufferIndex_)
|
95
|
+
instance = BLImageDecoderImpl.new
|
96
|
+
instance[:virt] = _virt_
|
97
|
+
instance[:codec] = _codec_
|
98
|
+
instance[:lastResult] = _lastResult_
|
99
|
+
instance[:handle] = _handle_
|
100
|
+
instance[:frameIndex] = _frameIndex_
|
101
|
+
instance[:bufferIndex] = _bufferIndex_
|
102
|
+
instance
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
# Function
|
108
|
+
|
109
|
+
def self.setup_imagedecoder_symbols(output_error = false)
|
110
|
+
symbols = [
|
111
|
+
:blImageDecoderInit,
|
112
|
+
:blImageDecoderInitMove,
|
113
|
+
:blImageDecoderInitWeak,
|
114
|
+
:blImageDecoderDestroy,
|
115
|
+
:blImageDecoderReset,
|
116
|
+
:blImageDecoderAssignMove,
|
117
|
+
:blImageDecoderAssignWeak,
|
118
|
+
:blImageDecoderRestart,
|
119
|
+
:blImageDecoderReadInfo,
|
120
|
+
:blImageDecoderReadFrame,
|
121
|
+
]
|
122
|
+
apis = {
|
123
|
+
:blImageDecoderInit => :blImageDecoderInit,
|
124
|
+
:blImageDecoderInitMove => :blImageDecoderInitMove,
|
125
|
+
:blImageDecoderInitWeak => :blImageDecoderInitWeak,
|
126
|
+
:blImageDecoderDestroy => :blImageDecoderDestroy,
|
127
|
+
:blImageDecoderReset => :blImageDecoderReset,
|
128
|
+
:blImageDecoderAssignMove => :blImageDecoderAssignMove,
|
129
|
+
:blImageDecoderAssignWeak => :blImageDecoderAssignWeak,
|
130
|
+
:blImageDecoderRestart => :blImageDecoderRestart,
|
131
|
+
:blImageDecoderReadInfo => :blImageDecoderReadInfo,
|
132
|
+
:blImageDecoderReadFrame => :blImageDecoderReadFrame,
|
133
|
+
}
|
134
|
+
args = {
|
135
|
+
:blImageDecoderInit => [:pointer],
|
136
|
+
:blImageDecoderInitMove => [:pointer, :pointer],
|
137
|
+
:blImageDecoderInitWeak => [:pointer, :pointer],
|
138
|
+
:blImageDecoderDestroy => [:pointer],
|
139
|
+
:blImageDecoderReset => [:pointer],
|
140
|
+
:blImageDecoderAssignMove => [:pointer, :pointer],
|
141
|
+
:blImageDecoderAssignWeak => [:pointer, :pointer],
|
142
|
+
:blImageDecoderRestart => [:pointer],
|
143
|
+
:blImageDecoderReadInfo => [:pointer, :pointer, :pointer, :ulong_long],
|
144
|
+
:blImageDecoderReadFrame => [:pointer, :pointer, :pointer, :ulong_long],
|
145
|
+
}
|
146
|
+
retvals = {
|
147
|
+
:blImageDecoderInit => :uint,
|
148
|
+
:blImageDecoderInitMove => :uint,
|
149
|
+
:blImageDecoderInitWeak => :uint,
|
150
|
+
:blImageDecoderDestroy => :uint,
|
151
|
+
:blImageDecoderReset => :uint,
|
152
|
+
:blImageDecoderAssignMove => :uint,
|
153
|
+
:blImageDecoderAssignWeak => :uint,
|
154
|
+
:blImageDecoderRestart => :uint,
|
155
|
+
:blImageDecoderReadInfo => :uint,
|
156
|
+
:blImageDecoderReadFrame => :uint,
|
157
|
+
}
|
158
|
+
symbols.each do |sym|
|
159
|
+
begin
|
160
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
161
|
+
rescue FFI::NotFoundError => error
|
162
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
|