Leif Andersen
Leif Andersen

Reputation: 22342

CGRect in C code

A simple google search for:

CGRect + C

or

CGRect in C

brings back only Apple, iPhone, and Objective-C websites. However, I remember hearing that Core Graphics was part of C at my university. Did I hear incorrectly, or is CGRect something that I can use in C, or even C++ as it's Object oriented?

Upvotes: 0

Views: 928

Answers (2)

Mark Bessey
Mark Bessey

Reputation: 19782

Well, you can use it in C or C++, but only on Apple platforms (Mac or iPhone). It's not a part of the standard C environment, if that's what you were asking.

Upvotes: 2

diciu
diciu

Reputation: 29343

CGRect is defined in Carbon, which is plain C:

#import <Carbon/Carbon.h>
int main()
{
    CGRect r;
}

If you look at preprocessor output you'll notice CGRect is just a plain struct:

$ gcc -E test.c | grep -A 3 "struct.*CGRect"
struct CGRect {
  CGPoint origin;
  CGSize size;
};
typedef struct CGRect CGRect;

Upvotes: 3

Related Questions