Lines Matching refs:alpha

628  * image has alpha or transparency, and png_handle_alpha()[*] has been
640 * alpha channel or a transparency chunk, you must provide a buffer for
910 /* Read the entire image. If the image has an alpha channel or a tRNS
1347 /* Strip alpha bytes from the input data without combining with
1379 * Expand paletted or RGB images with transparency to full alpha
1438 /* Invert the alpha channel from opacity to transparency */
1526 #define PNG_CMAP_GA 1 /* Process GA data to a color-map with alpha */
1981 png_uint_32 foreground, int foreground_encoding, png_uint_32 alpha,
1986 * file and alpha are 8-bit values. The (output) encoding will always be
1992 /* The alpha is always an 8-bit value (it comes from the palette), the value
1995 f = f * alpha + b * (255-alpha);
2019 png_uint_32 alpha, int encoding)
2054 alpha *= 257;
2075 alpha *= 257;
2088 alpha *= 257;
2110 alpha = PNG_DIV257(alpha);
2122 alpha = PNG_DIV257(alpha);
2150 /* The linear 16-bit values must be pre-multiplied by the alpha channel
2152 * if the alpha channel is removed.)
2157 entry[afirst ? 0 : 3] = (png_uint_16)alpha;
2161 if (alpha < 65535)
2163 if (alpha > 0)
2165 blue = (blue * alpha + 32767U)/65535U;
2166 green = (green * alpha + 32767U)/65535U;
2167 red = (red * alpha + 32767U)/65535U;
2179 entry[1 ^ afirst] = (png_uint_16)alpha;
2183 if (alpha < 65535)
2185 if (alpha > 0)
2186 green = (green * alpha + 32767U)/65535U;
2208 entry[afirst ? 0 : 3] = (png_byte)alpha;
2217 entry[1 ^ afirst] = (png_byte)alpha;
2266 * selected by six levels of alpha. One transparent entry, 6 gray
2267 * levels for all the intermediate alpha values, leaving 230 entries
2272 * if (alpha > 229) // opaque
2278 * else if (alpha < 26) // transparent
2285 * base = 226 + 6 * PNG_DIV51(alpha);
2375 png_ptr->num_trans > 0) /* alpha in input */ &&
2376 ((output_format & PNG_FORMAT_FLAG_ALPHA) == 0) /* no alpha in output */)
2383 "background color must be supplied to remove alpha/transparency");
2453 * value or, if the output has no alpha, the background color.
2481 * there is an alpha channel (back_alpha == 0), but it does no
2510 * special processing; add an alpha channel, sacrifice gray level
2511 * 254 and convert transparent (alpha==0) entries to that.
2518 * If the output has no alpha channel *and* the background color is
2564 /* NOTE: does this work without expanding tRNS to alpha?
2609 /* 8-bit or 16-bit PNG with two channels - gray and alpha. A minimum
2610 * of 65536 combinations. If, however, the alpha channel is to be
2616 * worry about tRNS matching - tRNS is ignored if there is an alpha
2624 png_error(png_ptr, "gray+alpha color-map: too few entries");
2632 else /* alpha is removed */
2642 * level color values, one set for each intermediate alpha value.
2658 png_error(png_ptr, "gray-alpha color-map: too few entries");
2692 png_error(png_ptr, "ga-alpha color-map: too few entries");
2728 * used when alpha != 0
2740 * by an 8-bit alpha value (0..255).
2742 png_uint_32 alpha = 51 * a;
2743 png_uint_32 back_rx = (255-alpha) * back_r;
2744 png_uint_32 back_gx = (255-alpha) * back_g;
2745 png_uint_32 back_bx = (255-alpha) * back_b;
2749 png_uint_32 gray = png_sRGB_table[g*51] * alpha;
2783 /* The output will now be one or two 8-bit gray or gray+alpha
2784 * channels. The more complex case arises when the input has alpha.
2790 /* Both input and output have an alpha channel, so no background
2806 /* Either the input or the output has no alpha channel, so there
2814 * but if an input alpha channel is to be removed we will hit the
2832 /* But if the input has alpha or transparency it must be removed
2898 * color or alpha; png_quantize ignores alpha. Easier overall just
2904 /* Is there any transparency or alpha? */
2908 /* Is there alpha in the output too? If so all four channels are
2909 * processed into a special RGB cube with alpha support.
2916 png_error(png_ptr, "rgb+alpha color-map: too few entries");
2929 /* Add 27 r,g,b entries each with alpha 0.5. */
2965 png_error(png_ptr, "rgb-alpha color-map: too few entries");
3001 * the background at alpha 0.5.
3044 else /* no alpha or transparency in the input */
3278 unsigned int alpha = *inrow++;
3285 if (alpha > 229) /* opaque */
3289 else if (alpha < 26) /* transparent */
3295 entry = 226 + 6 * PNG_DIV51(alpha) + PNG_DIV51(gray);
3306 png_byte alpha = *inrow++;
3308 if (alpha == 0)
3330 unsigned int alpha = inrow[3];
3332 /* Because the alpha entries only hold alpha==0.5 values
3333 * split the processing at alpha==0.25 (64) and 0.75
3337 if (alpha >= 196)
3341 else if (alpha < 64)
3360 * So, as above with the explicit alpha checks, the
3592 png_byte alpha = inrow[channels];
3594 if (alpha > 0) /* else no change to the output */
3602 if (alpha < 255) /* else just use component */
3611 component += (255-alpha)*png_sRGB_table[outrow[c]];
3624 inrow += channels+1; /* components and alpha channel */
3643 * happening inside libpng, so this routine sees an 8 or 16-bit gray+alpha
3644 * row and handles the removal or pre-multiplication of the alpha channel.
3661 * might be 8 or 16-bit but should always have two channels; gray plus alpha.
3672 /* Expect the 8-bit case to always remove the alpha channel */
3699 /* 8-bit sRGB gray values with an alpha channel; the alpha channel is
3749 png_byte alpha = inrow[1];
3751 if (alpha > 0) /* else no change to the output */
3755 if (alpha < 255) /* else just use component */
3759 * function and multiply the alpha out.
3761 component = png_sRGB_table[component] * alpha;
3763 (255-alpha);
3770 inrow += 2; /* gray and alpha channel */
3794 png_byte alpha = inrow[1];
3796 if (alpha > 0) /* else use background */
3800 if (alpha < 255) /* else just use component */
3802 component = png_sRGB_table[component] * alpha;
3803 component += background * (255-alpha);
3813 inrow += 2; /* gray and alpha channel */
3824 /* 16-bit linear with pre-multiplied alpha; the pre-multiplication must
3825 * still be done and, maybe, the alpha channel removed. This code also
3826 * handles the alpha-first option.
3890 png_uint_16 alpha = inrow[1];
3892 if (alpha > 0) /* else 0 */
3894 if (alpha < 65535) /* else just use component */
3896 component *= alpha;
3907 outrow[1 ^ swap_alpha] = alpha;
3909 inrow += 2; /* components and alpha channel */
3953 int mode; /* alpha mode */
4006 /* If there *is* an alpha channel in the input it must be multiplied
4010 mode = PNG_ALPHA_STANDARD; /* associated alpha */
4070 /* Now the background/alpha channel changes. */
4073 /* Removing an alpha channel requires composition for the 8-bit
4079 /* If RGB->gray is happening the alpha channel must be left and the
4116 /* This leaves the alpha channel in the output, so it has to be
4125 else /* output needs an alpha channel */
4129 * alpha channel (weird API), so it must be added in the correct
4159 /* Now set the alpha mode correctly; this is always done, even if there is
4160 * no alpha channel in either the input or the output because it correctly
4184 /* Only relevant if there is an alpha channel - it's particularly
4186 * be set above and then libpng will keep the alpha channel for this
4253 png_error(png_ptr, "png_image_read: alpha channel lost");
4279 png_error(png_ptr, "unexpected alpha swap transformation");