2013-01-21 227 views
0

我在CGContext上参考CGContextRef究竟是什么?

typedef struct CGContext * CGContextRef; 

一直在寻找核心图形框架的文档和周围发现这个是什么,这实际上意味着?它是一个指向CGContext的指针吗?另外,当我看看CGColor CGColorRef是这样的:

typedef struct CGColor *CGColorRef; 

这两者之间有什么区别?

感谢您的帮助!

回答

1

是的,它们只是指向CGContext或CGColor的指针的快捷方式。

所以你可以写

CGColorRef myreference;

而不是

CGColor * myreference;

+0

好的,但空间是否意味着什么? – user1628311

+3

@ user1628311:'int * a,b'与'int * a,b' *只与a相关,而不与b相关。所以在这种情况下,空间不会发挥任何作用。 –

0

CGContextCGColor是两种结构;另外两个CGContextRefCGColorRef是它们各自的指针类型。

这就像typedef int* myIntegerPointer;

只是比较:typedef CGContext* CGContextRef;

编辑:

int* a, b是一样int *a, b

*仅与a关联,而不与b关联。所以在这种情况下,空间不会发挥任何作用。