core :: Pointer :: premultiply_alpha
# Multiply RGB values by their alpha value
private fun premultiply_alpha(width, height: Int) `{
uint8_t *bytes = (uint8_t *)self;
int x, y, i = 0;
for(y = 0; y < height; y ++) {
for(x = 0; x < width; x ++) {
int a = bytes[i+3];
bytes[i ] = bytes[i ] * a / 255;
bytes[i+1] = bytes[i+1] * a / 255;
bytes[i+2] = bytes[i+2] * a / 255;
i += 4;
}
}
`}
lib/gamnit/textures.nit:399,2--412,3
# Disable out premultiply as we use only the one from Android
redef fun premultiply_alpha(width, height) do end
lib/gamnit/display_android.nit:88,2--89,50