image_filter_dsl 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0074cce853619a9d03bce9fc25a7de626137cc5b6355e7f9cf5d80668facf28c
4
- data.tar.gz: aeae830c13a2d99060c6f41ec62794c9edf7647d110b44ecfdbcb0db37d1a968
3
+ metadata.gz: 64f070bf94d94ef0c6e0de6a78fa7ccd8f29f181e866d4aa374f26a4e427f18f
4
+ data.tar.gz: 6347c8d1b350387e369e2e56d023f0fa944dd70a4870035af55619287e11bd7f
5
5
  SHA512:
6
- metadata.gz: 8f124907e599e65a9ab8f9f11f4b7cc66eb68b3eaa66da8fecd9dd2b7a9103ec4c1f2a3494d86e0d0a605f166e191d164b51e2fe73e4b6311eb96aefa81bc765
7
- data.tar.gz: 8966b080bd969cc601cc9bb9652b347d65feebb129c15b20d249bf5f2bff71f3a7d2d293411762738eec2303e93ee88316ee240825a5c4f6839604d330a47a28
6
+ metadata.gz: a8c55bf124bf7e454021ec8b644373566467eeec81786875bc9fa4d89ee0fa86e7e7044c71c83aa0396a3e97c7b0347d3cdd55e952e98c256c02b9f48a524d4e
7
+ data.tar.gz: 4590228397df810c7b75a5c59c1a4a1510e4e7ce723dd36e168f7a9f377dc6decf1b434cdca926e0c6ecc7a4196dae96b7ba6d0beda91b3743994b6e96bd910d
data/README.md ADDED
@@ -0,0 +1,207 @@
1
+ # Image Filter DSL
2
+
3
+ _An Image Filter DSL (duh)_
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/image_filter_dsl.svg)](https://badge.fury.io/rb/image_filter_dsl)
6
+
7
+ {file:CHANGELOG.md Change Log}
8
+
9
+ ## Features
10
+
11
+ - DSL with customizable input and output variables, and a set of basic instructions
12
+ - IO with serialization so Kernels can be written to binary files and loaded from binary files
13
+ - Image Processor that generates image file by applying Filter Kernel to every pixel of input image (supports multi-threading)
14
+
15
+ ## DSL
16
+
17
+ ### Filter Block
18
+
19
+ Using `ImageFilterDsl::Dsl::Filter`
20
+
21
+ ```ruby
22
+ # - First array contains input variables
23
+ # x, y, r, g, b, a, :width and :hght are automatically
24
+ # populated by image filter process
25
+ # - Second array contains output vars; r,g,b,a and optionally
26
+ # x,y for images
27
+ filter = Filter.define [:x,:y,:r,:g,:b], [:r,:g,:b] do
28
+ # Instructions go here
29
+ # instruction [input(s)], output
30
+ add [:x,:r], :g
31
+
32
+ # output can be an existing symbol in out, or a custom one up to 5 letters
33
+ # long (longer will be trimmed if serialized to a binary file)
34
+
35
+ # input can be any declared input or custom variable
36
+ end
37
+ ```
38
+
39
+ ### Instructions
40
+
41
+ Basic Use:
42
+
43
+ ``instruction [argument1,argument2,...], :output_variable``
44
+
45
+ __Math__
46
+
47
+ - `add` add 2 or more input values, storing in output (<code>a+b</code>)
48
+
49
+ ```ruby
50
+ add [:r,5], :r # replace r with r + 5
51
+ ```
52
+
53
+ - `mult` add 2 or more inputs, storing in out (<code>a*b</code>)
54
+
55
+ ```ruby
56
+ mult [:r,2], :r # Replace r with r * 2
57
+ ```
58
+
59
+ - `div` divide 2 inputs
60
+
61
+ ```ruby
62
+ div [:r, 2], :g # Write r/2 to g
63
+ ```
64
+
65
+ - `mod` store modulo of two inputs in output
66
+
67
+ ```ruby
68
+ mod [2,4], :t # Write 2$4 (2) to t
69
+ ```
70
+
71
+ - `abs` store absolute value of input in output
72
+
73
+ ```ruby
74
+ abs [-5], :r # Writes abs(5) to r
75
+ ```
76
+
77
+ __Collection__
78
+
79
+ - `min` store smallest of inputs in output (accepts 2 or more values)
80
+
81
+ ```ruby
82
+ min [:r,255,:g], :s # Writes smallest of r, 255 and g to s
83
+ ```
84
+
85
+ - `max` store largest of inputs in output (accepts 2 or more values)
86
+
87
+ ```ruby
88
+ max [:r,0,:g], :s # Writes largest of r, 0 and g to s
89
+ ```
90
+
91
+ - `avg` store average of inputs in output (accepts 2 or more values)
92
+
93
+ ```ruby
94
+ avg [:r,:g,:b], :ca # Writes (r+g+b)/3 to ca
95
+ ```
96
+
97
+
98
+ __Logic/Conversion/Memory__
99
+
100
+ - `above` choose one of two values based on greater than comparison (2 or 4 values) `[n1,n1,true_val,false_val]` (If not specified, `true_val` is 1 and `false_val` is 0)
101
+
102
+ ```ruby
103
+ # if r > g, store 0 in g, else store g in g (keep g the same)
104
+ above [:r,:g,0,:g], :g
105
+ ```
106
+
107
+ - `below` choose one of two values based on less than comparison (2 or 4 values) `[n1,n1,true_val,false_val]` (If not specified, `true_val` is 1 and `false_val` is 0)
108
+
109
+ ```ruby
110
+ # if r < g, store 0 in r, else store r in r (keep r the same)
111
+ below [:r,:g,0,:r], :r
112
+ ```
113
+
114
+ - `between` choose one of two values based on whether value is between two others (3 or 5 values) `[min,max,value,true_val,false_val]` (If not specified, `true_val` is 1 and `false_val` is 0)
115
+
116
+ ```ruby
117
+ # Returns value since val > 1 && val < 3
118
+ below [1,3,2], :r
119
+ # Returns 1 since -1 < 1
120
+ below [1,-1,5], :r
121
+ ```
122
+
123
+ - `switch` choose one of two values based on condition value (1/1.0 = true, 0/0.0 = false) `[cond,true_val,false_val]`
124
+
125
+ ```ruby
126
+ # If c is true, store r in a, else store g in a
127
+ switch [:c,:r,:g], :a
128
+ ```
129
+
130
+ - `eq` if two input values are equal, store 1, else 0 (_2 values_) (`[val1,val2]`)
131
+ - `bnot` if input is 1 or 1.0, store 0, else 1 (_1 value_) (`[bool]`)
132
+ - `band` if _all_ input values are 1 or 1.0, store 1, else 0 (_1+ values_) (`[val1,val2,...]`)
133
+ - `bor` if _any_ input values are 1 or 1.0, store 1, else 0 (_1+ values_) (`[val1,val2,...]`)
134
+ - `copy` copy input directly to output (`[src]`)
135
+ - `ceil` nearest whole integer of input, rounded up (_1 value_) (`[val]`)
136
+ - `floor` nearest whole integer of input, rounded down (_1 value_) (`[val]`)
137
+ - `clamp` input clamped to be no less than min, no greater than max (`[min,max,val]`)
138
+ - `float` cast input to float (_1 value_) (`[val]`)
139
+ - `round` round first input value to second value decimals (`[value,decimal_count]`)
140
+ - `mix` Mix two values together with a ratio (0*a + (1-r)*b) (`[ratio,a,b]`)
141
+
142
+ ```ruby
143
+ # store (0.3*r) + (0.7*g) in b
144
+ mix [0.3,:r,:g], :b
145
+ ```
146
+
147
+ __Generators__
148
+
149
+ - `rand` random float between min and max (`[min,max]`)
150
+ - `sin` sine function on single value
151
+ - `cos` cosine function on single value
152
+ - `tan` tangent function on single value
153
+
154
+ ### Sample
155
+
156
+ Define filter
157
+
158
+ ```
159
+ swizzle = Filter.define [:r,:g,:b], [:r,:g,:b] do
160
+ copy [:g], :t # copy green to temp
161
+ copy [:r], :g # copy red to green
162
+ copy [:b], :r # copy blue to red
163
+ copy [:t], :b # copy temp (original green) to blue
164
+ end
165
+ ```
166
+
167
+ Optionally write filter kernal to binary file on disk
168
+
169
+ ```ruby
170
+ ImageFilterDsl::Engine::IO.write("./swizzle.ifdk", swizzle)
171
+ ```
172
+
173
+ Use filter kernal to process image
174
+
175
+ ```ruby
176
+ # From binary kernal file
177
+ processor = ImageFilterDsl::Engine::ImageProcessor.new('./swizzle.ifdk')
178
+ # OR from filter object
179
+ processor = ImageFilterDsl::Engine::ImageProcessor.new(swizzle)
180
+ # or use aliases in main module
181
+ processor = ImageFilterDsl.image_processor(swizzle)
182
+
183
+ # Process image and store output
184
+ processor.process_image('./my_source.png', './my_output.png')
185
+ ```
186
+
187
+ - See `./sample_filters/samples.rb` for sample filters
188
+ - See Also: [image_filter_dsl_samples](https://bitbucket.org/WadeH/image_filter_dsl_samples/src/master/) for more samples
189
+
190
+ ## Gem
191
+
192
+ Either
193
+
194
+ - Build into a gem using included `gemspec` file; includes CLI functionality
195
+ - Install using gem with `gem install image_filter_dsl`
196
+
197
+ ## CLI
198
+
199
+ Image Filter DSL can be made to process an image from a binary kernal using
200
+ its CLI tool, `image_filter_dsl`
201
+
202
+ - Usage: `image_filter_dsl <kernel_file> <image_in> <image_out>`
203
+
204
+ ## License
205
+
206
+ (c) 2018-2020, Wade H. (vdtdev.prod@gmail.com). All Rights Reserved.
207
+ Released under MIT license
@@ -8,8 +8,8 @@ require_relative './image_filter_dsl/engine/image_processor.rb'
8
8
 
9
9
  ##
10
10
  # Image Filter DSL Library
11
- # (c) 2018 VDTDEV/Wade H. ~ MIT License
12
- # @author Wade H. <vdtdev@gmail.com>
11
+ # (c) 2018-2020 VDTDEV/Wade H. ~ MIT License
12
+ # @author Wade H. <vdtdev.prod@gmail.com>
13
13
  module ImageFilterDsl
14
14
 
15
15
  ##
@@ -1,8 +1,10 @@
1
1
  ##
2
2
  # Image Filter DSL Library
3
- # (c) 2018 VDTDEV/Wade H. ~ MIT License
4
- # @author Wade H. <vdtdev@gmail.com>
3
+ # (c) 2018-2020 VDTDEV/Wade H. ~ MIT License
4
+ # @author Wade H. <vdtdev.prod@gmail.com>
5
5
  module ImageFilterDsl
6
+ ##
7
+ # Module containing binary kernal related logic
6
8
  module Binary
7
9
  ##
8
10
  # Module providing serialization functionality for converting between
@@ -1,8 +1,8 @@
1
1
  require 'bindata'
2
2
  ##
3
3
  # Image Filter DSL Library
4
- # (c) 2018 VDTDEV/Wade H. ~ MIT License
5
- # @author Wade H. <vdtdev@gmail.com>
4
+ # (c) 2018-2020 VDTDEV/Wade H. ~ MIT License
5
+ # @author Wade H. <vdtdev.prod@gmail.com>
6
6
  module ImageFilterDsl
7
7
  module Binary
8
8
  ##
@@ -22,7 +22,7 @@ module ImageFilterDsl
22
22
  # Constants used in header
23
23
  HEADER_VALUES = {
24
24
  header: "ifdKernel",
25
- version: 0.01
25
+ version: 0.02
26
26
  }
27
27
 
28
28
  ##
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  # Image Filter DSL Library
3
- # (c) 2018 VDTDEV/Wade H. ~ MIT License
4
- # @author Wade H. <vdtdev@gmail.com>
3
+ # (c) 2018-2020 VDTDEV/Wade H. ~ MIT License
4
+ # @author Wade H. <vdtdev.prod@gmail.com>
5
5
  module ImageFilterDsl
6
6
  module Dsl
7
7
  ##
@@ -12,7 +12,7 @@ module ImageFilterDsl
12
12
  # Define method
13
13
  # @param [Array] ins Input symbols
14
14
  # @param [Array] outs Output symbols
15
- # @param [Proc] &block Filter instructions body
15
+ # @param [Proc] block Filter instructions body
16
16
  # @return [FilterKernel] new Filter Kernel
17
17
  def self.define(ins,outs,&block)
18
18
  kernel = Kernel::FilterKernel.new(ins,outs)
@@ -1,8 +1,11 @@
1
1
  ##
2
2
  # Image Filter DSL Library
3
- # (c) 2018 VDTDEV/Wade H. ~ MIT License
4
- # @author Wade H. <vdtdev@gmail.com>
3
+ # (c) 2018-2020 VDTDEV/Wade H. ~ MIT License
4
+ # @author Wade H. <vdtdev.prod@gmail.com>
5
5
  module ImageFilterDsl
6
+ ##
7
+ # Module defining DSL
8
+ # {include:file:dsl.md}
6
9
  module Dsl
7
10
  ##
8
11
  # Module defining filter kernel instruction logic
@@ -31,7 +34,17 @@ module ImageFilterDsl
31
34
  round: 0xd6,
32
35
  switch: 0xd7,
33
36
  eq: 0xd8,
34
- bnot: 0xd9
37
+ bnot: 0xd9,
38
+ mix: 0xda,
39
+ between: 0xdb,
40
+ clamp: 0xdc,
41
+ band: 0xdd,
42
+ bor: 0xde,
43
+ # generation
44
+ rand: 0xf0,
45
+ sin: 0xf1,
46
+ cos: 0xf2,
47
+ tan: 0xf3
35
48
  }
36
49
 
37
50
  ##
@@ -40,7 +53,7 @@ module ImageFilterDsl
40
53
 
41
54
  ##
42
55
  # Add instruction
43
- # @param [Array] input values
56
+ # @param [Array] i input values
44
57
  # @return [Integer|Float] output value
45
58
  def self.add(i)
46
59
  i.sum
@@ -48,7 +61,7 @@ module ImageFilterDsl
48
61
 
49
62
  ##
50
63
  # Multiply instruction
51
- # @param [Array] input values
64
+ # @param [Array] i input values
52
65
  # @return [Integer|Float] output value
53
66
  def self.mult(i)
54
67
  v=1;
@@ -58,14 +71,14 @@ module ImageFilterDsl
58
71
 
59
72
  ##
60
73
  # Multiply instruction
61
- # @param [Array] input values
74
+ # @param [Array] i input values
62
75
  # @return [Integer|Float] output value
63
76
  def self.div(i)
64
77
  i[0]/i[1]
65
78
  end
66
79
  ##
67
80
  # Calculate modulo
68
- # @param [Array] input values
81
+ # @param [Array] i input values
69
82
  # @return [Integer|] output value
70
83
  def self.mod(i)
71
84
  i[0] % i[1]
@@ -73,7 +86,7 @@ module ImageFilterDsl
73
86
 
74
87
  ##
75
88
  # Absolute value
76
- # @param [Array] input value
89
+ # @param [Array] i input value
77
90
  # @return [Integer|Float] output value
78
91
  def self.abs(i)
79
92
  i[0].abs
@@ -81,7 +94,7 @@ module ImageFilterDsl
81
94
 
82
95
  ##
83
96
  # Minimum instruction
84
- # @param [Array] input values
97
+ # @param [Array] i input values
85
98
  # @return [Integer|Float] output value
86
99
  def self.min(i)
87
100
  i.min
@@ -89,7 +102,7 @@ module ImageFilterDsl
89
102
 
90
103
  ##
91
104
  # Maximum instruction
92
- # @param [Array] input values
105
+ # @param [Array] i input values
93
106
  # @return [Integer|Float] output value
94
107
  def self.max(i)
95
108
  i.max
@@ -97,7 +110,7 @@ module ImageFilterDsl
97
110
 
98
111
  ##
99
112
  # Average instruction
100
- # @param [Array] input values
113
+ # @param [Array] i input values
101
114
  # @return [Integer|Float] output value
102
115
  def self.avg(i)
103
116
  i.sum / (1.0 * i.length)
@@ -105,7 +118,7 @@ module ImageFilterDsl
105
118
 
106
119
  ##
107
120
  # Copy instruction
108
- # @param [Array] input values (src)
121
+ # @param [Array] i input values (src)
109
122
  # @return [Integer|Float] output value
110
123
  def self.copy(i)
111
124
  i[0]
@@ -113,9 +126,11 @@ module ImageFilterDsl
113
126
 
114
127
  ##
115
128
  # Above instruction
116
- # @param [Array] input values (a,b,trueVal,falseVal)
129
+ # @param [Array] i input values `(a,b,trueVal,falseVal)`
130
+ # `trueVal` defaults to `1`, `falseVal` defaults to `0`
117
131
  # @return [Integer|Float] output value
118
132
  def self.above(i)
133
+ i = [i,1,0].flatten if i.length == 2
119
134
  if(i[0]>i[1])
120
135
  if i.length < 3
121
136
  1
@@ -133,9 +148,11 @@ module ImageFilterDsl
133
148
 
134
149
  ##
135
150
  # Below instruction
136
- # @param [Array] input values (a,b,trueVal,falseVal)
151
+ # @param [Array] i input values `(a,b,trueVal,falseVal)`
152
+ # `trueVal` defaults to `1`, `falseVal` defaults to `0`
137
153
  # @return [Integer|Float] output value
138
154
  def self.below(i)
155
+ i = [i,1,0].flatten if i.length == 2
139
156
  if(i[0]<i[1])
140
157
  if i.length < 3
141
158
  1
@@ -151,9 +168,31 @@ module ImageFilterDsl
151
168
  end
152
169
  end
153
170
 
171
+ ##
172
+ # Between instruction (check if value is between two others)
173
+ # @param [Array] i input values `[min, max, value, trueVal, falseVal]`
174
+ # `trueVal` defaults to `1`, `falseVal` defaults to `0`
175
+ # @return [Integer] 1 if true, 0 if false
176
+ def self.between(i)
177
+ i = [i,1,0].flatten if i.length == 3
178
+ a,b,v,t,f = i
179
+ r = (v>=a) && (v<=b)
180
+ (r)? t : f
181
+ end
182
+
183
+ ##
184
+ # Clamp value between a min and a max
185
+ # @param [Array] i input values `[min,max,val]`
186
+ # @return [Integer|Float] Value forced to be no greater than `max`
187
+ # and no less than `min`
188
+ def self.clamp(i)
189
+ a,b,v = i
190
+ [b,[a,v].max].min
191
+ end
192
+
154
193
  ##
155
194
  # Floor instruction
156
- # @param [Array] input value (v)
195
+ # @param [Array] i input value (v)
157
196
  # @return [Integer|Float] output value
158
197
  def self.floor(i)
159
198
  i[0].floor
@@ -161,7 +200,7 @@ module ImageFilterDsl
161
200
 
162
201
  ##
163
202
  # Ceil instruction
164
- # @param [Array] input value (v)
203
+ # @param [Array] i input value (v)
165
204
  # @return [Integer|Float] output value
166
205
  def self.ceil(i)
167
206
  i[0].ceil
@@ -169,7 +208,7 @@ module ImageFilterDsl
169
208
 
170
209
  ##
171
210
  # Float cast instruction
172
- # @param [Array] input value (v)
211
+ # @param [Array] i input value (v)
173
212
  # @return [Integer|Float] output value
174
213
  def self.float(i)
175
214
  i[0].to_f
@@ -177,7 +216,7 @@ module ImageFilterDsl
177
216
 
178
217
  ##
179
218
  # Round instruction
180
- # @param [Array] input value (val, decimal_places)
219
+ # @param [Array] i input values (val, decimal_places)
181
220
  # @return [Integer|Float] output value
182
221
  def self.round(i)
183
222
  i[0].round(i[1])
@@ -186,8 +225,8 @@ module ImageFilterDsl
186
225
  ##
187
226
  # 'Switch' instruction (basically if)
188
227
  #
189
- # switch [condition (0/1/0.0/1.0), trueval, falseval]
190
- # @param [Array] input value (condition, true val, false val)
228
+ # switch condition (0/1/0.0/1.0), trueval, falseval]
229
+ # @param [Array] i input value (condition, true val, false val)
191
230
  # @return [Integer|Float] output value
192
231
  def self.switch(i)
193
232
  if i[0].to_i == 1
@@ -199,7 +238,7 @@ module ImageFilterDsl
199
238
 
200
239
  ##
201
240
  # Equal condition instruction
202
- # @param [Array] input value (a, b)
241
+ # @param [Array] i input values (a, b)
203
242
  # @return [Integer|Float] output value 1 true 0 falsew
204
243
  def self.eq(i)
205
244
  if i[0] == i[1]
@@ -211,7 +250,7 @@ module ImageFilterDsl
211
250
 
212
251
  ##
213
252
  # Logic invert instruction
214
- # @param [Array] input value (0 or 1)
253
+ # @param [Array] i input value (0 or 1)
215
254
  # @return [Integer|Float] output value (1 if in 0, 0 if in 1)
216
255
  def self.bnot(i)
217
256
  if i[0].to_i == 1
@@ -220,6 +259,65 @@ module ImageFilterDsl
220
259
  1
221
260
  end
222
261
  end
262
+
263
+ ##
264
+ # Logical AND instruction
265
+ # @param [Array] i input values (ints or floats)
266
+ # @return [Integer] 1 if all values are `1` or `1.0`, else 0
267
+ def self.band(i)
268
+ (i.reduce(:+).to_i == i.length)? 1 : 0
269
+ end
270
+
271
+ ##
272
+ # Logical OR instruction
273
+ # @param [Array] i input values (ints or floats)
274
+ # @return [Integer] 1 if any values are `1` or `1.0`, else 0
275
+ def self.bor(i)
276
+ (i.reduce(:+).to_i > 0)? 1 : 0
277
+ end
278
+
279
+ ##
280
+ # Mix two values with a ratio
281
+ # @param [Array] i input values (ratio (0-1.0), a, b)
282
+ # @return [Float] output value of ((ratio*a) + ((1.0-ratio)*b))
283
+ def self.mix(i)
284
+ ratio, a, b = i
285
+ (ratio*a)+((1.0-ratio)*b)
286
+ end
287
+
288
+ ##
289
+ # Random number instruction
290
+ # @param [Array] i input values (min, max)
291
+ # @return [Float] Random number between min and max
292
+ def self.rand(i)
293
+ r=Random.new
294
+ min,max = i
295
+ (-min) + (r.rand * (max + min))
296
+ end
297
+
298
+ ##
299
+ # Sine function
300
+ # @param [Array] i input value to use sin on
301
+ # @return [Float] Sine of input value
302
+ def self.sin(i)
303
+ Math.sin(i[0])
304
+ end
305
+
306
+ ##
307
+ # Cosine function
308
+ # @param [Array] i input value to use cos on
309
+ # @return [Float] Cosine of input value
310
+ def self.cos(i)
311
+ Math.cos(i[0])
312
+ end
313
+
314
+ ##
315
+ # Tangent function
316
+ # @param [Array] i input value to use tan on
317
+ # @return [Float] Tangent of input value
318
+ def self.tan(i)
319
+ Math.tan(i[0])
320
+ end
223
321
  end
224
322
  end
225
323
  end
@@ -1,9 +1,11 @@
1
1
  ##
2
2
  # Image Filter DSL Library
3
- # (c) 2018 VDTDEV/Wade H. ~ MIT License
4
- # @author Wade H. <vdtdev@gmail.com>
3
+ # (c) 2018-2020 VDTDEV/Wade H. ~ MIT License
4
+ # @author Wade H. <vdtdev.prod@gmail.com>
5
5
  module ImageFilterDsl
6
6
  module Dsl
7
+ ##
8
+ # Kernal module
7
9
  module Kernel
8
10
  ##
9
11
  # IFD Filter Kernel class
@@ -2,9 +2,10 @@ require 'chunky_png'
2
2
 
3
3
  ##
4
4
  # Image Filter DSL Library
5
- # (c) 2018 VDTDEV/Wade H. ~ MIT License
6
- # @author Wade H. <vdtdev@gmail.com>
5
+ # (c) 2018-2020 VDTDEV/Wade H. ~ MIT License
6
+ # @author Wade H. <vdtdev.prod@gmail.com>
7
7
  module ImageFilterDsl
8
+ # Module containing processing engine related code
8
9
  module Engine
9
10
  ##
10
11
  # Image Processor class applies Filter Kernels to images
@@ -12,6 +13,8 @@ module ImageFilterDsl
12
13
 
13
14
  attr_accessor :kernel, :config
14
15
 
16
+
17
+
15
18
  ##
16
19
  # Constructor
17
20
  # @param [Dsl::Kernel::FilterKernel|String] filter_kernel FilterKernel object or path to binary kernel file
@@ -120,7 +123,6 @@ module ImageFilterDsl
120
123
  b = clr.b(pixel)
121
124
  a = clr.a(pixel)
122
125
 
123
-
124
126
  inputs = Hash[*@kernel.inputs.map{|k|[k,0]}.flatten]
125
127
  inputs[:x] = x if inputs.keys.include?(:x)
126
128
  inputs[:y] = y if inputs.keys.include?(:y)
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  # Image Filter DSL Library
3
- # (c) 2018 VDTDEV/Wade H. ~ MIT License
4
- # @author Wade H. <vdtdev@gmail.com>
3
+ # (c) 2018-2020 VDTDEV/Wade H. ~ MIT License
4
+ # @author Wade H. <vdtdev.prod@gmail.com>
5
5
  module ImageFilterDsl
6
6
  module Engine
7
7
  ##
@@ -10,8 +10,13 @@ module ImageFilterDsl
10
10
 
11
11
  ##
12
12
  # Constants for format option used in read
13
+ # Dictates what is returned
13
14
  module DataFormat
15
+ ##
16
+ # Filter Kernal instance
14
17
  KERNEL = :kernel
18
+ ##
19
+ # Filter kernal record
15
20
  RECORD = :record
16
21
  end
17
22
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_filter_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wade H.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-12 00:00:00.000000000 Z
11
+ date: 2020-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chunky_png
@@ -70,13 +70,18 @@ dependencies:
70
70
  - - "~>"
71
71
  - !ruby/object:Gem::Version
72
72
  version: '3.7'
73
- description: Image Filter DSL with processing
73
+ description: |2
74
+ Image filtering DSL including a CLI for running filters and ability
75
+ to write kernals to a binary format that will can be used to run filters
76
+ from the CLI, and potentially allow filters to be compatible with implementation
77
+ in other languages.
74
78
  email: vdtdev.prod@gmail.com
75
79
  executables:
76
80
  - image_filter_dsl
77
81
  extensions: []
78
82
  extra_rdoc_files: []
79
83
  files:
84
+ - README.md
80
85
  - bin/image_filter_dsl
81
86
  - lib/image_filter_dsl.rb
82
87
  - lib/image_filter_dsl/binary/serialize.rb
@@ -86,11 +91,12 @@ files:
86
91
  - lib/image_filter_dsl/dsl/kernel.rb
87
92
  - lib/image_filter_dsl/engine/image_processor.rb
88
93
  - lib/image_filter_dsl/engine/io.rb
89
- homepage: https://bitbucket.org/WadeH/image_filter_dsl/src
94
+ homepage: https://bitbucket.org/WadeH/image_filter_dsl
90
95
  licenses:
91
96
  - MIT
92
97
  metadata:
93
- source_code_uri: https://bitbucket.org/WadeH/image_filter_dsl/src
98
+ source_code_uri: https://bitbucket.org/WadeH/image_filter_dsl
99
+ documentation_uri: https://rubydoc.info/gems/image_filter_dsl/0.1.0
94
100
  post_install_message:
95
101
  rdoc_options: []
96
102
  require_paths:
@@ -106,8 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
112
  - !ruby/object:Gem::Version
107
113
  version: '0'
108
114
  requirements: []
109
- rubyforge_project:
110
- rubygems_version: 2.7.8
115
+ rubygems_version: 3.0.1
111
116
  signing_key:
112
117
  specification_version: 4
113
118
  summary: Image Filter DSL