开发者

CGRect in C code

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜