rubysketch 0.3.7 → 0.3.8

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: 41b3a75aeb6c8bdc443d2d87e44c60361a527e4d6b8b3918e8b1eaa2503f92e4
4
- data.tar.gz: 7f373d0f3fdb31d38bb76d8e8ed88ce2f3cedca0c696d8a5f571ded1e78fb15d
3
+ metadata.gz: b5824abb04b555aa085934c3eefb32dc0cf5a79c6bc48945d5706a260c46269d
4
+ data.tar.gz: 35d88e63413027b4c8c574b860c2dd9e443cb29f140e9820ec73bacaaf800f05
5
5
  SHA512:
6
- metadata.gz: ffcba1a2e5ae98525c4c1512230d249995071e6be9183918b6f62ed5293d9ac8f530d38aa5f544d2d4fc431ca17f38c7746955df313e9609e0ee528551045a51
7
- data.tar.gz: cb49daa453cdf6dd9027a59c508363a63fed2e210b0acbcfa311e66334b107a88471e5b8b59dac7f77b5aa04423aaa2d0cd2b2fa0c4b1221b76997a93ce89e79
6
+ metadata.gz: 34eaeef4a6992cfa326e16bd58b07e27b4757876129d03d246b717d334620d87d6a412f61757545bd4db561f83f38d8dd9303d255276ae0a544a4731759d853c
7
+ data.tar.gz: f0f4d8498f19da6a602cb4b120e91cdaebb718e66d4980433cb2386e0ed45e47aeefd25adb2c03974a93fefe2f862783325cd8c1cf923174f8467825172d647b
@@ -1,6 +1,12 @@
1
1
  # RubySketch ChangeLog
2
2
 
3
3
 
4
+ ## [0.3.8] - 2020-11-27
5
+
6
+ - Capture#initialize() can take requestWidth, requestHeight and cameraName
7
+ - add Capture#width and Capture#height
8
+
9
+
4
10
  ## [0.3.7] - 2020-11-18
5
11
 
6
12
  - add Capture class
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.7
1
+ 0.3.8
@@ -5,7 +5,7 @@
5
5
  require 'rubysketch-processing'
6
6
 
7
7
 
8
- cam = Capture.new
8
+ cam = Capture.new 300, 200, Capture.list.last
9
9
  cam.start
10
10
 
11
11
  draw do
@@ -737,13 +737,32 @@ module RubySketch
737
737
  # @return [Array] device name list
738
738
  #
739
739
  def self.list ()
740
- ['default']
740
+ Rays::Camera.device_names
741
741
  end
742
742
 
743
743
  # Initialize camera object.
744
744
  #
745
- def initialize ()
746
- @camera = Rays::Camera.new
745
+ # @overload Capture.new()
746
+ # @overload Capture.new(cameraName)
747
+ # @overload Capture.new(requestWidth, requestHeight)
748
+ # @overload Capture.new(requestWidth, requestHeight, cameraName)
749
+ #
750
+ # @param requestWidth [Integer] captured image width
751
+ # @param requestHeight [Integer] captured image height
752
+ # @param cameraName [String] camera device name
753
+ #
754
+ def initialize (*args)
755
+ width, height, name =
756
+ if args.empty?
757
+ [-1, -1, nil]
758
+ elsif args[0].kind_of?(String)
759
+ [-1, -1, args[0]]
760
+ elsif args[0].kind_of?(Numeric) && args[1].kind_of?(Numeric)
761
+ [args[0], args[1], args[2]]
762
+ else
763
+ raise ArgumentError
764
+ end
765
+ @camera = Rays::Camera.new width, height, device_name: name
747
766
  end
748
767
 
749
768
  # Start capturing.
@@ -778,6 +797,22 @@ module RubySketch
778
797
  @camera.image
779
798
  end
780
799
 
800
+ # Returns the width of captured image
801
+ #
802
+ # @return [Numeric] the width of captured image
803
+ #
804
+ def width ()
805
+ @camera.image&.width || 0
806
+ end
807
+
808
+ # Returns the height of captured image
809
+ #
810
+ # @return [Numeric] the height of captured image
811
+ #
812
+ def height ()
813
+ @camera.image&.height || 0
814
+ end
815
+
781
816
  # @private
782
817
  def getInternal__ ()
783
818
  @camera.image || dummyImage__
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubysketch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-18 00:00:00.000000000 Z
11
+ date: 2020-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reflexion