MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / stbi__create_png_alpha_expand8

Function stbi__create_png_alpha_expand8

include/stb/stb_image.h:4675–4693  ·  view source on GitHub ↗

adds an extra all-255 alpha channel dest == src is legal img_n must be 1 or 3

Source from the content-addressed store, hash-verified

4673// dest == src is legal
4674// img_n must be 1 or 3
4675static void stbi__create_png_alpha_expand8(stbi_uc *dest, stbi_uc *src, stbi__uint32 x, int img_n)
4676{
4677 int i;
4678 // must process data backwards since we allow dest==src
4679 if (img_n == 1) {
4680 for (i=x-1; i >= 0; --i) {
4681 dest[i*2+1] = 255;
4682 dest[i*2+0] = src[i];
4683 }
4684 } else {
4685 STBI_ASSERT(img_n == 3);
4686 for (i=x-1; i >= 0; --i) {
4687 dest[i*4+3] = 255;
4688 dest[i*4+2] = src[i*3+2];
4689 dest[i*4+1] = src[i*3+1];
4690 dest[i*4+0] = src[i*3+0];
4691 }
4692 }
4693}
4694
4695// create the png data from post-deflated data
4696static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 raw_len, int out_n, stbi__uint32 x, stbi__uint32 y, int depth, int color)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected