Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2013
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. VideoOutput {
  2. id: viewFinder
  3.  
  4. property bool shouldBeCentered: device.isLandscape
  5. property real anchoredY: viewFinderGeometry.y * (device.isInverted ? +1 : -1)
  6. property real anchoredX: viewFinderGeometry.x * (device.isInverted ? +1 : -1)
  7.  
  8. x: viewFinder.shouldBeCentered ? 0 : viewFinder.anchoredX
  9. y: viewFinder.shouldBeCentered || device.naturalOrientation === "landscape" ?
  10. 0 : viewFinder.anchoredY
  11. width: parent.width
  12. height: parent.height
  13. source: camera
  14.  
  15. /* This rotation need to be applied since the camera hardware in the
  16. Galaxy Nexus phone is mounted at an angle inside the device, so the video
  17. feed is rotated too.
  18. FIXME: This should come from a system configuration option so that we
  19. don't have to have a different codebase for each different device we want
  20. to run on */
  21. orientation: device.naturalOrientation === "portrait" ? -90 : 0
  22.  
  23. /* Convenience item tracking the real position and size of the real video feed.
  24. Having this helps since these values depend on a lot of rules:
  25. - the feed is automatically scaled to fit the viewfinder
  26. - the viewfinder might apply a rotation to the feed, depending on device orientation
  27. - the resolution and aspect ratio of the feed changes depending on the active camera
  28. The item is also separated in a component so it can be unit tested.
  29. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement