Blend function for UIImageView (#18149)

This commit is contained in:
newnon 2017-08-22 04:40:37 +03:00 committed by minggo
parent 0bebd83f6b
commit 04b2dbbcdb
2 changed files with 29 additions and 1 deletions

View File

@ -315,6 +315,16 @@ void ImageView::setGLProgramState(cocos2d::GLProgramState* glProgramState)
_imageRenderer->setGLProgramState(glProgramState);
}
void ImageView::setBlendFunc(const BlendFunc &blendFunc)
{
_imageRenderer->setBlendFunc(blendFunc);
}
const BlendFunc& ImageView::getBlendFunc() const
{
return _imageRenderer->getBlendFunc();
}
}
NS_CC_END

View File

@ -41,7 +41,7 @@ namespace ui {
/**
* @brief A widget to display images.
*/
class CC_GUI_DLL ImageView : public Widget
class CC_GUI_DLL ImageView : public Widget , public cocos2d::BlendProtocol
{
DECLARE_CLASS_GUI_INFO
@ -117,6 +117,24 @@ public:
* @see `setCapInsets(const Rect&)`
*/
const Rect& getCapInsets()const;
/**
* Sets the source blending function.
*
* @param blendFunc A structure with source and destination factor to specify pixel arithmetic. e.g. {GL_ONE, GL_ONE}, {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA}.
* @js NA
* @lua NA
*/
virtual void setBlendFunc(const BlendFunc &blendFunc) override;
/**
* Returns the blending function that is currently being used.
*
* @return A BlendFunc structure with source and destination factor which specified pixel arithmetic.
* @js NA
* @lua NA
*/
virtual const BlendFunc &getBlendFunc() const override;
//override methods.
virtual void ignoreContentAdaptWithSize(bool ignore) override;