• 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: Casting NSRect to CGRect?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Casting NSRect to CGRect?


  • Subject: Re: Casting NSRect to CGRect?
  • From: Ricky Sharp <email@hidden>
  • Date: Thu, 17 Jan 2002 19:24:26 -0600

I have a DrawRect method in a custom view - which takes an NSRect - as it should. I want to use this data in a CG call that expects a CGRect - I delved into the docs and the structs that define them are the same - is there an easy way to get from one to the other?

Just cast it. They're the same thing:

NSRect foundationRect;
CGRect coreGraphicsRect = (CGRect) foundationRect;

But I get:

'conversion to a non-scalar type requested'?

Hmm...it's ugly, but you can do:

NSRect foundationRect;
CGRect coreGraphicsRect = *((CGRect*) &foundationRect);

___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Founder & President
Instant Interactive(tm) http://www.instantinteractive.com


References: 
 >Re: Casting NSRect to CGRect? (From: Pete Carss <email@hidden>)

  • Prev by Date: Re: Casting NSRect to CGRect?
  • Next by Date: Of Cells, TableViews and Matrices
  • Previous by thread: Re: Casting NSRect to CGRect?
  • Next by thread: Re: Casting NSRect to CGRect?
  • Index(es):
    • Date
    • Thread