Skip to content

Instantly share code, notes, and snippets.

View ruilin's full-sized avatar

ruilin zheng ruilin

  • Relink
  • GBK
View GitHub Profile
@ruilin
ruilin / alpha blend图层合并算法
Last active October 10, 2018 01:26
带alpha通道的图层合并算法,实现多个图层叠加后产生的新图层rgba数据
int clamp(int val) {
if (val < 0) return 0;
if (val > 255) return 255;
return val;
}
unsigned char layerMerge(unsigned char **layers, unsigned int layerCount, unsigned int layerWidth, unsigned int layerHeight) {
if (1 >= layerCount) return 0;
unsigned char isNewLayer = 0;
unsigned int i, j, byteCount;