web平台加上cc.gfx.RB_FMT_D24S8解决了,但是安卓手机截图的时候还是会出现空白,有大佬能够指点一下吗?
这个确实是引擎的问题,只能自己在拿到rgba data再处理一下,下面是我自己用的代码 ,效果还可以。
getPixelDataIndex(i, j, width) {
return ((j * width) + i) * 4;
}
changeImageEdgeAlpha(data, width, height) {
for (let i = 0; i < width; i++) {
for (let j = 0; j < height; j++) {
let idx = this.getPixelDataIndex(i, j, width);
if (data[idx + 3] < 255 && data[idx + 3] > 0) {
if (data[idx] != 0 || data[idx + 1] != 0 || data[idx + 2] != 0) {
let canChangeAlpha = true;
let arr = [cc.v2(0, 1), cc.v2(0, -1), cc.v2(-1, 0), cc.v2(1, 0), cc.v2(-1, -1), cc.v2(-1, 1), cc.v2(1, 1), cc.v2(1, -1)];
for (let k = 0; k < arr.length; k++) {
let i2 = i + arr[k].x;
let j2 = j + arr[k].y;
if (i2 >= 0 && i2 < width && j2 >= 0 && j2 < height) {
let idx2 = this.getPixelDataIndex(i2, j2, width);
if (data[idx2 + 3] == 0) {
canChangeAlpha = false;
break;
}
}
}
if (canChangeAlpha) {
data[idx + 3] = 255;
}
}
}
}
}
}
好的,我试试,谢谢大佬
请问下,这些参数都是填什么呢?