• 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: drawRect: wrong scale in a programmatically created window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: drawRect: wrong scale in a programmatically created window
      • From: Andreas Höschler <email@hidden>
References: 
 >drawRect: wrong scale in a programmatically created window (From: Andreas Höschler <email@hidden>)

  • Prev by Date: NSTableView registerNib:forIdentifier: - multiple IDs in a single NIB
  • Next by Date: Re: NSTableView registerNib:forIdentifier: - multiple IDs in a single NIB
  • Previous by thread: drawRect: wrong scale in a programmatically created window
  • Next by thread: Re: drawRect: wrong scale in a programmatically created window
  • Index(es):
    • Date
    • Thread