quattro_4 scribble

scribble 落書き (調べた事をただ落書きする)

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
        • image rotates after restart app (90 degrees)
        • png doesn't store exif (orientation data)
      • fix
        • imageRef = UIImage.imageWithContentsOfFile(App.documents_path + '/key_hook').CGImage
        • rotatedImage = UIImage.imageWithCGImage(imageRef, scale:1.0, orientation:UIImageOrientationRight)