在native c++中加载图片后都会默认将透明度预乘
void Image::premultipliedAlpha()
{
CCASSERT(_renderFormat == Texture2D::PixelFormat::RGBA8888, "The pixel format should be RGBA8888!");
unsigned int* fourBytes = (unsigned int*)_data;
for(int i = 0; i < _width * _height; i++)
{
unsigned char* p = _data + i * 4;
fourBytes* = CC_RGB_PREMULTIPLY_ALPHA(p, p, p, p);
}
_hasPremultipliedAlpha = true;
}
```
而在html5版本中似乎没有这样做
导致的问题是在使用{GL_ONE, GL_ONE}这样的混合模式时会出现问题,可以用{GL_SRC_ALPHA, GL_DST_ALPHA}来解决,但是cocostudio1.6默认混合模式是 one,one和one,one-srcalpha。每次去修改很麻烦,最大的问题是native和html5没有统一。
请问html5上没法预乘还是有什么别的原因(webgl模式)
*