blend2d-bindings 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/ChangeLog +26 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +41 -0
  5. data/examples/test.rb +46 -0
  6. data/examples/util/setup_blend2d.rb +46 -0
  7. data/lib/blend2d.rb +95 -0
  8. data/lib/blend2d_api.rb +255 -0
  9. data/lib/blend2d_array.rb +319 -0
  10. data/lib/blend2d_bitarray.rb +275 -0
  11. data/lib/blend2d_bitset.rb +311 -0
  12. data/lib/blend2d_context.rb +1613 -0
  13. data/lib/blend2d_filesystem.rb +211 -0
  14. data/lib/blend2d_font.rb +281 -0
  15. data/lib/blend2d_fontdata.rb +209 -0
  16. data/lib/blend2d_fontdefs.rb +552 -0
  17. data/lib/blend2d_fontface.rb +345 -0
  18. data/lib/blend2d_fontfeaturesettings.rb +210 -0
  19. data/lib/blend2d_fontmanager.rb +187 -0
  20. data/lib/blend2d_fontvariationsettings.rb +210 -0
  21. data/lib/blend2d_format.rb +112 -0
  22. data/lib/blend2d_geometry.rb +424 -0
  23. data/lib/blend2d_glyphbuffer.rb +141 -0
  24. data/lib/blend2d_glyphrun.rb +101 -0
  25. data/lib/blend2d_gradient.rb +429 -0
  26. data/lib/blend2d_image.rb +291 -0
  27. data/lib/blend2d_imagecodec.rb +219 -0
  28. data/lib/blend2d_imagedecoder.rb +168 -0
  29. data/lib/blend2d_imageencoder.rb +159 -0
  30. data/lib/blend2d_matrix.rb +132 -0
  31. data/lib/blend2d_object.rb +326 -0
  32. data/lib/blend2d_path.rb +511 -0
  33. data/lib/blend2d_pattern.rb +202 -0
  34. data/lib/blend2d_pixelconverter.rb +109 -0
  35. data/lib/blend2d_random.rb +77 -0
  36. data/lib/blend2d_rgba.rb +95 -0
  37. data/lib/blend2d_runtime.rb +259 -0
  38. data/lib/blend2d_string.rb +245 -0
  39. data/lib/blend2d_var.rb +294 -0
  40. data/lib/libblend2d.aarch64.so +0 -0
  41. data/lib/libblend2d.arm64.dylib +0 -0
  42. data/lib/libblend2d.dll +0 -0
  43. data/lib/libblend2d.x86_64.dylib +0 -0
  44. data/lib/libblend2d.x86_64.so +0 -0
  45. metadata +99 -0
@@ -0,0 +1,202 @@
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_geometry'
9
+ require_relative 'blend2d_image'
10
+ require_relative 'blend2d_matrix'
11
+ require_relative 'blend2d_object'
12
+
13
+ module Blend2D
14
+ extend FFI::Library
15
+ # Define/Macro
16
+
17
+
18
+ # Enum
19
+
20
+ BL_PATTERN_QUALITY_NEAREST = 0
21
+ BL_PATTERN_QUALITY_BILINEAR = 1
22
+ BL_PATTERN_QUALITY_MAX_VALUE = 1
23
+ BL_PATTERN_QUALITY_FORCE_UINT = -1
24
+
25
+ # Typedef
26
+
27
+ typedef :int, :BLPatternQuality
28
+
29
+ # Struct
30
+
31
+ class BLPatternCore < FFI::Struct
32
+ layout(
33
+ :_d, BLObjectDetail,
34
+ )
35
+ def _d = self[:_d]
36
+ def _d=(v) self[:_d] = v end
37
+ def init() = blPatternInit(self)
38
+ def self.create()
39
+ instance = BLPatternCore.new
40
+ blPatternInit(instance)
41
+ instance
42
+ end
43
+ def initMove(other) = blPatternInitMove(self, other)
44
+ def initWeak(other) = blPatternInitWeak(self, other)
45
+ def initAs(image, area, extendMode, transform) = blPatternInitAs(self, image, area, extendMode, transform)
46
+ def self.create_as(image, area, extendMode, transform)
47
+ instance = BLPatternCore.new
48
+ blPatternInitAs(instance, image, area, extendMode, transform)
49
+ instance
50
+ end
51
+ def destroy() = blPatternDestroy(self)
52
+ def reset() = blPatternReset(self)
53
+ def assignMove(other) = blPatternAssignMove(self, other)
54
+ def assignWeak(other) = blPatternAssignWeak(self, other)
55
+ def assignDeep(other) = blPatternAssignDeep(self, other)
56
+ def create(image, area, extendMode, transform) = blPatternCreate(self, image, area, extendMode, transform)
57
+ def getImage(image) = blPatternGetImage(self, image)
58
+ def setImage(image, area) = blPatternSetImage(self, image, area)
59
+ def resetImage() = blPatternResetImage(self)
60
+ def getArea(areaOut) = blPatternGetArea(self, areaOut)
61
+ def setArea(area) = blPatternSetArea(self, area)
62
+ def resetArea() = blPatternResetArea(self)
63
+ def getExtendMode() = blPatternGetExtendMode(self)
64
+ def setExtendMode(extendMode) = blPatternSetExtendMode(self, extendMode)
65
+ def getTransform(transformOut) = blPatternGetTransform(self, transformOut)
66
+ def getTransformType() = blPatternGetTransformType(self)
67
+ def applyTransformOp(opType, opData) = blPatternApplyTransformOp(self, opType, opData)
68
+ def equals(b) = blPatternEquals(a, b)
69
+ end
70
+
71
+ class BLPatternImpl < FFI::Struct
72
+ layout(
73
+ :image, BLImageCore,
74
+ :area, BLRectI,
75
+ :transform, BLMatrix2D,
76
+ )
77
+ def image = self[:image]
78
+ def image=(v) self[:image] = v end
79
+ def area = self[:area]
80
+ def area=(v) self[:area] = v end
81
+ def transform = self[:transform]
82
+ def transform=(v) self[:transform] = v end
83
+ def self.create_as(_image_, _area_, _transform_)
84
+ instance = BLPatternImpl.new
85
+ instance[:image] = _image_
86
+ instance[:area] = _area_
87
+ instance[:transform] = _transform_
88
+ instance
89
+ end
90
+ end
91
+
92
+
93
+ # Function
94
+
95
+ def self.setup_pattern_symbols(output_error = false)
96
+ symbols = [
97
+ :blPatternInit,
98
+ :blPatternInitMove,
99
+ :blPatternInitWeak,
100
+ :blPatternInitAs,
101
+ :blPatternDestroy,
102
+ :blPatternReset,
103
+ :blPatternAssignMove,
104
+ :blPatternAssignWeak,
105
+ :blPatternAssignDeep,
106
+ :blPatternCreate,
107
+ :blPatternGetImage,
108
+ :blPatternSetImage,
109
+ :blPatternResetImage,
110
+ :blPatternGetArea,
111
+ :blPatternSetArea,
112
+ :blPatternResetArea,
113
+ :blPatternGetExtendMode,
114
+ :blPatternSetExtendMode,
115
+ :blPatternGetTransform,
116
+ :blPatternGetTransformType,
117
+ :blPatternApplyTransformOp,
118
+ :blPatternEquals,
119
+ ]
120
+ apis = {
121
+ :blPatternInit => :blPatternInit,
122
+ :blPatternInitMove => :blPatternInitMove,
123
+ :blPatternInitWeak => :blPatternInitWeak,
124
+ :blPatternInitAs => :blPatternInitAs,
125
+ :blPatternDestroy => :blPatternDestroy,
126
+ :blPatternReset => :blPatternReset,
127
+ :blPatternAssignMove => :blPatternAssignMove,
128
+ :blPatternAssignWeak => :blPatternAssignWeak,
129
+ :blPatternAssignDeep => :blPatternAssignDeep,
130
+ :blPatternCreate => :blPatternCreate,
131
+ :blPatternGetImage => :blPatternGetImage,
132
+ :blPatternSetImage => :blPatternSetImage,
133
+ :blPatternResetImage => :blPatternResetImage,
134
+ :blPatternGetArea => :blPatternGetArea,
135
+ :blPatternSetArea => :blPatternSetArea,
136
+ :blPatternResetArea => :blPatternResetArea,
137
+ :blPatternGetExtendMode => :blPatternGetExtendMode,
138
+ :blPatternSetExtendMode => :blPatternSetExtendMode,
139
+ :blPatternGetTransform => :blPatternGetTransform,
140
+ :blPatternGetTransformType => :blPatternGetTransformType,
141
+ :blPatternApplyTransformOp => :blPatternApplyTransformOp,
142
+ :blPatternEquals => :blPatternEquals,
143
+ }
144
+ args = {
145
+ :blPatternInit => [:pointer],
146
+ :blPatternInitMove => [:pointer, :pointer],
147
+ :blPatternInitWeak => [:pointer, :pointer],
148
+ :blPatternInitAs => [:pointer, :pointer, :pointer, :int, :pointer],
149
+ :blPatternDestroy => [:pointer],
150
+ :blPatternReset => [:pointer],
151
+ :blPatternAssignMove => [:pointer, :pointer],
152
+ :blPatternAssignWeak => [:pointer, :pointer],
153
+ :blPatternAssignDeep => [:pointer, :pointer],
154
+ :blPatternCreate => [:pointer, :pointer, :pointer, :int, :pointer],
155
+ :blPatternGetImage => [:pointer, :pointer],
156
+ :blPatternSetImage => [:pointer, :pointer, :pointer],
157
+ :blPatternResetImage => [:pointer],
158
+ :blPatternGetArea => [:pointer, :pointer],
159
+ :blPatternSetArea => [:pointer, :pointer],
160
+ :blPatternResetArea => [:pointer],
161
+ :blPatternGetExtendMode => [:pointer],
162
+ :blPatternSetExtendMode => [:pointer, :int],
163
+ :blPatternGetTransform => [:pointer, :pointer],
164
+ :blPatternGetTransformType => [:pointer],
165
+ :blPatternApplyTransformOp => [:pointer, :int, :pointer],
166
+ :blPatternEquals => [:pointer, :pointer],
167
+ }
168
+ retvals = {
169
+ :blPatternInit => :uint,
170
+ :blPatternInitMove => :uint,
171
+ :blPatternInitWeak => :uint,
172
+ :blPatternInitAs => :uint,
173
+ :blPatternDestroy => :uint,
174
+ :blPatternReset => :uint,
175
+ :blPatternAssignMove => :uint,
176
+ :blPatternAssignWeak => :uint,
177
+ :blPatternAssignDeep => :uint,
178
+ :blPatternCreate => :uint,
179
+ :blPatternGetImage => :uint,
180
+ :blPatternSetImage => :uint,
181
+ :blPatternResetImage => :uint,
182
+ :blPatternGetArea => :uint,
183
+ :blPatternSetArea => :uint,
184
+ :blPatternResetArea => :uint,
185
+ :blPatternGetExtendMode => :int,
186
+ :blPatternSetExtendMode => :uint,
187
+ :blPatternGetTransform => :uint,
188
+ :blPatternGetTransformType => :int,
189
+ :blPatternApplyTransformOp => :uint,
190
+ :blPatternEquals => :bool,
191
+ }
192
+ symbols.each do |sym|
193
+ begin
194
+ attach_function apis[sym], sym, args[sym], retvals[sym]
195
+ rescue FFI::NotFoundError => error
196
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
197
+ end
198
+ end
199
+ end
200
+
201
+ end
202
+
@@ -0,0 +1,109 @@
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_format'
9
+ require_relative 'blend2d_geometry'
10
+
11
+ module Blend2D
12
+ extend FFI::Library
13
+ # Define/Macro
14
+
15
+
16
+ # Enum
17
+
18
+ BL_PIXEL_CONVERTER_CREATE_NO_FLAGS = 0
19
+ BL_PIXEL_CONVERTER_CREATE_FLAG_DONT_COPY_PALETTE = 1
20
+ BL_PIXEL_CONVERTER_CREATE_FLAG_ALTERABLE_PALETTE = 2
21
+ BL_PIXEL_CONVERTER_CREATE_FLAG_NO_MULTI_STEP = 4
22
+ BL_PIXEL_CONVERTER_CREATE_FLAG_FORCE_UINT = -1
23
+
24
+ # Typedef
25
+
26
+
27
+ class BLPixelConverterOptions < FFI::Struct
28
+ layout(
29
+ :origin, BLPointI,
30
+ :gap, :ulong,
31
+ )
32
+ end
33
+
34
+ class BLPixelConverterCore_Contents_Function < FFI::Struct
35
+ layout(
36
+ :convertFunc, :pointer,
37
+ :internalFlags, :uchar,
38
+ )
39
+ end
40
+
41
+ class BLPixelConverterCore_Contents < FFI::Union
42
+ layout(
43
+ :function, BLPixelConverterCore_Contents_Function,
44
+ :data, [:uchar, 80],
45
+ )
46
+ end
47
+
48
+ class BLPixelConverterCore < FFI::Struct
49
+ layout(
50
+ :contents, BLPixelConverterCore_Contents,
51
+ )
52
+ end
53
+
54
+ callback :BLPixelConverterFunc, [:pointer, :pointer, :long_long, :pointer, :long_long, :uint, :uint, :pointer], :uint
55
+ typedef :int, :BLPixelConverterCreateFlags
56
+
57
+ # Struct
58
+
59
+
60
+ # Function
61
+
62
+ def self.setup_pixelconverter_symbols(output_error = false)
63
+ symbols = [
64
+ :blPixelConverterInit,
65
+ :blPixelConverterInitWeak,
66
+ :blPixelConverterDestroy,
67
+ :blPixelConverterReset,
68
+ :blPixelConverterAssign,
69
+ :blPixelConverterCreate,
70
+ :blPixelConverterConvert,
71
+ ]
72
+ apis = {
73
+ :blPixelConverterInit => :blPixelConverterInit,
74
+ :blPixelConverterInitWeak => :blPixelConverterInitWeak,
75
+ :blPixelConverterDestroy => :blPixelConverterDestroy,
76
+ :blPixelConverterReset => :blPixelConverterReset,
77
+ :blPixelConverterAssign => :blPixelConverterAssign,
78
+ :blPixelConverterCreate => :blPixelConverterCreate,
79
+ :blPixelConverterConvert => :blPixelConverterConvert,
80
+ }
81
+ args = {
82
+ :blPixelConverterInit => [:pointer],
83
+ :blPixelConverterInitWeak => [:pointer, :pointer],
84
+ :blPixelConverterDestroy => [:pointer],
85
+ :blPixelConverterReset => [:pointer],
86
+ :blPixelConverterAssign => [:pointer, :pointer],
87
+ :blPixelConverterCreate => [:pointer, :pointer, :pointer, :int],
88
+ :blPixelConverterConvert => [:pointer, :pointer, :int64, :pointer, :int64, :uint, :uint, :pointer],
89
+ }
90
+ retvals = {
91
+ :blPixelConverterInit => :uint,
92
+ :blPixelConverterInitWeak => :uint,
93
+ :blPixelConverterDestroy => :uint,
94
+ :blPixelConverterReset => :uint,
95
+ :blPixelConverterAssign => :uint,
96
+ :blPixelConverterCreate => :uint,
97
+ :blPixelConverterConvert => :uint,
98
+ }
99
+ symbols.each do |sym|
100
+ begin
101
+ attach_function apis[sym], sym, args[sym], retvals[sym]
102
+ rescue FFI::NotFoundError => error
103
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
104
+ end
105
+ end
106
+ end
107
+
108
+ end
109
+
@@ -0,0 +1,77 @@
1
+ # Ruby-Blend2D : Yet another Blend2D wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/blend2d-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module Blend2D
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ # Struct
21
+
22
+ class BLRandom < FFI::Struct
23
+ layout(
24
+ :data, [:ulong_long, 2],
25
+ )
26
+ def data = self[:data]
27
+ def data=(v) self[:data] = v end
28
+ def reset(seed) = blRandomReset(self, seed)
29
+ def nextUInt32() = blRandomNextUInt32(self)
30
+ def nextUInt64() = blRandomNextUInt64(self)
31
+ def nextDouble() = blRandomNextDouble(self)
32
+ def self.create_as(_data_)
33
+ instance = BLRandom.new
34
+ instance[:data] = _data_
35
+ instance
36
+ end
37
+ end
38
+
39
+
40
+ # Function
41
+
42
+ def self.setup_random_symbols(output_error = false)
43
+ symbols = [
44
+ :blRandomReset,
45
+ :blRandomNextUInt32,
46
+ :blRandomNextUInt64,
47
+ :blRandomNextDouble,
48
+ ]
49
+ apis = {
50
+ :blRandomReset => :blRandomReset,
51
+ :blRandomNextUInt32 => :blRandomNextUInt32,
52
+ :blRandomNextUInt64 => :blRandomNextUInt64,
53
+ :blRandomNextDouble => :blRandomNextDouble,
54
+ }
55
+ args = {
56
+ :blRandomReset => [:pointer, :ulong_long],
57
+ :blRandomNextUInt32 => [:pointer],
58
+ :blRandomNextUInt64 => [:pointer],
59
+ :blRandomNextDouble => [:pointer],
60
+ }
61
+ retvals = {
62
+ :blRandomReset => :uint,
63
+ :blRandomNextUInt32 => :uint,
64
+ :blRandomNextUInt64 => :ulong_long,
65
+ :blRandomNextDouble => :double,
66
+ }
67
+ symbols.each do |sym|
68
+ begin
69
+ attach_function apis[sym], sym, args[sym], retvals[sym]
70
+ rescue FFI::NotFoundError => error
71
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
72
+ end
73
+ end
74
+ end
75
+
76
+ end
77
+
@@ -0,0 +1,95 @@
1
+ # Ruby-Blend2D : Yet another Blend2D wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/blend2d-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module Blend2D
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ # Struct
21
+
22
+ class BLRgba32 < FFI::Struct
23
+ layout(
24
+ :value, :uint,
25
+ )
26
+ def value = self[:value]
27
+ def value=(v) self[:value] = v end
28
+ def self.create_as(_value_)
29
+ instance = BLRgba32.new
30
+ instance[:value] = _value_
31
+ instance
32
+ end
33
+ end
34
+
35
+ class BLRgba64 < FFI::Struct
36
+ layout(
37
+ :value, :ulong_long,
38
+ )
39
+ def value = self[:value]
40
+ def value=(v) self[:value] = v end
41
+ def self.create_as(_value_)
42
+ instance = BLRgba64.new
43
+ instance[:value] = _value_
44
+ instance
45
+ end
46
+ end
47
+
48
+ class BLRgba < FFI::Struct
49
+ layout(
50
+ :r, :float,
51
+ :g, :float,
52
+ :b, :float,
53
+ :a, :float,
54
+ )
55
+ def r = self[:r]
56
+ def r=(v) self[:r] = v end
57
+ def g = self[:g]
58
+ def g=(v) self[:g] = v end
59
+ def b = self[:b]
60
+ def b=(v) self[:b] = v end
61
+ def a = self[:a]
62
+ def a=(v) self[:a] = v end
63
+ def self.create_as(_r_, _g_, _b_, _a_)
64
+ instance = BLRgba.new
65
+ instance[:r] = _r_
66
+ instance[:g] = _g_
67
+ instance[:b] = _b_
68
+ instance[:a] = _a_
69
+ instance
70
+ end
71
+ end
72
+
73
+
74
+ # Function
75
+
76
+ def self.setup_rgba_symbols(output_error = false)
77
+ symbols = [
78
+ ]
79
+ apis = {
80
+ }
81
+ args = {
82
+ }
83
+ retvals = {
84
+ }
85
+ symbols.each do |sym|
86
+ begin
87
+ attach_function apis[sym], sym, args[sym], retvals[sym]
88
+ rescue FFI::NotFoundError => error
89
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
90
+ end
91
+ end
92
+ end
93
+
94
+ end
95
+