You’ll keep this page easy to read and update for everyone by using the following guidelines:
When adding a comment, leave a blank line between your entry and the previous one. *If the previous comment is in plain text, make yours *italics by enclosing it in double apostrophes (and vice versa). This makes it easier to tell the difference between two comments and a single, multi-paragraph comment. *When adding a new item, copy the following (while in edit mode) and use it as a template:
Vote: AYES 1, NAYS 1
Vote: AYES 4, NAYS 0
Vote: AYES 1, NAYS 0
Comments: Uh, I think the reason behind the method -set exists in NSColor is in Quartz or Display PDF model (or, DPS from the NeXT days.) The PDF renderer is a state machine, and you’re modifying the state using [NSColor -set]. I agree that it apparently violates OO idealism, but the true receiver of the message is the current graphics context. Thus it is natural to use [NSColor -set] in drawRect:, as you’re directly touching the PDF context on behalf of the NSView. Speaking pure OO, you should also abhor global existence of autorelease pools ! (Apr12, 2005)
I agree it’s not very OO, but the technical reasons are as stated above. However, it’s very easy to create your own objects which do handle this detail for you. For example just subclass NSView and add e.g. fill and stroke setter methods which are applied when the view is focused. In practice you need much more granularity than this, so there isn’t a general solution that works for all possible situations. I think that’s why it’s been left at a relatively low level - it gives you the flexibility to do what you want. Solutions for some classes of app - vector drawing say - can be generalised to a greater extent and in that case you’ll probably find that the stroke/fill of objects is highly object-oriented. (October 17 2006)
Vote: AYES 1, NAYS 1
While on the NSSlider topic, another issue is that the control is sending out messages based on movement of the mouse pointer instead of actual changes in the slider position/value (i.e., if you drag past the ends of the slider your “slider value changed” code keeps getting called even though the slider value is no longer changing). Maybe this is useful in some situations but I can’t think of any. Even so, it should be a controllable behavior. (This has now been recognized as an actual bug – Bug ID# 2849637) It is controllable � bindings are value-oriented. Bind the slider.
Neither of these is a real issue. Give NSSlider a custom NSSliderCell and draw whatever you want for both the knob and the bar. If you’d like an example I can point to at least one. And, getting your action as the mouse moves is controllable, store the last value and if the new value is the same just return.
I’m guessing the action message based on mouse movement was introduced with the “knob” style of slider because that style has no “end points” and dragging the mouse further away from the control gives you finer control over the calculated value. For the good ol’ fashioned slider bar, though, sending action messages when the slider vaue hasn’t changed is a waste. Sure you can write code that ignores it, but why should you have to? The slider’s function is make value changes, not indicate mouse movement.
Vote: AYES 4, NAYS 0
I think the NSSplitView control should be revamped all together. It is a poor class. It has a lot of bugs, not much support for visual tweaking, it has a confusing superview/subview heirachy, it is damn hard to set the bounds of any of its subviews or slider position, and most of all NO AUTOSAVE!!!
*2004.10.04: Full Feature Set – Apple seems quite fond of introducing new UI elements in their software and they do it very well; it’s easy to see that they have world class designers working for them. Unfortunately, they are rather slow at getting these new elements fully supported in Cocoa and IB. Just scanning a few days worth of discussions listed in RecentChanges will show you how often someone is trying to emulate something they’ve seen in Apple apps but find they have to subclass something (or add categories). Looking at some of the more recent apps (like Motion) and the new features in Tiger it’s pretty obvious that there are a whole host of new UI elements on the way.
Vote: AYES 3, NAYS 0
Comments: Absolutely. It is hard for those of us with less experience to emulate the Apple UI if it isn’t given to us in IB. Some of us just aren’t experienced enough to make these subclasses or categories, and won’t use a new UI element unless its in IB. NSSegmentedControl, for example. –GeoffPado
Rejoice, then :) NSSegmentedControl, as well as many other new UI elements will be in IB in 10.4 (if you feel like searching through forums.macnn.com you can find a picture) –DavidSmith
*See http://forums.macnn.com/showthread.php?s=5bc84c2d024ca93758a56d0d60ec3881&threadid=233030&highlight=NSSegmentedControl#post2259510 *
*2005.02.22: Paragraph wells We have the whole “well” concept in Cocoa; widgets that suck out a particular style from clippings drag-n-dropped onto them. We also have several semi-standardized style records, for text, color and fonts. So given that there are font and color wells, where’s the paragraph well? Don’t you want to be able to store your commonly used layouts in a cross-application panel? Don’t you want to have a standard panel for this instead of just the ruler? Don’t you want to handle all styles using the same UI? The UI seems broken in this respect, and has been all along. —- Vote: AYES 1, NAYS 2
Comments: I basically agree, although the whole idea of a paragraph well seems somewhat alien. The current state of play is absolutely borked as far as styles, both character and paragraph, are concerned. All the ‘copy ruler’ stuff is completely opaque to the user, and nobody ever invokes the character style panel, which is ugly as hell.
Vote: AYES 3, NAYS 0
Comments: Yes, this should be implemented. The cell class should have a setView: method. It should also be re-implemented into the NSMenuItem class as well - like it used to be. Yes. Specifically, I wanted to put a progress indicator in a table cell, so I searched Apple’s Cocoa mailing list archives. There were questions about it going back to 2002, but no good answers. —-
Vote: AYES 1, NAYS 2
Comments: Too many versions of the same thing serve only to confuse users. Is it really impossible to arrange your UI such that you can use the horizontal flavor?
Rotate the view via setBoundsRotation?
*2006.08.20: A Rule Editor : We need a Rule Editor with many options, available for Tiger through�an IB palette. Like this one: http://perso.orange.fr/Ivanov/rule_editor.jpg
If anyone want to do such a thing (must not be very difficult), I am ready to contribute. �—- Vote: AYES 1, NAYS 0 —-
Vote: AYES 4, NAYS 1
Comments: As much as I might like this, Quartz is non-device dependent and resolution independant. Most libraries that support boolean operations on path including QuickDraw (AFAIK) do so by rasterizing and the tracing the rasterized image. Rasterizing inherently reduces drawing fidelity to the resolution and device capabilities of the rasterization device. Doing boolean operations on arbitrary vector paths is as they say a “non-trivial” operation. Correct handling of antialiasing and transparenct makes it even harder.
Does anybody know how Adobe Illustrator implements boolean operations on paths ? How about 3D Studio Max boolean operations on solids ? Are there any Graphics Gems for this ? **YES: http://www.ics.uci.edu/~gopi/PAPERS/BOOLE.pdf **
It’s true that Regions are inherently a raster operation, which definitely makes this an easier problem to solve. However, I can’t see what resolution has to do with it. A path is a list of (connected) points which define mathematical boundaries. It’s perfectly possible, while working in that purely mathematical domain, to decide a) where two paths intersect, which forms new points on the path, b) which points of the additional path fall inside or outside of the first path, and which “side” (left or right) of the path they lie, and c) build a new list of points which add the intersection points and discard the unwanted points (those inside for a union, those outside for an intersection). The result is a path that can be rasterised (stroked and filled) as a new correctly formed path. Yes, it’s hard to do in practice and the maths gets quite involved, and it’s also hard to make it really fast, but that’s not an argument for not doing it.
Some might argue that poor performance is a good reason not to do it. Many people complained that Quartz was slow and said there is no reason to do anti-aliasing correctly if it is going to be so slow.
As an example of what you can’t do in Quartz, think of Photoshop’s selection tool - you can add and subtract arbitrary regions from the selecton simply by using the shift and option-shift keys as you drag. Note:Photoshop operates on a bitmap of know resoluation and is not resolution idependant. Quartz is resolution independnant
It’s really easy to rapidly build up complex selection shapes. Just can’t be done in Quartz out of the box. If Apple want to wean developers off QuickDraw and onto Quartz, then there needs to be parity of functionality across the two models. Are you saying you would like Apple to add a fixed resolution bitmap oriented set of drawing operations to Quartz? How would that be different from CoreImage ?
Quartz already does lots of things that can’t be done in QD, but this remains one of the few where QD still has the advantage. Also, the code in NSBezierPath already has to compute all the intersection points so it can render paths that intersect correctly when there is an alpha value involved, so half the job is already being done privately. The calculation of intersection points for correct antialiased/transparent drawing happens at the rasterization stage and not in the “purely mathematical domain.” It is a vastly more difficult problem to calculate all of the intersection points without introducing a resolution dependance. Quartz is by design resolution idenpendant until it is rasterized to a particular device.
There may be pathological cases that would mean that a totally general solution might not exist, but for the typical uses for this, which is building up more complex graphical paths from simpler ones, I can’t see why it’s not in there. The simple answer may be that it is just a lot of work and possibly few developers would benefit. Cost/benefit analysis…
There are many papers and references on the web (though little code) and I will figure it out anyway, but my argument is that Apple should have this as a standard part of Quartz. –GrahamCox Good luck.
I thought we were voting. Apparently anyone who votes NO is “not qualified to comment.” —- Vote anyway you like. However, I’ve yet to hear a good, coherent and technically sensible argument for NOT doing this. None of the above counts. I’ve looked extensively into this problem and am a long way towards solving it, so I do know what I’m talking about. So far the appeals to bitmaps and possible poor performance demonstrate that the poster of the comments doesn’t have the slightest grasp of the problem, nor any real inkling of why it might be of very wide benefit. So let’s bring some reasoned and informed comment into this, please. Incidentally, play with LineForm if you want a practical demonstration of the usefulness, practicality and performance of these operations. –GrahamCox —-
Things that are slow now will not necessarily be slow in five years. Personally, I’d love to be able to union, difference and calc the intersections of paths. Aye!
I’m going to have to join the Ayes, mostly because I think I’ve found a solution. Namely, be lazy about making the union/intersection/xor, and store them as arrays of items to union/intersection/xor. Correct me if I’m wrong, but there’s three groups of functions to do with graphics: 1) Render, as in Stroke or Fill - In these cases, we are rasterizing the graphic anyways, and we know, from the draw context, everything about the device. In these cases, render the subregions, perform the math with these rasters, and all is solved. 2) Mathematical, such as determine if a point is within a region, or to translate the region. Here, there is no device dependance, but at the same time, it can be broken down. IE, a point is in a union if it’s in Subregion 1 OR Subregion 2. In an intersection if it’s in Subregion 1 AND Subregion 2. Again, no heavy lifting. 3) Computation, such as creating a polygon from a bezier curve. These are CPU-intensive anyways for other graphics, and more importantly, I believe this is the rarest of the tasks (I have no proof either way). As such, it’s okay if these are expensive, because they’re so rare. –Blain
I am certainly voting yes on this. There are algorithms to do this out there and they are well understood. It’s called constructive area geometry (CAG) in 2d and constructive solid geometry (CSG) in 3d. Java has an implementation in its Area class, which may or may not be open source already, but if it isn’t, there’s always the ClassPath open source project that also has an implementation out for it. The algorithms aren’t trivial but they aren’t prohibitively expensive, and incorporating them would be extremely convenient for those of us who do need them. –DanielPeebles