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,211 @@
|
|
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
|
+
|
10
|
+
module Blend2D
|
11
|
+
extend FFI::Library
|
12
|
+
# Define/Macro
|
13
|
+
|
14
|
+
|
15
|
+
# Enum
|
16
|
+
|
17
|
+
BL_FILE_INFO_OWNER_R = 256
|
18
|
+
BL_FILE_INFO_OWNER_W = 128
|
19
|
+
BL_FILE_INFO_OWNER_X = 64
|
20
|
+
BL_FILE_INFO_OWNER_MASK = 448
|
21
|
+
BL_FILE_INFO_GROUP_R = 32
|
22
|
+
BL_FILE_INFO_GROUP_W = 16
|
23
|
+
BL_FILE_INFO_GROUP_X = 8
|
24
|
+
BL_FILE_INFO_GROUP_MASK = 56
|
25
|
+
BL_FILE_INFO_OTHER_R = 4
|
26
|
+
BL_FILE_INFO_OTHER_W = 2
|
27
|
+
BL_FILE_INFO_OTHER_X = 1
|
28
|
+
BL_FILE_INFO_OTHER_MASK = 7
|
29
|
+
BL_FILE_INFO_SUID = 2048
|
30
|
+
BL_FILE_INFO_SGID = 1024
|
31
|
+
BL_FILE_INFO_PERMISSIONS_MASK = 4095
|
32
|
+
BL_FILE_INFO_REGULAR = 65536
|
33
|
+
BL_FILE_INFO_DIRECTORY = 131072
|
34
|
+
BL_FILE_INFO_SYMLINK = 262144
|
35
|
+
BL_FILE_INFO_CHAR_DEVICE = 1048576
|
36
|
+
BL_FILE_INFO_BLOCK_DEVICE = 2097152
|
37
|
+
BL_FILE_INFO_FIFO = 4194304
|
38
|
+
BL_FILE_INFO_SOCKET = 8388608
|
39
|
+
BL_FILE_INFO_HIDDEN = 16777216
|
40
|
+
BL_FILE_INFO_EXECUTABLE = 33554432
|
41
|
+
BL_FILE_INFO_ARCHIVE = 67108864
|
42
|
+
BL_FILE_INFO_SYSTEM = 134217728
|
43
|
+
BL_FILE_INFO_VALID = -2147483648
|
44
|
+
BL_FILE_INFO_FORCE_UINT = -1
|
45
|
+
BL_FILE_OPEN_NO_FLAGS = 0
|
46
|
+
BL_FILE_OPEN_READ = 1
|
47
|
+
BL_FILE_OPEN_WRITE = 2
|
48
|
+
BL_FILE_OPEN_RW = 3
|
49
|
+
BL_FILE_OPEN_CREATE = 4
|
50
|
+
BL_FILE_OPEN_DELETE = 8
|
51
|
+
BL_FILE_OPEN_TRUNCATE = 16
|
52
|
+
BL_FILE_OPEN_READ_EXCLUSIVE = 268435456
|
53
|
+
BL_FILE_OPEN_WRITE_EXCLUSIVE = 536870912
|
54
|
+
BL_FILE_OPEN_RW_EXCLUSIVE = 805306368
|
55
|
+
BL_FILE_OPEN_CREATE_EXCLUSIVE = 1073741824
|
56
|
+
BL_FILE_OPEN_DELETE_EXCLUSIVE = -2147483648
|
57
|
+
BL_FILE_OPEN_FORCE_UINT = -1
|
58
|
+
BL_FILE_SEEK_SET = 0
|
59
|
+
BL_FILE_SEEK_CUR = 1
|
60
|
+
BL_FILE_SEEK_END = 2
|
61
|
+
BL_FILE_SEEK_MAX_VALUE = 3
|
62
|
+
BL_FILE_SEEK_FORCE_UINT = -1
|
63
|
+
BL_FILE_READ_NO_FLAGS = 0
|
64
|
+
BL_FILE_READ_MMAP_ENABLED = 1
|
65
|
+
BL_FILE_READ_MMAP_AVOID_SMALL = 2
|
66
|
+
BL_FILE_READ_MMAP_NO_FALLBACK = 8
|
67
|
+
BL_FILE_READ_FORCE_UINT = -1
|
68
|
+
|
69
|
+
# Typedef
|
70
|
+
|
71
|
+
typedef :int, :BLFileInfoFlags
|
72
|
+
typedef :int, :BLFileOpenFlags
|
73
|
+
typedef :int, :BLFileSeekType
|
74
|
+
typedef :int, :BLFileReadFlags
|
75
|
+
|
76
|
+
# Struct
|
77
|
+
|
78
|
+
class BLFileCore < FFI::Struct
|
79
|
+
layout(
|
80
|
+
:handle, :int64,
|
81
|
+
)
|
82
|
+
def handle = self[:handle]
|
83
|
+
def handle=(v) self[:handle] = v end
|
84
|
+
def init() = blFileInit(self)
|
85
|
+
def self.create()
|
86
|
+
instance = BLFileCore.new
|
87
|
+
blFileInit(instance)
|
88
|
+
instance
|
89
|
+
end
|
90
|
+
def reset() = blFileReset(self)
|
91
|
+
def open(fileName, openFlags) = blFileOpen(self, fileName, openFlags)
|
92
|
+
def close() = blFileClose(self)
|
93
|
+
def seek(offset, seekType, positionOut) = blFileSeek(self, offset, seekType, positionOut)
|
94
|
+
def read(buffer, n, bytesReadOut) = blFileRead(self, buffer, n, bytesReadOut)
|
95
|
+
def write(buffer, n, bytesWrittenOut) = blFileWrite(self, buffer, n, bytesWrittenOut)
|
96
|
+
def truncate(maxSize) = blFileTruncate(self, maxSize)
|
97
|
+
def getInfo(infoOut) = blFileGetInfo(self, infoOut)
|
98
|
+
def getSize(fileSizeOut) = blFileGetSize(self, fileSizeOut)
|
99
|
+
def systemGetInfo(infoOut) = blFileSystemGetInfo(fileName, infoOut)
|
100
|
+
def systemReadFile(dst, maxSize, readFlags) = blFileSystemReadFile(fileName, dst, maxSize, readFlags)
|
101
|
+
def systemWriteFile(data, size, bytesWrittenOut) = blFileSystemWriteFile(fileName, data, size, bytesWrittenOut)
|
102
|
+
end
|
103
|
+
|
104
|
+
class BLFileInfo < FFI::Struct
|
105
|
+
layout(
|
106
|
+
:size, :ulong_long,
|
107
|
+
:modifiedTime, :long_long,
|
108
|
+
:flags, :int,
|
109
|
+
:uid, :uint,
|
110
|
+
:gid, :uint,
|
111
|
+
:reserved, [:uint, 5],
|
112
|
+
)
|
113
|
+
def size = self[:size]
|
114
|
+
def size=(v) self[:size] = v end
|
115
|
+
def modifiedTime = self[:modifiedTime]
|
116
|
+
def modifiedTime=(v) self[:modifiedTime] = v end
|
117
|
+
def flags = self[:flags]
|
118
|
+
def flags=(v) self[:flags] = v end
|
119
|
+
def uid = self[:uid]
|
120
|
+
def uid=(v) self[:uid] = v end
|
121
|
+
def gid = self[:gid]
|
122
|
+
def gid=(v) self[:gid] = v end
|
123
|
+
def reserved = self[:reserved]
|
124
|
+
def reserved=(v) self[:reserved] = v end
|
125
|
+
def self.create_as(_size_, _modifiedTime_, _flags_, _uid_, _gid_, _reserved_)
|
126
|
+
instance = BLFileInfo.new
|
127
|
+
instance[:size] = _size_
|
128
|
+
instance[:modifiedTime] = _modifiedTime_
|
129
|
+
instance[:flags] = _flags_
|
130
|
+
instance[:uid] = _uid_
|
131
|
+
instance[:gid] = _gid_
|
132
|
+
instance[:reserved] = _reserved_
|
133
|
+
instance
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
|
138
|
+
# Function
|
139
|
+
|
140
|
+
def self.setup_filesystem_symbols(output_error = false)
|
141
|
+
symbols = [
|
142
|
+
:blFileInit,
|
143
|
+
:blFileReset,
|
144
|
+
:blFileOpen,
|
145
|
+
:blFileClose,
|
146
|
+
:blFileSeek,
|
147
|
+
:blFileRead,
|
148
|
+
:blFileWrite,
|
149
|
+
:blFileTruncate,
|
150
|
+
:blFileGetInfo,
|
151
|
+
:blFileGetSize,
|
152
|
+
:blFileSystemGetInfo,
|
153
|
+
:blFileSystemReadFile,
|
154
|
+
:blFileSystemWriteFile,
|
155
|
+
]
|
156
|
+
apis = {
|
157
|
+
:blFileInit => :blFileInit,
|
158
|
+
:blFileReset => :blFileReset,
|
159
|
+
:blFileOpen => :blFileOpen,
|
160
|
+
:blFileClose => :blFileClose,
|
161
|
+
:blFileSeek => :blFileSeek,
|
162
|
+
:blFileRead => :blFileRead,
|
163
|
+
:blFileWrite => :blFileWrite,
|
164
|
+
:blFileTruncate => :blFileTruncate,
|
165
|
+
:blFileGetInfo => :blFileGetInfo,
|
166
|
+
:blFileGetSize => :blFileGetSize,
|
167
|
+
:blFileSystemGetInfo => :blFileSystemGetInfo,
|
168
|
+
:blFileSystemReadFile => :blFileSystemReadFile,
|
169
|
+
:blFileSystemWriteFile => :blFileSystemWriteFile,
|
170
|
+
}
|
171
|
+
args = {
|
172
|
+
:blFileInit => [:pointer],
|
173
|
+
:blFileReset => [:pointer],
|
174
|
+
:blFileOpen => [:pointer, :pointer, :int],
|
175
|
+
:blFileClose => [:pointer],
|
176
|
+
:blFileSeek => [:pointer, :long_long, :int, :pointer],
|
177
|
+
:blFileRead => [:pointer, :pointer, :ulong_long, :pointer],
|
178
|
+
:blFileWrite => [:pointer, :pointer, :ulong_long, :pointer],
|
179
|
+
:blFileTruncate => [:pointer, :long_long],
|
180
|
+
:blFileGetInfo => [:pointer, :pointer],
|
181
|
+
:blFileGetSize => [:pointer, :pointer],
|
182
|
+
:blFileSystemGetInfo => [:pointer, :pointer],
|
183
|
+
:blFileSystemReadFile => [:pointer, :pointer, :ulong_long, :int],
|
184
|
+
:blFileSystemWriteFile => [:pointer, :pointer, :ulong_long, :pointer],
|
185
|
+
}
|
186
|
+
retvals = {
|
187
|
+
:blFileInit => :uint,
|
188
|
+
:blFileReset => :uint,
|
189
|
+
:blFileOpen => :uint,
|
190
|
+
:blFileClose => :uint,
|
191
|
+
:blFileSeek => :uint,
|
192
|
+
:blFileRead => :uint,
|
193
|
+
:blFileWrite => :uint,
|
194
|
+
:blFileTruncate => :uint,
|
195
|
+
:blFileGetInfo => :uint,
|
196
|
+
:blFileGetSize => :uint,
|
197
|
+
:blFileSystemGetInfo => :uint,
|
198
|
+
:blFileSystemReadFile => :uint,
|
199
|
+
:blFileSystemWriteFile => :uint,
|
200
|
+
}
|
201
|
+
symbols.each do |sym|
|
202
|
+
begin
|
203
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
204
|
+
rescue FFI::NotFoundError => error
|
205
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
211
|
+
|
data/lib/blend2d_font.rb
ADDED
@@ -0,0 +1,281 @@
|
|
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_fontface'
|
14
|
+
require_relative 'blend2d_fontfeaturesettings'
|
15
|
+
require_relative 'blend2d_fontvariationsettings'
|
16
|
+
require_relative 'blend2d_geometry'
|
17
|
+
require_relative 'blend2d_glyphbuffer'
|
18
|
+
require_relative 'blend2d_glyphrun'
|
19
|
+
require_relative 'blend2d_object'
|
20
|
+
require_relative 'blend2d_path'
|
21
|
+
require_relative 'blend2d_string'
|
22
|
+
|
23
|
+
module Blend2D
|
24
|
+
extend FFI::Library
|
25
|
+
# Define/Macro
|
26
|
+
|
27
|
+
|
28
|
+
# Enum
|
29
|
+
|
30
|
+
|
31
|
+
# Typedef
|
32
|
+
|
33
|
+
|
34
|
+
# Struct
|
35
|
+
|
36
|
+
class BLFontCore < FFI::Struct
|
37
|
+
layout(
|
38
|
+
:_d, BLObjectDetail,
|
39
|
+
)
|
40
|
+
def _d = self[:_d]
|
41
|
+
def _d=(v) self[:_d] = v end
|
42
|
+
def init() = blFontInit(self)
|
43
|
+
def self.create()
|
44
|
+
instance = BLFontCore.new
|
45
|
+
blFontInit(instance)
|
46
|
+
instance
|
47
|
+
end
|
48
|
+
def initMove(other) = blFontInitMove(self, other)
|
49
|
+
def initWeak(other) = blFontInitWeak(self, other)
|
50
|
+
def destroy() = blFontDestroy(self)
|
51
|
+
def reset() = blFontReset(self)
|
52
|
+
def assignMove(other) = blFontAssignMove(self, other)
|
53
|
+
def assignWeak(other) = blFontAssignWeak(self, other)
|
54
|
+
def equals(b) = blFontEquals(a, b)
|
55
|
+
def createFromFace(face, size) = blFontCreateFromFace(self, face, size)
|
56
|
+
def createFromFaceWithSettings(face, size, featureSettings, variationSettings) = blFontCreateFromFaceWithSettings(self, face, size, featureSettings, variationSettings)
|
57
|
+
def getFace(out) = blFontGetFace(self, out)
|
58
|
+
def getSize() = blFontGetSize(self)
|
59
|
+
def setSize(size) = blFontSetSize(self, size)
|
60
|
+
def getMetrics(out) = blFontGetMetrics(self, out)
|
61
|
+
def getMatrix(out) = blFontGetMatrix(self, out)
|
62
|
+
def getDesignMetrics(out) = blFontGetDesignMetrics(self, out)
|
63
|
+
def getFeatureSettings(out) = blFontGetFeatureSettings(self, out)
|
64
|
+
def setFeatureSettings(featureSettings) = blFontSetFeatureSettings(self, featureSettings)
|
65
|
+
def resetFeatureSettings() = blFontResetFeatureSettings(self)
|
66
|
+
def getVariationSettings(out) = blFontGetVariationSettings(self, out)
|
67
|
+
def setVariationSettings(variationSettings) = blFontSetVariationSettings(self, variationSettings)
|
68
|
+
def resetVariationSettings() = blFontResetVariationSettings(self)
|
69
|
+
def shape(gb) = blFontShape(self, gb)
|
70
|
+
def mapTextToGlyphs(gb, stateOut) = blFontMapTextToGlyphs(self, gb, stateOut)
|
71
|
+
def positionGlyphs(gb) = blFontPositionGlyphs(self, gb)
|
72
|
+
def applyKerning(gb) = blFontApplyKerning(self, gb)
|
73
|
+
def applyGSub(gb, lookups) = blFontApplyGSub(self, gb, lookups)
|
74
|
+
def applyGPos(gb, lookups) = blFontApplyGPos(self, gb, lookups)
|
75
|
+
def getTextMetrics(gb, out) = blFontGetTextMetrics(self, gb, out)
|
76
|
+
def getGlyphBounds(glyphData, glyphAdvance, out, count) = blFontGetGlyphBounds(self, glyphData, glyphAdvance, out, count)
|
77
|
+
def getGlyphAdvances(glyphData, glyphAdvance, out, count) = blFontGetGlyphAdvances(self, glyphData, glyphAdvance, out, count)
|
78
|
+
def getGlyphOutlines(glyphId, userTransform, out, sink, userData) = blFontGetGlyphOutlines(self, glyphId, userTransform, out, sink, userData)
|
79
|
+
def getGlyphRunOutlines(glyphRun, userTransform, out, sink, userData) = blFontGetGlyphRunOutlines(self, glyphRun, userTransform, out, sink, userData)
|
80
|
+
end
|
81
|
+
|
82
|
+
class BLFontImpl < FFI::Struct
|
83
|
+
layout(
|
84
|
+
:face, BLFontFaceCore,
|
85
|
+
:weight, :ushort,
|
86
|
+
:stretch, :uchar,
|
87
|
+
:style, :uchar,
|
88
|
+
:reserved, :uint,
|
89
|
+
:metrics, BLFontMetrics,
|
90
|
+
:matrix, BLFontMatrix,
|
91
|
+
:featureSettings, BLFontFeatureSettingsCore,
|
92
|
+
:variationSettings, BLFontVariationSettingsCore,
|
93
|
+
)
|
94
|
+
def face = self[:face]
|
95
|
+
def face=(v) self[:face] = v end
|
96
|
+
def weight = self[:weight]
|
97
|
+
def weight=(v) self[:weight] = v end
|
98
|
+
def stretch = self[:stretch]
|
99
|
+
def stretch=(v) self[:stretch] = v end
|
100
|
+
def style = self[:style]
|
101
|
+
def style=(v) self[:style] = v end
|
102
|
+
def reserved = self[:reserved]
|
103
|
+
def reserved=(v) self[:reserved] = v end
|
104
|
+
def metrics = self[:metrics]
|
105
|
+
def metrics=(v) self[:metrics] = v end
|
106
|
+
def matrix = self[:matrix]
|
107
|
+
def matrix=(v) self[:matrix] = v end
|
108
|
+
def featureSettings = self[:featureSettings]
|
109
|
+
def featureSettings=(v) self[:featureSettings] = v end
|
110
|
+
def variationSettings = self[:variationSettings]
|
111
|
+
def variationSettings=(v) self[:variationSettings] = v end
|
112
|
+
def self.create_as(_face_, _weight_, _stretch_, _style_, _reserved_, _metrics_, _matrix_, _featureSettings_, _variationSettings_)
|
113
|
+
instance = BLFontImpl.new
|
114
|
+
instance[:face] = _face_
|
115
|
+
instance[:weight] = _weight_
|
116
|
+
instance[:stretch] = _stretch_
|
117
|
+
instance[:style] = _style_
|
118
|
+
instance[:reserved] = _reserved_
|
119
|
+
instance[:metrics] = _metrics_
|
120
|
+
instance[:matrix] = _matrix_
|
121
|
+
instance[:featureSettings] = _featureSettings_
|
122
|
+
instance[:variationSettings] = _variationSettings_
|
123
|
+
instance
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
# Function
|
129
|
+
|
130
|
+
def self.setup_font_symbols(output_error = false)
|
131
|
+
symbols = [
|
132
|
+
:blFontInit,
|
133
|
+
:blFontInitMove,
|
134
|
+
:blFontInitWeak,
|
135
|
+
:blFontDestroy,
|
136
|
+
:blFontReset,
|
137
|
+
:blFontAssignMove,
|
138
|
+
:blFontAssignWeak,
|
139
|
+
:blFontEquals,
|
140
|
+
:blFontCreateFromFace,
|
141
|
+
:blFontCreateFromFaceWithSettings,
|
142
|
+
:blFontGetFace,
|
143
|
+
:blFontGetSize,
|
144
|
+
:blFontSetSize,
|
145
|
+
:blFontGetMetrics,
|
146
|
+
:blFontGetMatrix,
|
147
|
+
:blFontGetDesignMetrics,
|
148
|
+
:blFontGetFeatureSettings,
|
149
|
+
:blFontSetFeatureSettings,
|
150
|
+
:blFontResetFeatureSettings,
|
151
|
+
:blFontGetVariationSettings,
|
152
|
+
:blFontSetVariationSettings,
|
153
|
+
:blFontResetVariationSettings,
|
154
|
+
:blFontShape,
|
155
|
+
:blFontMapTextToGlyphs,
|
156
|
+
:blFontPositionGlyphs,
|
157
|
+
:blFontApplyKerning,
|
158
|
+
:blFontApplyGSub,
|
159
|
+
:blFontApplyGPos,
|
160
|
+
:blFontGetTextMetrics,
|
161
|
+
:blFontGetGlyphBounds,
|
162
|
+
:blFontGetGlyphAdvances,
|
163
|
+
:blFontGetGlyphOutlines,
|
164
|
+
:blFontGetGlyphRunOutlines,
|
165
|
+
]
|
166
|
+
apis = {
|
167
|
+
:blFontInit => :blFontInit,
|
168
|
+
:blFontInitMove => :blFontInitMove,
|
169
|
+
:blFontInitWeak => :blFontInitWeak,
|
170
|
+
:blFontDestroy => :blFontDestroy,
|
171
|
+
:blFontReset => :blFontReset,
|
172
|
+
:blFontAssignMove => :blFontAssignMove,
|
173
|
+
:blFontAssignWeak => :blFontAssignWeak,
|
174
|
+
:blFontEquals => :blFontEquals,
|
175
|
+
:blFontCreateFromFace => :blFontCreateFromFace,
|
176
|
+
:blFontCreateFromFaceWithSettings => :blFontCreateFromFaceWithSettings,
|
177
|
+
:blFontGetFace => :blFontGetFace,
|
178
|
+
:blFontGetSize => :blFontGetSize,
|
179
|
+
:blFontSetSize => :blFontSetSize,
|
180
|
+
:blFontGetMetrics => :blFontGetMetrics,
|
181
|
+
:blFontGetMatrix => :blFontGetMatrix,
|
182
|
+
:blFontGetDesignMetrics => :blFontGetDesignMetrics,
|
183
|
+
:blFontGetFeatureSettings => :blFontGetFeatureSettings,
|
184
|
+
:blFontSetFeatureSettings => :blFontSetFeatureSettings,
|
185
|
+
:blFontResetFeatureSettings => :blFontResetFeatureSettings,
|
186
|
+
:blFontGetVariationSettings => :blFontGetVariationSettings,
|
187
|
+
:blFontSetVariationSettings => :blFontSetVariationSettings,
|
188
|
+
:blFontResetVariationSettings => :blFontResetVariationSettings,
|
189
|
+
:blFontShape => :blFontShape,
|
190
|
+
:blFontMapTextToGlyphs => :blFontMapTextToGlyphs,
|
191
|
+
:blFontPositionGlyphs => :blFontPositionGlyphs,
|
192
|
+
:blFontApplyKerning => :blFontApplyKerning,
|
193
|
+
:blFontApplyGSub => :blFontApplyGSub,
|
194
|
+
:blFontApplyGPos => :blFontApplyGPos,
|
195
|
+
:blFontGetTextMetrics => :blFontGetTextMetrics,
|
196
|
+
:blFontGetGlyphBounds => :blFontGetGlyphBounds,
|
197
|
+
:blFontGetGlyphAdvances => :blFontGetGlyphAdvances,
|
198
|
+
:blFontGetGlyphOutlines => :blFontGetGlyphOutlines,
|
199
|
+
:blFontGetGlyphRunOutlines => :blFontGetGlyphRunOutlines,
|
200
|
+
}
|
201
|
+
args = {
|
202
|
+
:blFontInit => [:pointer],
|
203
|
+
:blFontInitMove => [:pointer, :pointer],
|
204
|
+
:blFontInitWeak => [:pointer, :pointer],
|
205
|
+
:blFontDestroy => [:pointer],
|
206
|
+
:blFontReset => [:pointer],
|
207
|
+
:blFontAssignMove => [:pointer, :pointer],
|
208
|
+
:blFontAssignWeak => [:pointer, :pointer],
|
209
|
+
:blFontEquals => [:pointer, :pointer],
|
210
|
+
:blFontCreateFromFace => [:pointer, :pointer, :float],
|
211
|
+
:blFontCreateFromFaceWithSettings => [:pointer, :pointer, :float, :pointer, :pointer],
|
212
|
+
:blFontGetFace => [:pointer, :pointer],
|
213
|
+
:blFontGetSize => [:pointer],
|
214
|
+
:blFontSetSize => [:pointer, :float],
|
215
|
+
:blFontGetMetrics => [:pointer, :pointer],
|
216
|
+
:blFontGetMatrix => [:pointer, :pointer],
|
217
|
+
:blFontGetDesignMetrics => [:pointer, :pointer],
|
218
|
+
:blFontGetFeatureSettings => [:pointer, :pointer],
|
219
|
+
:blFontSetFeatureSettings => [:pointer, :pointer],
|
220
|
+
:blFontResetFeatureSettings => [:pointer],
|
221
|
+
:blFontGetVariationSettings => [:pointer, :pointer],
|
222
|
+
:blFontSetVariationSettings => [:pointer, :pointer],
|
223
|
+
:blFontResetVariationSettings => [:pointer],
|
224
|
+
:blFontShape => [:pointer, :pointer],
|
225
|
+
:blFontMapTextToGlyphs => [:pointer, :pointer, :pointer],
|
226
|
+
:blFontPositionGlyphs => [:pointer, :pointer],
|
227
|
+
:blFontApplyKerning => [:pointer, :pointer],
|
228
|
+
:blFontApplyGSub => [:pointer, :pointer, :pointer],
|
229
|
+
:blFontApplyGPos => [:pointer, :pointer, :pointer],
|
230
|
+
:blFontGetTextMetrics => [:pointer, :pointer, :pointer],
|
231
|
+
:blFontGetGlyphBounds => [:pointer, :pointer, :int64, :pointer, :ulong_long],
|
232
|
+
:blFontGetGlyphAdvances => [:pointer, :pointer, :int64, :pointer, :ulong_long],
|
233
|
+
:blFontGetGlyphOutlines => [:pointer, :uint, :pointer, :pointer, :BLPathSinkFunc, :pointer],
|
234
|
+
:blFontGetGlyphRunOutlines => [:pointer, :pointer, :pointer, :pointer, :BLPathSinkFunc, :pointer],
|
235
|
+
}
|
236
|
+
retvals = {
|
237
|
+
:blFontInit => :uint,
|
238
|
+
:blFontInitMove => :uint,
|
239
|
+
:blFontInitWeak => :uint,
|
240
|
+
:blFontDestroy => :uint,
|
241
|
+
:blFontReset => :uint,
|
242
|
+
:blFontAssignMove => :uint,
|
243
|
+
:blFontAssignWeak => :uint,
|
244
|
+
:blFontEquals => :bool,
|
245
|
+
:blFontCreateFromFace => :uint,
|
246
|
+
:blFontCreateFromFaceWithSettings => :uint,
|
247
|
+
:blFontGetFace => :uint,
|
248
|
+
:blFontGetSize => :float,
|
249
|
+
:blFontSetSize => :uint,
|
250
|
+
:blFontGetMetrics => :uint,
|
251
|
+
:blFontGetMatrix => :uint,
|
252
|
+
:blFontGetDesignMetrics => :uint,
|
253
|
+
:blFontGetFeatureSettings => :uint,
|
254
|
+
:blFontSetFeatureSettings => :uint,
|
255
|
+
:blFontResetFeatureSettings => :uint,
|
256
|
+
:blFontGetVariationSettings => :uint,
|
257
|
+
:blFontSetVariationSettings => :uint,
|
258
|
+
:blFontResetVariationSettings => :uint,
|
259
|
+
:blFontShape => :uint,
|
260
|
+
:blFontMapTextToGlyphs => :uint,
|
261
|
+
:blFontPositionGlyphs => :uint,
|
262
|
+
:blFontApplyKerning => :uint,
|
263
|
+
:blFontApplyGSub => :uint,
|
264
|
+
:blFontApplyGPos => :uint,
|
265
|
+
:blFontGetTextMetrics => :uint,
|
266
|
+
:blFontGetGlyphBounds => :uint,
|
267
|
+
:blFontGetGlyphAdvances => :uint,
|
268
|
+
:blFontGetGlyphOutlines => :uint,
|
269
|
+
:blFontGetGlyphRunOutlines => :uint,
|
270
|
+
}
|
271
|
+
symbols.each do |sym|
|
272
|
+
begin
|
273
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
274
|
+
rescue FFI::NotFoundError => error
|
275
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
end
|
281
|
+
|
@@ -0,0 +1,209 @@
|
|
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_filesystem'
|
10
|
+
require_relative 'blend2d_fontdefs'
|
11
|
+
require_relative 'blend2d_object'
|
12
|
+
require_relative 'blend2d_string'
|
13
|
+
|
14
|
+
module Blend2D
|
15
|
+
extend FFI::Library
|
16
|
+
# Define/Macro
|
17
|
+
|
18
|
+
|
19
|
+
# Enum
|
20
|
+
|
21
|
+
BL_FONT_DATA_NO_FLAGS = 0
|
22
|
+
BL_FONT_DATA_FLAG_COLLECTION = 1
|
23
|
+
BL_FONT_DATA_FLAG_FORCE_UINT = -1
|
24
|
+
|
25
|
+
# Typedef
|
26
|
+
|
27
|
+
typedef :int, :BLFontDataFlags
|
28
|
+
|
29
|
+
# Struct
|
30
|
+
|
31
|
+
class BLFontTable < FFI::Struct
|
32
|
+
layout(
|
33
|
+
:data, :pointer,
|
34
|
+
:size, :ulong_long,
|
35
|
+
)
|
36
|
+
def data = self[:data]
|
37
|
+
def data=(v) self[:data] = v end
|
38
|
+
def size = self[:size]
|
39
|
+
def size=(v) self[:size] = v end
|
40
|
+
def self.create_as(_data_, _size_)
|
41
|
+
instance = BLFontTable.new
|
42
|
+
instance[:data] = _data_
|
43
|
+
instance[:size] = _size_
|
44
|
+
instance
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class BLFontDataCore < FFI::Struct
|
49
|
+
layout(
|
50
|
+
:_d, BLObjectDetail,
|
51
|
+
)
|
52
|
+
def _d = self[:_d]
|
53
|
+
def _d=(v) self[:_d] = v end
|
54
|
+
def init() = blFontDataInit(self)
|
55
|
+
def self.create()
|
56
|
+
instance = BLFontDataCore.new
|
57
|
+
blFontDataInit(instance)
|
58
|
+
instance
|
59
|
+
end
|
60
|
+
def initMove(other) = blFontDataInitMove(self, other)
|
61
|
+
def initWeak(other) = blFontDataInitWeak(self, other)
|
62
|
+
def destroy() = blFontDataDestroy(self)
|
63
|
+
def reset() = blFontDataReset(self)
|
64
|
+
def assignMove(other) = blFontDataAssignMove(self, other)
|
65
|
+
def assignWeak(other) = blFontDataAssignWeak(self, other)
|
66
|
+
def createFromFile(fileName, readFlags) = blFontDataCreateFromFile(self, fileName, readFlags)
|
67
|
+
def createFromDataArray(dataArray) = blFontDataCreateFromDataArray(self, dataArray)
|
68
|
+
def createFromData(data, dataSize, destroyFunc, userData) = blFontDataCreateFromData(self, data, dataSize, destroyFunc, userData)
|
69
|
+
def equals(b) = blFontDataEquals(a, b)
|
70
|
+
def getFaceCount() = blFontDataGetFaceCount(self)
|
71
|
+
def getFaceType() = blFontDataGetFaceType(self)
|
72
|
+
def getFlags() = blFontDataGetFlags(self)
|
73
|
+
def getTableTags(faceIndex, dst) = blFontDataGetTableTags(self, faceIndex, dst)
|
74
|
+
def getTables(faceIndex, dst, tags, count) = blFontDataGetTables(self, faceIndex, dst, tags, count)
|
75
|
+
end
|
76
|
+
|
77
|
+
class BLFontDataVirt < FFI::Struct
|
78
|
+
layout(
|
79
|
+
:base, BLObjectVirtBase,
|
80
|
+
:getTableTags, :pointer,
|
81
|
+
:getTables, :pointer,
|
82
|
+
)
|
83
|
+
def base = self[:base]
|
84
|
+
def base=(v) self[:base] = v end
|
85
|
+
def getTableTags = self[:getTableTags]
|
86
|
+
def getTableTags=(v) self[:getTableTags] = v end
|
87
|
+
def getTables = self[:getTables]
|
88
|
+
def getTables=(v) self[:getTables] = v end
|
89
|
+
def self.create_as(_base_, _getTableTags_, _getTables_)
|
90
|
+
instance = BLFontDataVirt.new
|
91
|
+
instance[:base] = _base_
|
92
|
+
instance[:getTableTags] = _getTableTags_
|
93
|
+
instance[:getTables] = _getTables_
|
94
|
+
instance
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class BLFontDataImpl < FFI::Struct
|
99
|
+
layout(
|
100
|
+
:virt, :pointer,
|
101
|
+
:faceType, :uchar,
|
102
|
+
:faceCount, :uint,
|
103
|
+
:flags, :uint,
|
104
|
+
)
|
105
|
+
def virt = self[:virt]
|
106
|
+
def virt=(v) self[:virt] = v end
|
107
|
+
def faceType = self[:faceType]
|
108
|
+
def faceType=(v) self[:faceType] = v end
|
109
|
+
def faceCount = self[:faceCount]
|
110
|
+
def faceCount=(v) self[:faceCount] = v end
|
111
|
+
def flags = self[:flags]
|
112
|
+
def flags=(v) self[:flags] = v end
|
113
|
+
def self.create_as(_virt_, _faceType_, _faceCount_, _flags_)
|
114
|
+
instance = BLFontDataImpl.new
|
115
|
+
instance[:virt] = _virt_
|
116
|
+
instance[:faceType] = _faceType_
|
117
|
+
instance[:faceCount] = _faceCount_
|
118
|
+
instance[:flags] = _flags_
|
119
|
+
instance
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
# Function
|
125
|
+
|
126
|
+
def self.setup_fontdata_symbols(output_error = false)
|
127
|
+
symbols = [
|
128
|
+
:blFontDataInit,
|
129
|
+
:blFontDataInitMove,
|
130
|
+
:blFontDataInitWeak,
|
131
|
+
:blFontDataDestroy,
|
132
|
+
:blFontDataReset,
|
133
|
+
:blFontDataAssignMove,
|
134
|
+
:blFontDataAssignWeak,
|
135
|
+
:blFontDataCreateFromFile,
|
136
|
+
:blFontDataCreateFromDataArray,
|
137
|
+
:blFontDataCreateFromData,
|
138
|
+
:blFontDataEquals,
|
139
|
+
:blFontDataGetFaceCount,
|
140
|
+
:blFontDataGetFaceType,
|
141
|
+
:blFontDataGetFlags,
|
142
|
+
:blFontDataGetTableTags,
|
143
|
+
:blFontDataGetTables,
|
144
|
+
]
|
145
|
+
apis = {
|
146
|
+
:blFontDataInit => :blFontDataInit,
|
147
|
+
:blFontDataInitMove => :blFontDataInitMove,
|
148
|
+
:blFontDataInitWeak => :blFontDataInitWeak,
|
149
|
+
:blFontDataDestroy => :blFontDataDestroy,
|
150
|
+
:blFontDataReset => :blFontDataReset,
|
151
|
+
:blFontDataAssignMove => :blFontDataAssignMove,
|
152
|
+
:blFontDataAssignWeak => :blFontDataAssignWeak,
|
153
|
+
:blFontDataCreateFromFile => :blFontDataCreateFromFile,
|
154
|
+
:blFontDataCreateFromDataArray => :blFontDataCreateFromDataArray,
|
155
|
+
:blFontDataCreateFromData => :blFontDataCreateFromData,
|
156
|
+
:blFontDataEquals => :blFontDataEquals,
|
157
|
+
:blFontDataGetFaceCount => :blFontDataGetFaceCount,
|
158
|
+
:blFontDataGetFaceType => :blFontDataGetFaceType,
|
159
|
+
:blFontDataGetFlags => :blFontDataGetFlags,
|
160
|
+
:blFontDataGetTableTags => :blFontDataGetTableTags,
|
161
|
+
:blFontDataGetTables => :blFontDataGetTables,
|
162
|
+
}
|
163
|
+
args = {
|
164
|
+
:blFontDataInit => [:pointer],
|
165
|
+
:blFontDataInitMove => [:pointer, :pointer],
|
166
|
+
:blFontDataInitWeak => [:pointer, :pointer],
|
167
|
+
:blFontDataDestroy => [:pointer],
|
168
|
+
:blFontDataReset => [:pointer],
|
169
|
+
:blFontDataAssignMove => [:pointer, :pointer],
|
170
|
+
:blFontDataAssignWeak => [:pointer, :pointer],
|
171
|
+
:blFontDataCreateFromFile => [:pointer, :pointer, :int],
|
172
|
+
:blFontDataCreateFromDataArray => [:pointer, :pointer],
|
173
|
+
:blFontDataCreateFromData => [:pointer, :pointer, :ulong_long, :BLDestroyExternalDataFunc, :pointer],
|
174
|
+
:blFontDataEquals => [:pointer, :pointer],
|
175
|
+
:blFontDataGetFaceCount => [:pointer],
|
176
|
+
:blFontDataGetFaceType => [:pointer],
|
177
|
+
:blFontDataGetFlags => [:pointer],
|
178
|
+
:blFontDataGetTableTags => [:pointer, :uint, :pointer],
|
179
|
+
:blFontDataGetTables => [:pointer, :uint, :pointer, :pointer, :ulong_long],
|
180
|
+
}
|
181
|
+
retvals = {
|
182
|
+
:blFontDataInit => :uint,
|
183
|
+
:blFontDataInitMove => :uint,
|
184
|
+
:blFontDataInitWeak => :uint,
|
185
|
+
:blFontDataDestroy => :uint,
|
186
|
+
:blFontDataReset => :uint,
|
187
|
+
:blFontDataAssignMove => :uint,
|
188
|
+
:blFontDataAssignWeak => :uint,
|
189
|
+
:blFontDataCreateFromFile => :uint,
|
190
|
+
:blFontDataCreateFromDataArray => :uint,
|
191
|
+
:blFontDataCreateFromData => :uint,
|
192
|
+
:blFontDataEquals => :bool,
|
193
|
+
:blFontDataGetFaceCount => :uint,
|
194
|
+
:blFontDataGetFaceType => :int,
|
195
|
+
:blFontDataGetFlags => :int,
|
196
|
+
:blFontDataGetTableTags => :uint,
|
197
|
+
:blFontDataGetTables => :ulong_long,
|
198
|
+
}
|
199
|
+
symbols.each do |sym|
|
200
|
+
begin
|
201
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
202
|
+
rescue FFI::NotFoundError => error
|
203
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
end
|
209
|
+
|