0

like this (note the yellow leaves and black corner): enter image description here

and without flip container view. because I want to make a crop tool like iOS 9's Photos.app with flip feature. if flip container view, some user interaction will be different

PhotoTweaks is a good start, I just want flip content in the crop box

I think there is a way can implement this by just change the picture view's transform. but what I do just work on some angle,not all. my test code at Github

maybe I can make all angle works by try many times, like enum. but It not what I want. I want a math calculation method and theory.

forgive my poor English.

qiz
  • 869
  • 1
  • 9
  • 14
  • Possible duplicate of [How to flip UIImage horizontally?](http://stackoverflow.com/questions/5404706/how-to-flip-uiimage-horizontally) – luk2302 Dec 31 '15 at 14:44
  • no no no, it's very different. That question is easy to resolve. – qiz Dec 31 '15 at 14:46
  • In what way? Have you tried applying a transformation to the layer? like `imageView.layer.transform = CATransform3DRotate(v.layer.transform, CGFloat(M_PI), 0, 1, 0)`? – luk2302 Dec 31 '15 at 14:50
  • transform is not CALayer's propery. what's 'v' mean? – qiz Dec 31 '15 at 14:54
  • a damn, it is the same view, should be `imageView.layer.transform` as well. – luk2302 Dec 31 '15 at 14:55
  • transform is a layer property, yes. – luk2302 Dec 31 '15 at 14:55
  • sorry, my fault. I will put some code later – qiz Dec 31 '15 at 14:58
  • CATransform3DRotate(v.layer.transform, CGFloat(M_PI), 0, 1, 0) is not work. – qiz Dec 31 '15 at 15:15
  • I have pull the code to [Github](https://github.com/qchenqizhi/PhotoTweaks/commit/557845d0b5d9cecfa8a50a3c3e17d29795eb1bdd). you can have a look, It's really different question. – qiz Dec 31 '15 at 16:03
  • I have change the excample picture make question more clearly – qiz Dec 31 '15 at 23:05
  • @qlz, it's still just a horizontally-flipped image. Nothing a `transform` can't solve, or even `imageOrientation` on the image.. – jcaron Dec 31 '15 at 23:53
  • @jcaron Have you seen my [code](https://github.com/qchenqizhi/PhotoTweaks/commits/master) yet? I have solved this by rotation and translation and mirror the source CGImage. but it still have some issue with some angle. – qiz Jan 01 '16 at 00:13

1 Answers1

0

I think I've solved the problem with simple solution.

Just make the angle between 0 - 360 degrees before rotation, and then the code work for all angle.

This is the code at Github.

this question is different with How to flip UIImage horizontally?, I think the duplicate tag need be removed.

Community
  • 1
  • 1
qiz
  • 869
  • 1
  • 9
  • 14