为了能够校准显示器,我必须能够以设备 RGB 值驱动它。
为了做到这一点,我通过以下方式创建一个 NSColor:
[NSColor colorWithDeviceRed:(colorsPtr[cnt]/255.0f) green:(colorsPtr[cnt+1]/255.0f)
blue:(colorsPtr[cnt+2]/255.0f) alpha:1.0]
然后我将此颜色放在视图上。
[colorView setColor:[colorsForMeasuring objectAtIndex:index]];
当我使用“数字色彩计”时,仅当视图显示在主监视器上时,才会应用此设备颜色,而不进行任何转换。因此仅在带有菜单栏的显示器上。
如果您将视图放在第二个显示器上,看起来好像发生了从主显示器的 RGB 到第二个显示器的 RGB 的转换。只有当两个显示器的色域之间存在很大差异时,您才会看到这一点。例如,我有一台配备 Eizo ColorEdge CG 245 的 MacBook Pro。如果您输入 [0 0 1.0],您可能会得到类似 [0.2 0.1 1.0] 的结果。
任何人都知道如何摆脱这种额外的转换。依我看来,deviceRGB 应该是 deviceRGB。为了为第二台显示器创建配置文件,这是强制性的。现在我必须将菜单栏移至第二台显示器,创建配置文件并将其移回。但对于我们的应用程序,客户需要能够进行验证,并且需要经常进行。同样的问题也出现在这里。
In order to be able to calibrate a monitor, I must be able to drive it in device RGB values.
In order to do this I create a NSColor by:
[NSColor colorWithDeviceRed:(colorsPtr[cnt]/255.0f) green:(colorsPtr[cnt+1]/255.0f)
blue:(colorsPtr[cnt+2]/255.0f) alpha:1.0]
And then I put this Color on the View.
[colorView setColor:[colorsForMeasuring objectAtIndex:index]];
When I use the "DigitalColor meter", this device color is only applied without any conversion when the View is shown on the primary monitor. So only on the monitor that has the menu bar on it.
In case you put the view on your second monitor, it looks as if there happens a conversion from RGB of main display to RGB of the second display. You only see this if there is a big difference between gamuts of both displays. I have a MacBook Pro with an Eizo ColorEdge CG 245 for example. If you then put [0 0 1.0] you might get something like [0.2 0.1 1.0].
Anyone an idea how to get rid of this extra conversion. Up to my opinion deviceRGB should be deviceRGB. In order to make a profile for the second monitor, this is mandatory. Now I have to move the menubar to the second monitor, create the profile and move it back. But with our application customers need to be able to do a validation and this needs to be done frequently. And the same problems occurs here.
发布评论
评论(1)
这对我来说听起来像是一个错误。我建议举报。
作为解决方法,您可以尝试实现一个自定义视图,在其中通过调用
CGContextSetRGBFillColor
和CGContextFillRect
来响应drawRect:
。 (您可以 从 href="http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSGraphicsContext_Class/Reference/Reference.html#//apple_ref/occ/clm/NSGraphicsContext/currentContext" rel=" nofollow">当前 NSGraphicsContext。)That sounds like a bug to me. I suggest reporting it.
As a workaround, you might try implementing a custom view in which you respond to
drawRect:
by callingCGContextSetRGBFillColor
andCGContextFillRect
. (You can get the CGContext from the current NSGraphicsContext.)