Re: Doubled Pixels
Re: Doubled Pixels
- Subject: Re: Doubled Pixels
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Mon, 26 Jun 2017 11:28:51 +0700
> On 26 Jun 2017, at 08:03, Graham Cox <email@hidden> wrote:
>
>> On 25 Jun 2017, at 7:39 pm, Gerriet M. Denkmann <email@hidden> wrote:
>>
>> Which of these two lines is preferable:
>> NSString *colorSpaceName = useColour ? NSDeviceRGBColorSpace :
>> NSDeviceWhiteColorSpace;
>> NSString *colorSpaceName = useColour ? NSCalibratedRGBColorSpace :
>> NSCalibratedWhiteColorSpace;
>> ?
>
> Well, it depends on what you want to do with the image. If it’s content that
> gets displayed or printed, then calibrated ensures that it will look the same
> across a range of devices.
As my pixels are either white or black, this “Calibrated” seems not to be
important.
Also: it bloats my images:
// Device subPngData 337 bytes b&w
// Calibrated subPngData 1434 bytes b&w
So I’ll stick with “Device”.
>>> You may want to save and restore the current context around this, just to
>>> be sure your method isn’t going to have the unwanted side effect of
>>> changing the current context. It’s likely OK, but better safe than sorry.
>>
>> I just did. Turns out that the oldContext seems to be nil. But as you
>> rightly said: “better safe than sorry”.
>
> You just needs to use +[NSGraphicsContext saveGraphicsState]; and
> +[NSGraphicsContext restoreGraphicsState]; if you know currentContext is nil,
> it suggests you aren’t doing it that way.
Thanks. I have just updated my code.
Thanks again for your help!
Kind regards,
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden