| Ticket UUID: | e19d0ae4134f516e827400a958b93ff60aae690e | |||
| Title: | Aqua: Refactor coordinate conversions with overriding isFlipped | |||
| Type: | RFE | Version: | core-8-6-branch | |
| Submitter: | chrstphrchvz | Created on: | 2020-03-23 21:02:09 | |
| Subsystem: | 66. Aqua Window Operations | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Open | Last Modified: | 2020-08-18 19:04:37 | |
| Resolution: | None | Closed By: | nobody | |
| Closed on: | ||||
| Description: |
Cocoa uses a Cartesian-style coordinate system by default, with the origin at the bottom left corner and y-coordinates increasing upward; whereas Tk uses an inverted coordinate system, with the origin at the top left corner and y-coordinates increasing downward. The Tk Aqua code converts between the two systems as needed. However, there has long existed the It seems possible to override Would it be a good idea to do this, or is there a good reason not to? I bring up this suggestion in case others find this welcome or beneficial, but I wouldn't be surprised if the answer is easily "no". Refactoring seems to be lower priority at the moment, and given that there are possibly dozens of conversions scattered around the code, it might be difficult to find and remove all of them and be confident regressions aren't introduced. Maybe some conversions are still necessary for certain macOS versions. And maybe there's a good reason the folks from Apple and other previous authors of Tk Aqua ports haven't already used flipped | |||
| User Comments: |
marc_culler (claiming to be Marc Culler) added on 2020-03-25 00:36:12:
Hi Christopher, Those conversions occur everywhere throughout the Aqua port. It is definitely a hodge-podge. It was a hodge-podge long before I looked at any of this code, and I am sorry to say that I have not made it any better. Sometimes affine transformations are used. Sometimes the computations are done directly. It is always problematic. And it is not a matter of Tk versus Apple either. It is Apple versus Apple. The Core Graphics library always uses the downward increasing y-axis. So to be completely consistent one would have to choose to either never use Core Graphics or always use Core Graphics, but I think neither ot those choices is really practical. Who knows why Apple decided to reverse their long-standing convention with the NSView coordinate system? Most likely the blame goes to NextStep; once the decision was made to merge Apple and NextStep the confusion was unavoidable. I suspect, however, that the flipped coordinate system was one Apple engineer's idea of how to simplify the conversions, but that Apple never really accepted it. So I suspect that trying to use flipped coordinates everywhere would expose us to bugs lurking in rarely used parts of Apple's code. On the other hand, I think that systematizing the conversion and making it consistent throughout Tk would be a very good thing. It is worth thinking about for sure. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki