Re: How to draw whole NSImage inside custom rect in NSView
Re: How to draw whole NSImage inside custom rect in NSView
- Subject: Re: How to draw whole NSImage inside custom rect in NSView
- From: Alexander Shmelev <email@hidden>
- Date: Wed, 12 Nov 2008 20:46:28 +0300
Thank you, I have multiplied all value by 1000. And it works.
BR, Alexander.
On 12.11.2008, at 2:30, Graham Cox wrote:
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