Re: drawRect: wrong scale in a programmatically created window
Re: drawRect: wrong scale in a programmatically created window
- Subject: Re: drawRect: wrong scale in a programmatically created window
- From: Quincey Morris <email@hidden>
- Date: Thu, 14 Jan 2016 15:01:46 -0800
- Feedback-id: 167118m:167118agrif8a:167118sOj-s-pjNg:SMTPCORP
On Jan 14, 2016, at 13:26 , Andreas Höschler <email@hidden> wrote:
>
> This should in a view with size {851, 899} get me a purple line starting close to the lower left corner and ending close to the top right corner. But that's not the case. The picture is drawn zoomed in!??
I’m not sure I understand completely. The image is drawn “zoomed in”, or the purple rectangle is drawn “zoomed in”, or both?
Note that the NSBitmapImageRep has dimensions in pixels, The rectangle’s coordinates are in points. You don’t show any code that’s drawing the image back to the screen (if that’s what you’re doing), but NSImage dimensions (the ‘size’ property) is also in points, not pixels, even when the bitmap image rep is in pixels.
But if the purple rectangle is much too big, then it sounds like this is nothing to do with the image. Instead, your view is getting set to a size that’s much bigger than the window. One possible reason is that your window hierarchy is subject to autolayout, and your constraints are making the view bigger than the window.
Probably, your next step is to log all the coordinates and sizes, of windows, view, images and image reps that are used in your code (at the time drawing happens).
_______________________________________________
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