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

Function stbi__compute_transparency16

include/stb/stb_image.h:4931–4954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4929}
4930
4931static int stbi__compute_transparency16(stbi__png *z, stbi__uint16 tc[3], int out_n)
4932{
4933 stbi__context *s = z->s;
4934 stbi__uint32 i, pixel_count = s->img_x * s->img_y;
4935 stbi__uint16 *p = (stbi__uint16*) z->out;
4936
4937 // compute color-based transparency, assuming we've
4938 // already got 65535 as the alpha value in the output
4939 STBI_ASSERT(out_n == 2 || out_n == 4);
4940
4941 if (out_n == 2) {
4942 for (i = 0; i < pixel_count; ++i) {
4943 p[1] = (p[0] == tc[0] ? 0 : 65535);
4944 p += 2;
4945 }
4946 } else {
4947 for (i = 0; i < pixel_count; ++i) {
4948 if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2])
4949 p[3] = 0;
4950 p += 4;
4951 }
4952 }
4953 return 1;
4954}
4955
4956static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int len, int pal_img_n)
4957{

Callers 1

stbi__parse_png_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected