image_filter_dsl 0.0.4 → 0.0.5

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: 67f93be80e1577e45689f72da3e54d72a2e14d0b052cd9ef0561a4e39e9ad633
4
- data.tar.gz: 6399fa0b23c67ae545cae07cd41205b32f26c5c633f2334dab11bc322f0a5940
3
+ metadata.gz: 11cb37a368d81f59215c62674f34ede4fa48628aec1836cb42d70529afca1fab
4
+ data.tar.gz: e3a48733e741052828f1a894179990fb2aa964b0f5964ccce2db5650f2667cd6
5
5
  SHA512:
6
- metadata.gz: 34670b0d10d4d235173f65aefbeed30104dff837dd6b6aea97c32a4e67571d125258ef33ccf5c412a2bf1e094c4be34deae189113fc425ecdde2d6e5ca7f4589
7
- data.tar.gz: 8269e9517cfca45728e9ce2a8bef89ef9edb1c41a62c94edf5992fb1e2e092082c9f7987eed522942d8cd9993a30fead442693c89ed3b22361d1189548dec1c4
6
+ metadata.gz: cc94cd228532001187ce242a1aa266ac7cf0281166fa74e61b939773f385c6d89f5e3a0136d4e33c595211d4427f679103e43eda87cdf73cee460b573d3fd584
7
+ data.tar.gz: a7c47d86d6487be190bc0b73589d0562a43a769cbca2c8a8cb1301d7e4c5bc099373d1c8f35a138afe4a77b63035236b3bf150dc00eb382c214ef3584a4ec0b2
data/README.md CHANGED
@@ -43,7 +43,7 @@ processor = ImageFilterDsl.image_processor(swizzle)
43
43
  processor.process_image('./my_source.png', './my_output.png')
44
44
  ```
45
45
 
46
- - See {file:docs/dsl.md}
46
+ - See {ImageFilterDsl::Dsl} for instruction overview (or go directly to {file:docs/dsl.md DSL summary} )
47
47
  - See `./sample_filters/samples.rb`
48
48
  - See Also: [image_filter_dsl_samples](https://bitbucket.org/WadeH/image_filter_dsl_samples/src/master/) for samples
49
49
 
@@ -3,6 +3,9 @@
3
3
  # (c) 2018-2020 VDTDEV/Wade H. ~ MIT License
4
4
  # @author Wade H. <vdtdev.prod@gmail.com>
5
5
  module ImageFilterDsl
6
+ ##
7
+ # Module defining DSL
8
+ # {include:file:docs/dsl.md}
6
9
  module Dsl
7
10
  ##
8
11
  # Module defining filter kernel instruction logic
@@ -32,6 +35,7 @@ module ImageFilterDsl
32
35
  switch: 0xd7,
33
36
  eq: 0xd8,
34
37
  bnot: 0xd9,
38
+ mix: 0xda,
35
39
  # generation
36
40
  rand: 0xe0
37
41
  }
@@ -223,6 +227,15 @@ module ImageFilterDsl
223
227
  end
224
228
  end
225
229
 
230
+ ##
231
+ # Mix two values with a ratio
232
+ # @param [Array] i input values (ratio (0-1.0), a, b)
233
+ # @return [Float] output value of ((ratio*a) + ((1.0-ratio)*b))
234
+ def self.mix(i)
235
+ ratio, a, b = i
236
+ (ratio*a)+((1.0-ratio)*b)
237
+ end
238
+
226
239
  ##
227
240
  # Random number instruction
228
241
  # @param [Array] i input values (min, max)
@@ -13,6 +13,8 @@ module ImageFilterDsl
13
13
 
14
14
  attr_accessor :kernel, :config
15
15
 
16
+
17
+
16
18
  ##
17
19
  # Constructor
18
20
  # @param [Dsl::Kernel::FilterKernel|String] filter_kernel FilterKernel object or path to binary kernel file
@@ -121,7 +123,6 @@ module ImageFilterDsl
121
123
  b = clr.b(pixel)
122
124
  a = clr.a(pixel)
123
125
 
124
-
125
126
  inputs = Hash[*@kernel.inputs.map{|k|[k,0]}.flatten]
126
127
  inputs[:x] = x if inputs.keys.include?(:x)
127
128
  inputs[:y] = y if inputs.keys.include?(:y)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_filter_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wade H.