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,187 @@
|
|
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_font'
|
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 BLFontManagerCore < FFI::Struct
|
26
|
+
layout(
|
27
|
+
:_d, BLObjectDetail,
|
28
|
+
)
|
29
|
+
def _d = self[:_d]
|
30
|
+
def _d=(v) self[:_d] = v end
|
31
|
+
def init() = blFontManagerInit(self)
|
32
|
+
def self.create()
|
33
|
+
instance = BLFontManagerCore.new
|
34
|
+
blFontManagerInit(instance)
|
35
|
+
instance
|
36
|
+
end
|
37
|
+
def initMove(other) = blFontManagerInitMove(self, other)
|
38
|
+
def initWeak(other) = blFontManagerInitWeak(self, other)
|
39
|
+
def initNew() = blFontManagerInitNew(self)
|
40
|
+
def destroy() = blFontManagerDestroy(self)
|
41
|
+
def reset() = blFontManagerReset(self)
|
42
|
+
def assignMove(other) = blFontManagerAssignMove(self, other)
|
43
|
+
def assignWeak(other) = blFontManagerAssignWeak(self, other)
|
44
|
+
def create() = blFontManagerCreate(self)
|
45
|
+
def getFaceCount() = blFontManagerGetFaceCount(self)
|
46
|
+
def getFamilyCount() = blFontManagerGetFamilyCount(self)
|
47
|
+
def hasFace(face) = blFontManagerHasFace(self, face)
|
48
|
+
def addFace(face) = blFontManagerAddFace(self, face)
|
49
|
+
def queryFace(name, nameSize, properties, out) = blFontManagerQueryFace(self, name, nameSize, properties, out)
|
50
|
+
def queryFacesByFamilyName(name, nameSize, out) = blFontManagerQueryFacesByFamilyName(self, name, nameSize, out)
|
51
|
+
def equals(b) = blFontManagerEquals(a, b)
|
52
|
+
end
|
53
|
+
|
54
|
+
class BLFontManagerVirt < FFI::Struct
|
55
|
+
layout(
|
56
|
+
:base, BLObjectVirtBase,
|
57
|
+
)
|
58
|
+
def base = self[:base]
|
59
|
+
def base=(v) self[:base] = v end
|
60
|
+
def self.create_as(_base_)
|
61
|
+
instance = BLFontManagerVirt.new
|
62
|
+
instance[:base] = _base_
|
63
|
+
instance
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class BLFontManagerImpl < FFI::Struct
|
68
|
+
layout(
|
69
|
+
:virt, :pointer,
|
70
|
+
)
|
71
|
+
def virt = self[:virt]
|
72
|
+
def virt=(v) self[:virt] = v end
|
73
|
+
def self.create_as(_virt_)
|
74
|
+
instance = BLFontManagerImpl.new
|
75
|
+
instance[:virt] = _virt_
|
76
|
+
instance
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class BLFontQueryProperties < FFI::Struct
|
81
|
+
layout(
|
82
|
+
:style, :uint,
|
83
|
+
:weight, :uint,
|
84
|
+
:stretch, :uint,
|
85
|
+
)
|
86
|
+
def style = self[:style]
|
87
|
+
def style=(v) self[:style] = v end
|
88
|
+
def weight = self[:weight]
|
89
|
+
def weight=(v) self[:weight] = v end
|
90
|
+
def stretch = self[:stretch]
|
91
|
+
def stretch=(v) self[:stretch] = v end
|
92
|
+
def self.create_as(_style_, _weight_, _stretch_)
|
93
|
+
instance = BLFontQueryProperties.new
|
94
|
+
instance[:style] = _style_
|
95
|
+
instance[:weight] = _weight_
|
96
|
+
instance[:stretch] = _stretch_
|
97
|
+
instance
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
# Function
|
103
|
+
|
104
|
+
def self.setup_fontmanager_symbols(output_error = false)
|
105
|
+
symbols = [
|
106
|
+
:blFontManagerInit,
|
107
|
+
:blFontManagerInitMove,
|
108
|
+
:blFontManagerInitWeak,
|
109
|
+
:blFontManagerInitNew,
|
110
|
+
:blFontManagerDestroy,
|
111
|
+
:blFontManagerReset,
|
112
|
+
:blFontManagerAssignMove,
|
113
|
+
:blFontManagerAssignWeak,
|
114
|
+
:blFontManagerCreate,
|
115
|
+
:blFontManagerGetFaceCount,
|
116
|
+
:blFontManagerGetFamilyCount,
|
117
|
+
:blFontManagerHasFace,
|
118
|
+
:blFontManagerAddFace,
|
119
|
+
:blFontManagerQueryFace,
|
120
|
+
:blFontManagerQueryFacesByFamilyName,
|
121
|
+
:blFontManagerEquals,
|
122
|
+
]
|
123
|
+
apis = {
|
124
|
+
:blFontManagerInit => :blFontManagerInit,
|
125
|
+
:blFontManagerInitMove => :blFontManagerInitMove,
|
126
|
+
:blFontManagerInitWeak => :blFontManagerInitWeak,
|
127
|
+
:blFontManagerInitNew => :blFontManagerInitNew,
|
128
|
+
:blFontManagerDestroy => :blFontManagerDestroy,
|
129
|
+
:blFontManagerReset => :blFontManagerReset,
|
130
|
+
:blFontManagerAssignMove => :blFontManagerAssignMove,
|
131
|
+
:blFontManagerAssignWeak => :blFontManagerAssignWeak,
|
132
|
+
:blFontManagerCreate => :blFontManagerCreate,
|
133
|
+
:blFontManagerGetFaceCount => :blFontManagerGetFaceCount,
|
134
|
+
:blFontManagerGetFamilyCount => :blFontManagerGetFamilyCount,
|
135
|
+
:blFontManagerHasFace => :blFontManagerHasFace,
|
136
|
+
:blFontManagerAddFace => :blFontManagerAddFace,
|
137
|
+
:blFontManagerQueryFace => :blFontManagerQueryFace,
|
138
|
+
:blFontManagerQueryFacesByFamilyName => :blFontManagerQueryFacesByFamilyName,
|
139
|
+
:blFontManagerEquals => :blFontManagerEquals,
|
140
|
+
}
|
141
|
+
args = {
|
142
|
+
:blFontManagerInit => [:pointer],
|
143
|
+
:blFontManagerInitMove => [:pointer, :pointer],
|
144
|
+
:blFontManagerInitWeak => [:pointer, :pointer],
|
145
|
+
:blFontManagerInitNew => [:pointer],
|
146
|
+
:blFontManagerDestroy => [:pointer],
|
147
|
+
:blFontManagerReset => [:pointer],
|
148
|
+
:blFontManagerAssignMove => [:pointer, :pointer],
|
149
|
+
:blFontManagerAssignWeak => [:pointer, :pointer],
|
150
|
+
:blFontManagerCreate => [:pointer],
|
151
|
+
:blFontManagerGetFaceCount => [:pointer],
|
152
|
+
:blFontManagerGetFamilyCount => [:pointer],
|
153
|
+
:blFontManagerHasFace => [:pointer, :pointer],
|
154
|
+
:blFontManagerAddFace => [:pointer, :pointer],
|
155
|
+
:blFontManagerQueryFace => [:pointer, :pointer, :ulong_long, :pointer, :pointer],
|
156
|
+
:blFontManagerQueryFacesByFamilyName => [:pointer, :pointer, :ulong_long, :pointer],
|
157
|
+
:blFontManagerEquals => [:pointer, :pointer],
|
158
|
+
}
|
159
|
+
retvals = {
|
160
|
+
:blFontManagerInit => :uint,
|
161
|
+
:blFontManagerInitMove => :uint,
|
162
|
+
:blFontManagerInitWeak => :uint,
|
163
|
+
:blFontManagerInitNew => :uint,
|
164
|
+
:blFontManagerDestroy => :uint,
|
165
|
+
:blFontManagerReset => :uint,
|
166
|
+
:blFontManagerAssignMove => :uint,
|
167
|
+
:blFontManagerAssignWeak => :uint,
|
168
|
+
:blFontManagerCreate => :uint,
|
169
|
+
:blFontManagerGetFaceCount => :ulong_long,
|
170
|
+
:blFontManagerGetFamilyCount => :ulong_long,
|
171
|
+
:blFontManagerHasFace => :bool,
|
172
|
+
:blFontManagerAddFace => :uint,
|
173
|
+
:blFontManagerQueryFace => :uint,
|
174
|
+
:blFontManagerQueryFacesByFamilyName => :uint,
|
175
|
+
:blFontManagerEquals => :bool,
|
176
|
+
}
|
177
|
+
symbols.each do |sym|
|
178
|
+
begin
|
179
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
180
|
+
rescue FFI::NotFoundError => error
|
181
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
|
@@ -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 BLFontVariationSettingsCore < FFI::Struct
|
32
|
+
layout(
|
33
|
+
:_d, BLObjectDetail,
|
34
|
+
)
|
35
|
+
def _d = self[:_d]
|
36
|
+
def _d=(v) self[:_d] = v end
|
37
|
+
def init() = blFontVariationSettingsInit(self)
|
38
|
+
def self.create()
|
39
|
+
instance = BLFontVariationSettingsCore.new
|
40
|
+
blFontVariationSettingsInit(instance)
|
41
|
+
instance
|
42
|
+
end
|
43
|
+
def initMove(other) = blFontVariationSettingsInitMove(self, other)
|
44
|
+
def initWeak(other) = blFontVariationSettingsInitWeak(self, other)
|
45
|
+
def destroy() = blFontVariationSettingsDestroy(self)
|
46
|
+
def reset() = blFontVariationSettingsReset(self)
|
47
|
+
def clear() = blFontVariationSettingsClear(self)
|
48
|
+
def shrink() = blFontVariationSettingsShrink(self)
|
49
|
+
def assignMove(other) = blFontVariationSettingsAssignMove(self, other)
|
50
|
+
def assignWeak(other) = blFontVariationSettingsAssignWeak(self, other)
|
51
|
+
def getSize() = blFontVariationSettingsGetSize(self)
|
52
|
+
def getCapacity() = blFontVariationSettingsGetCapacity(self)
|
53
|
+
def getView(out) = blFontVariationSettingsGetView(self, out)
|
54
|
+
def hasValue(variationTag) = blFontVariationSettingsHasValue(self, variationTag)
|
55
|
+
def getValue(variationTag) = blFontVariationSettingsGetValue(self, variationTag)
|
56
|
+
def setValue(variationTag, value) = blFontVariationSettingsSetValue(self, variationTag, value)
|
57
|
+
def removeValue(variationTag) = blFontVariationSettingsRemoveValue(self, variationTag)
|
58
|
+
def equals(b) = blFontVariationSettingsEquals(a, b)
|
59
|
+
end
|
60
|
+
|
61
|
+
class BLFontVariationSettingsImpl < 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 = BLFontVariationSettingsImpl.new
|
75
|
+
instance[:data] = _data_
|
76
|
+
instance[:size] = _size_
|
77
|
+
instance[:capacity] = _capacity_
|
78
|
+
instance
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class BLFontVariationItem < FFI::Struct
|
83
|
+
layout(
|
84
|
+
:tag, :uint,
|
85
|
+
:value, :float,
|
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 = BLFontVariationItem.new
|
93
|
+
instance[:tag] = _tag_
|
94
|
+
instance[:value] = _value_
|
95
|
+
instance
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
class BLFontVariationSettingsView < FFI::Struct
|
100
|
+
layout(
|
101
|
+
:data, :pointer,
|
102
|
+
:size, :ulong_long,
|
103
|
+
:ssoData, [BLFontVariationItem, 3],
|
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 = BLFontVariationSettingsView.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_fontvariationsettings_symbols(output_error = false)
|
124
|
+
symbols = [
|
125
|
+
:blFontVariationSettingsInit,
|
126
|
+
:blFontVariationSettingsInitMove,
|
127
|
+
:blFontVariationSettingsInitWeak,
|
128
|
+
:blFontVariationSettingsDestroy,
|
129
|
+
:blFontVariationSettingsReset,
|
130
|
+
:blFontVariationSettingsClear,
|
131
|
+
:blFontVariationSettingsShrink,
|
132
|
+
:blFontVariationSettingsAssignMove,
|
133
|
+
:blFontVariationSettingsAssignWeak,
|
134
|
+
:blFontVariationSettingsGetSize,
|
135
|
+
:blFontVariationSettingsGetCapacity,
|
136
|
+
:blFontVariationSettingsGetView,
|
137
|
+
:blFontVariationSettingsHasValue,
|
138
|
+
:blFontVariationSettingsGetValue,
|
139
|
+
:blFontVariationSettingsSetValue,
|
140
|
+
:blFontVariationSettingsRemoveValue,
|
141
|
+
:blFontVariationSettingsEquals,
|
142
|
+
]
|
143
|
+
apis = {
|
144
|
+
:blFontVariationSettingsInit => :blFontVariationSettingsInit,
|
145
|
+
:blFontVariationSettingsInitMove => :blFontVariationSettingsInitMove,
|
146
|
+
:blFontVariationSettingsInitWeak => :blFontVariationSettingsInitWeak,
|
147
|
+
:blFontVariationSettingsDestroy => :blFontVariationSettingsDestroy,
|
148
|
+
:blFontVariationSettingsReset => :blFontVariationSettingsReset,
|
149
|
+
:blFontVariationSettingsClear => :blFontVariationSettingsClear,
|
150
|
+
:blFontVariationSettingsShrink => :blFontVariationSettingsShrink,
|
151
|
+
:blFontVariationSettingsAssignMove => :blFontVariationSettingsAssignMove,
|
152
|
+
:blFontVariationSettingsAssignWeak => :blFontVariationSettingsAssignWeak,
|
153
|
+
:blFontVariationSettingsGetSize => :blFontVariationSettingsGetSize,
|
154
|
+
:blFontVariationSettingsGetCapacity => :blFontVariationSettingsGetCapacity,
|
155
|
+
:blFontVariationSettingsGetView => :blFontVariationSettingsGetView,
|
156
|
+
:blFontVariationSettingsHasValue => :blFontVariationSettingsHasValue,
|
157
|
+
:blFontVariationSettingsGetValue => :blFontVariationSettingsGetValue,
|
158
|
+
:blFontVariationSettingsSetValue => :blFontVariationSettingsSetValue,
|
159
|
+
:blFontVariationSettingsRemoveValue => :blFontVariationSettingsRemoveValue,
|
160
|
+
:blFontVariationSettingsEquals => :blFontVariationSettingsEquals,
|
161
|
+
}
|
162
|
+
args = {
|
163
|
+
:blFontVariationSettingsInit => [:pointer],
|
164
|
+
:blFontVariationSettingsInitMove => [:pointer, :pointer],
|
165
|
+
:blFontVariationSettingsInitWeak => [:pointer, :pointer],
|
166
|
+
:blFontVariationSettingsDestroy => [:pointer],
|
167
|
+
:blFontVariationSettingsReset => [:pointer],
|
168
|
+
:blFontVariationSettingsClear => [:pointer],
|
169
|
+
:blFontVariationSettingsShrink => [:pointer],
|
170
|
+
:blFontVariationSettingsAssignMove => [:pointer, :pointer],
|
171
|
+
:blFontVariationSettingsAssignWeak => [:pointer, :pointer],
|
172
|
+
:blFontVariationSettingsGetSize => [:pointer],
|
173
|
+
:blFontVariationSettingsGetCapacity => [:pointer],
|
174
|
+
:blFontVariationSettingsGetView => [:pointer, :pointer],
|
175
|
+
:blFontVariationSettingsHasValue => [:pointer, :uint],
|
176
|
+
:blFontVariationSettingsGetValue => [:pointer, :uint],
|
177
|
+
:blFontVariationSettingsSetValue => [:pointer, :uint, :float],
|
178
|
+
:blFontVariationSettingsRemoveValue => [:pointer, :uint],
|
179
|
+
:blFontVariationSettingsEquals => [:pointer, :pointer],
|
180
|
+
}
|
181
|
+
retvals = {
|
182
|
+
:blFontVariationSettingsInit => :uint,
|
183
|
+
:blFontVariationSettingsInitMove => :uint,
|
184
|
+
:blFontVariationSettingsInitWeak => :uint,
|
185
|
+
:blFontVariationSettingsDestroy => :uint,
|
186
|
+
:blFontVariationSettingsReset => :uint,
|
187
|
+
:blFontVariationSettingsClear => :uint,
|
188
|
+
:blFontVariationSettingsShrink => :uint,
|
189
|
+
:blFontVariationSettingsAssignMove => :uint,
|
190
|
+
:blFontVariationSettingsAssignWeak => :uint,
|
191
|
+
:blFontVariationSettingsGetSize => :ulong_long,
|
192
|
+
:blFontVariationSettingsGetCapacity => :ulong_long,
|
193
|
+
:blFontVariationSettingsGetView => :uint,
|
194
|
+
:blFontVariationSettingsHasValue => :bool,
|
195
|
+
:blFontVariationSettingsGetValue => :float,
|
196
|
+
:blFontVariationSettingsSetValue => :uint,
|
197
|
+
:blFontVariationSettingsRemoveValue => :uint,
|
198
|
+
:blFontVariationSettingsEquals => :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
|
+
|
@@ -0,0 +1,112 @@
|
|
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_FORMAT_NONE = 0
|
18
|
+
BL_FORMAT_PRGB32 = 1
|
19
|
+
BL_FORMAT_XRGB32 = 2
|
20
|
+
BL_FORMAT_A8 = 3
|
21
|
+
BL_FORMAT_MAX_VALUE = 3
|
22
|
+
BL_FORMAT_FORCE_UINT = -1
|
23
|
+
BL_FORMAT_NO_FLAGS = 0
|
24
|
+
BL_FORMAT_FLAG_RGB = 1
|
25
|
+
BL_FORMAT_FLAG_ALPHA = 2
|
26
|
+
BL_FORMAT_FLAG_RGBA = 3
|
27
|
+
BL_FORMAT_FLAG_LUM = 4
|
28
|
+
BL_FORMAT_FLAG_LUMA = 6
|
29
|
+
BL_FORMAT_FLAG_INDEXED = 16
|
30
|
+
BL_FORMAT_FLAG_PREMULTIPLIED = 256
|
31
|
+
BL_FORMAT_FLAG_BYTE_SWAP = 512
|
32
|
+
BL_FORMAT_FLAG_BYTE_ALIGNED = 65536
|
33
|
+
BL_FORMAT_FLAG_UNDEFINED_BITS = 131072
|
34
|
+
BL_FORMAT_FLAG_LE = 0
|
35
|
+
BL_FORMAT_FLAG_BE = 512
|
36
|
+
BL_FORMAT_FLAG_FORCE_UINT = -1
|
37
|
+
|
38
|
+
# Typedef
|
39
|
+
|
40
|
+
|
41
|
+
class BLFormatInfo_union_sizes_shift < FFI::Struct
|
42
|
+
layout(
|
43
|
+
:sizes, [:uchar, 4],
|
44
|
+
:shifts, [:uchar, 4],
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
class BLFormatInfo_union_rgba_sizes_shift < FFI::Struct
|
49
|
+
layout(
|
50
|
+
:rSize, :uchar,
|
51
|
+
:gSize, :uchar,
|
52
|
+
:bSize, :uchar,
|
53
|
+
:aSize, :uchar,
|
54
|
+
:rShift, :uchar,
|
55
|
+
:gShift, :uchar,
|
56
|
+
:bShift, :uchar,
|
57
|
+
:aShift, :uchar,
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
class BLFormatInfo_union < FFI::Union
|
62
|
+
layout(
|
63
|
+
:sizes_shifts, BLFormatInfo_union_sizes_shift,
|
64
|
+
:rgba_sizes_shift, BLFormatInfo_union_rgba_sizes_shift,
|
65
|
+
:palette, :pointer,
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
class BLFormatInfo < FFI::Struct
|
70
|
+
layout(
|
71
|
+
:depth, :uint,
|
72
|
+
:flags, :int,
|
73
|
+
:union, BLFormatInfo_union,
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
typedef :int, :BLFormat
|
78
|
+
typedef :int, :BLFormatFlags
|
79
|
+
|
80
|
+
# Struct
|
81
|
+
|
82
|
+
|
83
|
+
# Function
|
84
|
+
|
85
|
+
def self.setup_format_symbols(output_error = false)
|
86
|
+
symbols = [
|
87
|
+
:blFormatInfoQuery,
|
88
|
+
:blFormatInfoSanitize,
|
89
|
+
]
|
90
|
+
apis = {
|
91
|
+
:blFormatInfoQuery => :blFormatInfoQuery,
|
92
|
+
:blFormatInfoSanitize => :blFormatInfoSanitize,
|
93
|
+
}
|
94
|
+
args = {
|
95
|
+
:blFormatInfoQuery => [:pointer, :int],
|
96
|
+
:blFormatInfoSanitize => [:pointer],
|
97
|
+
}
|
98
|
+
retvals = {
|
99
|
+
:blFormatInfoQuery => :uint,
|
100
|
+
:blFormatInfoSanitize => :uint,
|
101
|
+
}
|
102
|
+
symbols.each do |sym|
|
103
|
+
begin
|
104
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
105
|
+
rescue FFI::NotFoundError => error
|
106
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|