capture_camera 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown ADDED
@@ -0,0 +1,13 @@
1
+ # Capture Camera
2
+
3
+ CaptureCamera will take a photo using your Macbook camera here is how to use it:
4
+
5
+ require 'capture_camera'
6
+ include Capture
7
+ take_photo :filename => "~/Desktop/capture_test.jpg",
8
+ :size => [640,480]
9
+
10
+
11
+ Install:
12
+
13
+ gem install capture_camera
data/ext/CapturePhoto.m CHANGED
@@ -123,16 +123,10 @@
123
123
  CGRect extent = [inputImage extent];
124
124
  CGSize inputImageSize = extent.size;
125
125
 
126
- CGFloat targetAspectRation = [self size].width / [self size].height;
127
- CGFloat inputAspectRation = inputImageSize.width / inputImageSize.height;
128
- CGFloat scaleFactor;
129
-
130
- if (inputAspectRation > targetAspectRation) {
131
- scaleFactor = inputImageSize.height / [self size].height;
132
- } else {
133
- scaleFactor = inputImageSize.width / [self size].width;
134
- }
135
-
126
+ CGFloat yScale = (CGFloat)([self size].height / inputImageSize.height);
127
+ CGFloat xScale = (CGFloat)(inputImageSize.width / [self size].width);
128
+ CGFloat scaleFactor = (CGFloat)fminf(yScale, xScale);
129
+
136
130
  CIFilter *scaleFilter = [CIFilter filterWithName:@"CILanczosScaleTransform"];
137
131
  [scaleFilter setDefaults];
138
132
  [scaleFilter setValue:inputImage forKey:@"inputImage"];
@@ -146,7 +140,7 @@
146
140
  {
147
141
  CIImage * ciImage = [self applyFiltersForImageBuffer:currentImage];
148
142
  NSCIImageRep *imageRep = [NSCIImageRep imageRepWithCIImage:ciImage];
149
-
143
+
150
144
  NSImage * imageCam = [[NSImage alloc] initWithSize:[imageRep size]];
151
145
  [imageCam addRepresentation:imageRep];
152
146
 
@@ -1,3 +1,3 @@
1
1
  module CaptureCamera
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/test/CaptureTest CHANGED
Binary file
data/test/CaptureTest.m CHANGED
@@ -6,7 +6,8 @@ int main() {
6
6
 
7
7
  CapturePhoto * camera = [[CapturePhoto alloc] init];
8
8
  [camera setFilename:@"~/Desktop/screen.jpg"];
9
- [camera setSize:CGSizeMake(640,480)];
9
+ //[camera setSize:CGSizeMake(640,480)];
10
+ [camera setSize:CGSizeMake(200,200)];
10
11
 
11
12
  [camera begin];
12
13
  [camera release];
data/test/capture_test.rb CHANGED
@@ -3,6 +3,10 @@ require 'capture_camera'
3
3
  include Capture
4
4
 
5
5
  dir = "~/Desktop"
6
+ photo_name = "capture_test"
6
7
 
7
- take_photo :filename => "#{dir}/#{commit_sha}.jpg",
8
- :size => [640,480]
8
+ # take_photo :filename => "#{dir}/#{photo_name}.jpg",
9
+ # :size => [640,480]
10
+
11
+ take_photo :filename => "#{dir}/#{photo_name}.jpg",
12
+ :size => [200,200]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capture_camera
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-09 00:00:00.000000000Z
12
+ date: 2012-12-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Take a photo from the macbook camera
15
15
  email:
@@ -21,6 +21,7 @@ extra_rdoc_files: []
21
21
  files:
22
22
  - .gitignore
23
23
  - Gemfile
24
+ - README.markdown
24
25
  - Rakefile
25
26
  - capture_camera.gemspec
26
27
  - ext/Capture.c
@@ -54,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
55
  version: '0'
55
56
  requirements: []
56
57
  rubyforge_project: capture_camera
57
- rubygems_version: 1.8.12
58
+ rubygems_version: 1.8.24
58
59
  signing_key:
59
60
  specification_version: 3
60
61
  summary: Take a photo from the macbook camera