Home | History | Annotate | Download | only in libpng

Lines Matching full:alpha

617  * image has alpha or transparency, and png_handle_alpha()[*] has been
629 * alpha channel or a transparency chunk, you must provide a buffer for
681 /* Read the entire image. If the image has an alpha channel or a tRNS
1075 /* Strip alpha bytes from the input data without combining with
1107 * Expand paletted or RGB images with transparency to full alpha
1166 /* Invert the alpha channel from opacity to transparency */
1254 #define PNG_CMAP_GA 1 /* Process GA data to a color-map with alpha */
1707 png_uint_32 foreground, int foreground_encoding, png_uint_32 alpha,
1712 * file and alpha are 8-bit values. The (output) encoding will always be
1718 /* The alpha is always an 8-bit value (it comes from the palette), the value
1721 f = f * alpha + b * (255-alpha);
1745 png_uint_32 alpha, int encoding)
1780 alpha *= 257;
1801 alpha *= 257;
1814 alpha *= 257;
1836 alpha = PNG_DIV257(alpha);
1848 alpha = PNG_DIV257(alpha);
1876 /* The linear 16-bit values must be pre-multiplied by the alpha channel
1878 * if the alpha channel is removed.)
1883 entry[afirst ? 0 : 3] = (png_uint_16)alpha;
1887 if (alpha < 65535)
1889 if (alpha > 0)
1891 blue = (blue * alpha + 32767U)/65535U;
1892 green = (green * alpha + 32767U)/65535U;
1893 red = (red * alpha + 32767U)/65535U;
1905 entry[1 ^ afirst] = (png_uint_16)alpha;
1909 if (alpha < 65535)
1911 if (alpha > 0)
1912 green = (green * alpha + 32767U)/65535U;
1934 entry[afirst ? 0 : 3] = (png_byte)alpha;
1942 entry[1 ^ afirst] = (png_byte)alpha;
1989 /* Alpha is retained, the output will be a color-map with entries
1990 * selected by six levels of alpha. One transparent entry, 6 gray
1991 * levels for all the intermediate alpha values, leaving 230 entries
1996 * if (alpha > 229) // opaque
2002 * else if (alpha < 26) // transparent
2009 * base = 226 + 6 * PNG_DIV51(alpha);
2099 png_ptr->num_trans > 0) /* alpha in input */ &&
2100 ((output_format & PNG_FORMAT_FLAG_ALPHA) == 0) /* no alpha in output */)
2107 "background color must be supplied to remove alpha/transparency");
2177 * value or, if the output has no alpha, the background color.
2205 * there is an alpha channel (back_alpha == 0), but it does no
2234 * special processing; add an alpha channel, sacrifice gray level
2235 * 254 and convert transparent (alpha==0) entries to that.
2242 * If the output has no alpha channel *and* the background color is
2288 /* NOTE: does this work without expanding tRNS to alpha?
2333 /* 8-bit or 16-bit PNG with two channels - gray and alpha. A minimum
2334 * of 65536 combinations. If, however, the alpha channel is to be
2340 * worry about tRNS matching - tRNS is ignored if there is an alpha
2348 png_error(png_ptr, "gray+alpha color-map: too few entries");
2356 else /* alpha is removed */
2358 /* Alpha must be removed as the PNG data is processed when the
2366 * level color values, one set for each intermediate alpha value.
2382 png_error(png_ptr, "gray-alpha color-map: too few entries");
2416 png_error(png_ptr, "ga-alpha color-map: too few entries");
2452 * used when alpha != 0
2464 * by an 8-bit alpha value (0..255).
2466 png_uint_32 alpha = 51 * a;
2467 png_uint_32 back_rx = (255-alpha) * back_r;
2468 png_uint_32 back_gx = (255-alpha) * back_g;
2469 png_uint_32 back_bx = (255-alpha) * back_b;
2473 png_uint_32 gray = png_sRGB_table[g*51] * alpha;
2507 /* The output will now be one or two 8-bit gray or gray+alpha
2508 * channels. The more complex case arises when the input has alpha.
2514 /* Both input and output have an alpha channel, so no background
2530 /* Either the input or the output has no alpha channel, so there
2538 * but if an input alpha channel is to be removed we will hit the
2556 /* But if the input has alpha or transparency it must be removed
2622 * color or alpha; png_quantize ignores alpha. Easier overall just
2628 /* Is there any transparency or alpha? */
2632 /* Is there alpha in the output too? If so all four channels are
2633 * processed into a special RGB cube with alpha support.
2640 png_error(png_ptr, "rgb+alpha color-map: too few entries");
2653 /* Add 27 r,g,b entries each with alpha 0.5. */
2677 /* Alpha/transparency must be removed. The background must
2689 png_error(png_ptr, "rgb-alpha color-map: too few entries");
2725 * the background at alpha 0.5.
2768 else /* no alpha or transparency in the input */
2770 /* Alpha in the output is irrelevant, simply map the opaque input
3002 unsigned int alpha = *inrow++;
3009 if (alpha > 229) /* opaque */
3013 else if (alpha < 26) /* transparent */
3019 entry = 226 + 6 * PNG_DIV51(alpha) + PNG_DIV51(gray);
3030 png_byte alpha = *inrow++;
3032 if (alpha == 0)
3054 unsigned int alpha = inrow[3];
3056 /* Because the alpha entries only hold alpha==0.5 values
3057 * split the processing at alpha==0.25 (64) and 0.75
3061 if (alpha >= 196)
3065 else if (alpha < 64)
3084 * So, as above with the explicit alpha checks, the
3317 png_byte alpha = inrow[channels];
3319 if (alpha > 0) /* else no change to the output */
3327 if (alpha < 255) /* else just use component */
3336 component += (255-alpha)*png_sRGB_table[outrow[c]];
3349 inrow += channels+1; /* components and alpha channel */
3368 * happening inside libpng, so this routine sees an 8 or 16-bit gray+alpha
3369 * row and handles the removal or pre-multiplication of the alpha channel.
3386 * might be 8 or 16-bit but should always have two channels; gray plus alpha.
3397 /* Expect the 8-bit case to always remove the alpha channel */
3424 /* 8-bit sRGB gray values with an alpha channel; the alpha channel is
3474 png_byte alpha = inrow[1];
3476 if (alpha > 0) /* else no change to the output */
3480 if (alpha < 255) /* else just use component */
3484 * function and multiply the alpha out.
3486 component = png_sRGB_table[component] * alpha;
3488 (255-alpha);
3495 inrow += 2; /* gray and alpha channel */
3519 png_byte alpha = inrow[1];
3521 if (alpha > 0) /* else use background */
3525 if (alpha < 255) /* else just use component */
3527 component = png_sRGB_table[component] * alpha;
3528 component += background * (255-alpha);
3538 inrow += 2; /* gray and alpha channel */
3549 /* 16-bit linear with pre-multiplied alpha; the pre-multiplication must
3550 * still be done and, maybe, the alpha channel removed. This code also
3551 * handles the alpha-first option.
3614 png_uint_16 alpha = inrow[1];
3616 if (alpha > 0) /* else 0 */
3618 if (alpha < 65535) /* else just use component */
3620 component *= alpha;
3631 outrow[1 ^ swap_alpha] = alpha;
3633 inrow += 2; /* components and alpha channel */
3677 int mode; /* alpha mode */
3730 /* If there *is* an alpha channel in the input it must be multiplied
3734 mode = PNG_ALPHA_STANDARD; /* associated alpha */
3788 /* Now the background/alpha channel changes. */
3791 /* Removing an alpha channel requires composition for the 8-bit
3797 /* If RGB->gray is happening the alpha channel must be left and the
3834 /* This leaves the alpha channel in the output, so it has to be
3843 else /* output needs an alpha channel */
3847 * alpha channel (weird API), so it must be added in the correct
3877 /* Now set the alpha mode correctly; this is always done, even if there is
3878 * no alpha channel in either the input or the output because it correctly
3902 /* Only relevant if there is an alpha channel - it's particularly
3904 * be set above and then libpng will keep the alpha channel for this
3971 png_error(png_ptr, "png_image_read: alpha channel lost");
3993 png_error(png_ptr, "unexpected alpha swap transformation");