Re: Avoid drawing in half pixel
Re: Avoid drawing in half pixel
- Subject: Re: Avoid drawing in half pixel
- From: Gustavo Pizano <email@hidden>
- Date: Wed, 5 May 2010 17:57:55 +0200
from apps docs
"During layout, make sure views and images are positioned on integral pixel boundaries."
this is what Im doing wrong I think... the problem is how to correct it, because when I resize the splitview of course its not staying in a integral pixel.. thats when I see the lines bigger than normal.
Gustavo
On May 5, 2010, at 5:51 PM, Rob Ross wrote:
> Try turning off anti-aliasing. Also see :
>
> http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Transforms/Transforms.html#//apple_ref/doc/uid/TP40003290-CH204-BCICIJAJ
>
> Rob
>
> On May 5, 2010, at 8:18 AM, Gustavo Pizano wrote:
>
>> Hello all.
>>
>> I have a split view and inside I have custom views, in one subview Im drawing lines with a NSBezierPath, and when I move the divider I see sometimes the lines very thin some others no, so I know this last behavior its because Im drawing in half a pixel.
>>
>> I was reading the apple docs about this topic, and I tried at the beginning of my drawRect method I did as in "Converting Coordinate Values" topic suggest to convert my starting drawing point, but that din't help. I still see the above behavior.
>> I realize then that when I resize the window I have the same behavior, so what I did was in the windowDelegate windowWillResize method, I did the following:
>>
>> if((NSInteger)frameSize.width % 2 != 0){
>> frameSize.width += 1.0f;
>>
>> }
>> if((NSInteger)frameSize.height % 2 != 0){
>> frameSize.height += 1.0f;
>> }
>>
>> and when I resize the window I don't see hte problem anymore. I tried applying this same to the splitview delegate when resizing, but unfortunately this approach didn't work well, I started getting warnings in the console that the size of the subviews weren't correct and it was being recalculated at the cost of performance.
>>
>> So any other idea on what can I do to avoid this behavior?
>>
>> Thanks
>>
>> Gustavo
_______________________________________________
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