MotionInMotion Episode 7 - Working with the Camera
Working with the Camera - MotionInMotion
Cameraを使った実装
- Reflector Reflector Airplay Receiver - Mirror an iPhone or iPad to a Mac or PC
- KeyHook
gem 'bubble-wrap'
require 'bubble-wrap/core'
require 'bubble-wrap/camera'
- KeyHookController
if Device.camera.rear?
Device.camera.rear.picture(media_types: [:image]) do |result|
- Image
- UIImageJPEGRepresentation
- data = UIImageJPEGRepresentation(result[:original_image], 0.5) # 50% quality
- UIImagePNGRepresentation
- data = UIImagePNGRepresentation(result[:original_image])
- problem
- fix
- imageRef = UIImage.imageWithContentsOfFile(App.documents_path + '/key_hook').CGImage
- rotatedImage = UIImage.imageWithCGImage(imageRef, scale:1.0, orientation:UIImageOrientationRight)
- UIImageJPEGRepresentation