Projects > cpp > Issues > Bug #4850

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

Display image incorrectly.

Bug #4850 [Closed]
Ryeeeeee 2014-04-15 06:14 . Updated almost 6 years ago

When I add a Sprite with a image using v3.0rc0 or v3.0rc1, there is a black border around the sprite. but it works correctly with the v3.0alpha (I have not tested it with beta).

auto s2 = Sprite::create("circle.png");
s2->setPosition(100, 100);

However, when I use setBlendFunc(BlendFunc::ALPHA_PREMULTIPLIED), the black border disappear, but the image is not enough smooth.

auto s2 = Sprite::create("circle.png");
s2->setPosition(100, 100);

Finally, I have done some more tests. And I find the solution, if you add images edited by Photoshop CS6, it works well. But if you add images edited by other photo editor(such as illustrator or Photoshop CS5), the problem appears.

Sprites.jpg (169.2 kB) Ryeeeeee, 2014-04-15 06:14

button_menu_curve_yellow.png (6.5 kB) Ryeeeeee, 2014-04-17 07:57

circle.png (540 Bytes) Ryeeeeee, 2014-04-17 07:57

WenHai 2014-04-15 06:21
  • Priority changed from Low to Normal
  • Target version set to v3.1
WenHai 2014-04-17 07:51
  • Assignee set to boyu0
Ryeeeeee 2014-04-17 07:57
Sheado 2014-05-16 20:27


I'm experiencing a similar issue.
With v2.2.3 my graphics looked great and anti-aliased.
With v3.1alpha1 the same graphics look slightly, but noticeably aliased.

I tried premultiplying the source pngs (--premultiply-alpha flag in Texture Packer), but that did not help.
On a related note though: my spine animations did benefit from this, but my Sprite objects did not.

Is this a temporary alpha1 issue or is there something I need to be doing on my end to ensure anti-aliasing?

zhangxm 2014-05-20 06:18
  • Assignee changed from boyu0 to dabingnn
  • Target version changed from v3.1 to v3.2
dabingnn 2014-05-27 03:25

This is a intrinsic constrain caused by non premultiply alpha, to solve this, we need to add premultiply alpha back when reading image.

dabingnn 2014-05-27 03:28
dabingnn 2014-05-27 03:29
  • Assignee changed from dabingnn to vision
dabingnn 2014-06-04 09:29

We have added premultiply alpha back when loading png in pr:
It solves the problem.

zhangxm 2014-06-11 07:03
  • Status changed from New to Resolved
zhangxm 2014-06-25 03:35
  • Status changed from Resolved to Closed

Atom PDF

Start date:2014-04-15
Due date:
% Done:


Target version:v3.2