• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Avoid drawing in half pixel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoid drawing in half pixel


  • Subject: Re: Avoid drawing in half pixel
  • From: Rob Ross <email@hidden>
  • Date: Wed, 5 May 2010 08:51:05 -0700

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

  • Follow-Ups:
    • Re: Avoid drawing in half pixel
      • From: Gustavo Pizano <email@hidden>
References: 
 >Avoid drawing in half pixel (From: Gustavo Pizano <email@hidden>)

  • Prev by Date: Re: Authenticate NSFileManager Operations
  • Next by Date: Re: Avoid drawing in half pixel
  • Previous by thread: Re: Avoid drawing in half pixel
  • Next by thread: Re: Avoid drawing in half pixel
  • Index(es):
    • Date
    • Thread