difference between clipping node and ccSpriteframe?
we can clip the frame using frameWithTexture of CCSpriteFrame t开发者_StackOverflow社区hrough CCSpriteSheet.but what is the difference between clipping node and this CCSpriteFrame?
Clipping is not the same as sprite frames.
A sprite frame defines an area on a texture, which in turn allows a sprite to draw that part of a texture. It enables the use of a texture atlas, ie multiple images combined into a single texture. This is a Cocos2D feature.
A clipping node defines an area on the screen on which content is drawn, but everything that is outside that frame isn't drawn (clipped). The clipping happens exactly at the clipping boundary, ie. only the part of a sprite that is within the clipping region is drawn. This is an OpenGL feature, typically wrapped in a Cocos2D node for easier placement.
Clipping is a simplified form of a stencil in that it can only define a rectangular area.
精彩评论