CCControlButton should not require a CCScale9Sprite background

Why does CCControlButton require a CCScale9Sprite as the background?

There are many cases where this would be inefficient. as of rc2.0, the internal storage of the background was just a CCNode, so we changed the init methods to allow this to get initialized with a CCNode.

But the latest coco2dx switched this over to CCScale9Sprite in the internal storage.

What is the reason for this?

Button is a component without fixed size.
Using CCScale9Sprite prevent from any blur effect on the edges during stretching(scaling)

I understand the purpose of a ccscale9sprite in some cases. But it is not required in all situations. If it would accept a sprite, I could use a scale9 when needed and a regular sprite when I am not going to scale it.

EJ Mablekos wrote:

I understand the purpose of a ccscale9sprite in some cases. But it is not required in all situations. If it would accept a sprite, I could use a scale9 when needed and a regular sprite when I am not going to scale it.

A little late but I ran in to this also, and the solution for me was to set the inset rect accordingly so that everything is in the “center” section that gets scaled:

    CCScale9Sprite* newSprite = CCScale9Sprite::create("filename.png");
    CCSize oSize = newSprite->getOriginalSize();
    newSprite->setCapInsets(CCRect(0, 0, oSize.width, oSize.height));