• 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: How to draw whole NSImage inside custom rect in NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to draw whole NSImage inside custom rect in NSView


  • Subject: Re: How to draw whole NSImage inside custom rect in NSView
  • From: Graham Cox <email@hidden>
  • Date: Wed, 12 Nov 2008 10:30:51 +1100


On 12 Nov 2008, at 9:56 am, Alexander Shmelev wrote:

Actually, I have one idea why this happens.
Maybe because usually width=8, height = 14 so [self bounds] returns NSRect(0,0,8.64,14.64). And
maxScanArea = NSRect(0.32, 0.32, 8, 14). So there can be some approximation to integer value, not float.


But it it is true, how to deal with this?


I have noticed some inaccuracy with NSImage when drawing into very small non-integer rectangles. I didn't investigate too deeply but it seemed to be related to caching the image into a bitmap which of course has to have a whole number of pixels. I found a workaround in my case which was to suppress caching and draw the image at a larger size, changing the CTM on the fly to place it into my destination area. I'm afraid this was about 18 months ago so I forget the details and I can't put my finger on the precise code in question - but that was the gist of it.

--Graham
_______________________________________________

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: How to draw whole NSImage inside custom rect in NSView
      • From: Alexander Shmelev <email@hidden>
References: 
 >How to draw whole NSImage inside custom rect in NSView (From: Alexander Shmelev <email@hidden>)
 >Re: How to draw whole NSImage inside custom rect in NSView (From: "Ken Ferry" <email@hidden>)
 >Re: How to draw whole NSImage inside custom rect in NSView (From: Alexander Shmelev <email@hidden>)

  • Prev by Date: RE: Process Priority
  • Next by Date: Re: Process Priority
  • Previous by thread: Re: How to draw whole NSImage inside custom rect in NSView
  • Next by thread: Re: How to draw whole NSImage inside custom rect in NSView
  • Index(es):
    • Date
    • Thread