开发者

CGRect in C code

开发者 https://www.devze.com 2022-12-23 07:11 出处:网络
A simple google search for: CGRect + C or CGRect in C brings back only Apple, iP开发者_如何学Gohone, and Objective-C websites.However, I remember hearing that Core Graphics was part of C at my

A simple google search for:

CGRect + C

or

CGRect in C

brings back only Apple, iP开发者_如何学Gohone, 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?


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;


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号