rb_webcam 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
data/lib/rb_webcam.rb CHANGED
@@ -144,8 +144,13 @@ class Webcam
144
144
  @iplimage_struct.depth
145
145
  end
146
146
 
147
- # FFI::Pointer to image data
147
+ # String of image data
148
148
  def data
149
+ self.data_pointer.read_string(self.data_size)
150
+ end
151
+
152
+ # FFI::Pointer to image data
153
+ def data_pointer
149
154
  @iplimage_struct.image_data
150
155
  end
151
156
 
data/rb_webcam.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rb_webcam}
8
- s.version = "0.2.1"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["TyounanMOTI"]
@@ -30,14 +30,22 @@ describe Webcam do
30
30
  it "color_depth should be Symbol" do
31
31
  @image.color_depth.should be_instance_of Symbol
32
32
  end
33
-
34
- it "data should be instance of FFI::Pointer" do
35
- @image.data.should be_instance_of FFI::Pointer
33
+
34
+ it "data should be instance of String" do
35
+ @image.data.should be_instance_of String
36
36
  end
37
37
 
38
+ it "length of data should equal with data_size" do
39
+ @image.data.length.should == @image.data_size
40
+ end
41
+
38
42
  it "data size should > 0" do
39
43
  @image.data_size.should > 0
40
44
  end
45
+
46
+ it "data_pointer should be instance of FFI::Pointer" do
47
+ @image.data_pointer.should be_instance_of FFI::Pointer
48
+ end
41
49
  end
42
50
 
43
51
  it "resolution mode of width should > 0" do
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 1
9
- version: 0.2.1
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - TyounanMOTI