Skip to content

Commit

Permalink
添加了一个给屏幕取快照的接口
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyufei49 committed Sep 16, 2014
1 parent 3dd2baf commit 7ea362d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Classes/FilterNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@ GaussianBlur*GaussianBlur::screenBlurNodeInstance()
return _scSizeBlurNode;
}

GaussianBlur* GaussianBlur::takeScreenCapture()
{
GaussianBlur* n = screenBlurNodeInstance();
CCNode* s = CCDirector::sharedDirector()->getRunningScene();
if (s) {
CCPoint a = s->getAnchorPoint();
s->setAnchorPoint(CCPointZero);
n->reset(s);
s->setAnchorPoint(a);
return n;
}
return NULL;
}

bool GaussianBlur::init(CCNode* src, const CCSize& size, bool reused)
{
bool bRet = false;
Expand Down
1 change: 1 addition & 0 deletions Classes/FilterNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class GaussianBlur : public CCNode, public FilterProto
* @brief screenBlurNode 获取一个屏幕大小的模糊单例
*/
static GaussianBlur* screenBlurNodeInstance();
static GaussianBlur* takeScreenCapture();
public:
bool init(CCNode* src, const CCSize& size, bool reused = false);
/**
Expand Down

0 comments on commit 7ea362d

Please sign in to comment.