Functions for image drawing. More...
Functions | |
SIMD_API void | SimdAlphaBlending (const uint8_t *src, size_t srcStride, size_t width, size_t height, size_t channelCount, const uint8_t *alpha, size_t alphaStride, uint8_t *dst, size_t dstStride) |
Performs alpha blending operation. More... | |
SIMD_API void | SimdAlphaFilling (uint8_t *dst, size_t dstStride, size_t width, size_t height, const uint8_t *channel, size_t channelCount, const uint8_t *alpha, size_t alphaStride) |
Performs alpha filling operation. More... | |
SIMD_API void | SimdAlphaPremultiply (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t *dst, size_t dstStride) |
Performs premultiply operation. More... | |
SIMD_API void | SimdAlphaUnpremultiply (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t *dst, size_t dstStride) |
Performs unpremultiply operation. More... | |
template<template< class > class A> | |
SIMD_INLINE void | AlphaBlending (const View< A > &src, const View< A > &alpha, View< A > &dst) |
Performs alpha blending operation. More... | |
template<template< class > class A, class Pixel > | |
SIMD_INLINE void | AlphaFilling (View< A > &dst, const Pixel &pixel, const View< A > &alpha) |
Performs alpha filling operation. More... | |
template<template< class > class A> | |
SIMD_INLINE void | AlphaPremultiply (const View< A > &src, View< A > &dst) |
Performs premultiply operation. More... | |
template<template< class > class A> | |
SIMD_INLINE void | AlphaUnpremultiply (const View< A > &src, View< A > &dst) |
Performs unpremultiply operation. More... | |
Detailed Description
Functions for image drawing.
Function Documentation
◆ SimdAlphaBlending()
void SimdAlphaBlending | ( | const uint8_t * | src, |
size_t | srcStride, | ||
size_t | width, | ||
size_t | height, | ||
size_t | channelCount, | ||
const uint8_t * | alpha, | ||
size_t | alphaStride, | ||
uint8_t * | dst, | ||
size_t | dstStride | ||
) |
Performs alpha blending operation.
All images must have the same width and height. Source and destination images must have the same format (8 bit per channel, for example GRAY8, BGR24 or BGRA32). Alpha must be 8-bit gray image.
For every point:
dst[x, y, c] = (src[x, y, c]*alpha[x, y] + dst[x, y, c]*(255 - alpha[x, y]))/255;
This function is used for image drawing.
- Note
- This function has a C++ wrapper Simd::AlphaBlending(const View<A>& src, const View<A>& alpha, View<A>& dst).
- Parameters
-
[in] src - a pointer to pixels data of foreground image. [in] srcStride - a row size of the foreground image. [in] width - an image width. [in] height - an image height. [in] channelCount - a channel count for foreground and background images (1 <= channelCount <= 4). [in] alpha - a pointer to pixels data of image with alpha channel. [in] alphaStride - a row size of the alpha image. [in,out] dst - a pointer to pixels data of background image. [in] dstStride - a row size of the background image.
◆ SimdAlphaFilling()
void SimdAlphaFilling | ( | uint8_t * | dst, |
size_t | dstStride, | ||
size_t | width, | ||
size_t | height, | ||
const uint8_t * | channel, | ||
size_t | channelCount, | ||
const uint8_t * | alpha, | ||
size_t | alphaStride | ||
) |
Performs alpha filling operation.
All images must have the same width and height. Destination images must have 8 bit per channel (for example GRAY8, BGR24 or BGRA32). Alpha must be 8-bit gray image.
For every point:
dst[x, y, c] = (channel[c]*alpha[x, y] + dst[x, y, c]*(255 - alpha[x, y]))/255;
This function is used for image drawing.
- Note
- This function has a C++ wrapper Simd::AlphaFilling(View<A> & dst, const Pixel & pixel, const View<A> & alpha).
- Parameters
-
[in,out] dst - a pointer to pixels data of background image. [in] dstStride - a row size of the background image. [in] width - an image width. [in] height - an image height. [in] channel - a pointer to pixel with foreground color. [in] channelCount - a channel count for foreground color and background images (1 <= channelCount <= 4). [in] alpha - a pointer to pixels data of image with alpha channel. [in] alphaStride - a row size of the alpha image.
◆ SimdAlphaPremultiply()
void SimdAlphaPremultiply | ( | const uint8_t * | src, |
size_t | srcStride, | ||
size_t | width, | ||
size_t | height, | ||
uint8_t * | dst, | ||
size_t | dstStride | ||
) |
Performs premultiply operation.
All images must have the same width, height and format (BGRA32).
For every point:
dst[x, y, 0] = src[x, y, 0] * src[x, y, 3] / 255; dst[x, y, 1] = src[x, y, 1] * src[x, y, 3] / 255; dst[x, y, 2] = src[x, y, 2] * src[x, y, 3] / 255; dst[x, y, 3] = src[x, y, 3];
This function is used for image drawing as a part of alpha blending operation.
- Note
- This function has a C++ wrapper Simd::AlphaPremultiply(const View<A>& src, View<A>& dst).
- Parameters
-
[in] src - a pointer to pixels data of input image. [in] srcStride - a row size of the input image. [in] width - an image width. [in] height - an image height. [out] dst - a pointer to pixels data of output premultiplyed image. [in] dstStride - a row size of the output premultiplyed image.
◆ SimdAlphaUnpremultiply()
void SimdAlphaUnpremultiply | ( | const uint8_t * | src, |
size_t | srcStride, | ||
size_t | width, | ||
size_t | height, | ||
uint8_t * | dst, | ||
size_t | dstStride | ||
) |
Performs unpremultiply operation.
All images must have the same width, height and format (BGRA32).
For every point:
dst[x, y, 0] = src[x, y, 0] / src[x, y, 3] * 255; dst[x, y, 1] = src[x, y, 1] / src[x, y, 3] * 255; dst[x, y, 2] = src[x, y, 2] / src[x, y, 3] * 255; dst[x, y, 3] = src[x, y, 3];
This function is used for image drawing as a part of alpha blending operation.
- Note
- This function has a C++ wrapper Simd::AlphaUnpremultiply(const View<A>& src, View<A>& dst).
- Parameters
-
[in] src - a pointer to pixels data of input image. [in] srcStride - a row size of the input image. [in] width - an image width. [in] height - an image height. [out] dst - a pointer to pixels data of output unpremultiplyed image. [in] dstStride - a row size of the output unpremultiplyed image.
◆ AlphaBlending()
Performs alpha blending operation.
All images must have the same width and height. Source and destination images must have the same format (8 bit per channel, for example GRAY8, BGR24 or BGRA32). Alpha must be 8-bit gray image.
For every point:
dst[x, y, c] = (src[x, y, c]*alpha[x, y] + dst[x, y, c]*(255 - alpha[x, y]))/255;
This function is used for image drawing.
- Note
- This function is a C++ wrapper for function SimdAlphaBlending.
- Parameters
-
[in] src - a foreground image. [in] alpha - an image with alpha channel. [in,out] dst - a background image.
◆ AlphaFilling()
Performs alpha filling operation.
All images must have the same width and height. Destination images must have 8 bit per channel (for example GRAY8, BGR24 or BGRA32). Alpha must be 8-bit gray image.
For every point:
dst[x, y, c] = (pixel[c]*alpha[x, y] + dst[x, y, c]*(255 - alpha[x, y]))/255;
This function is used for image drawing.
- Note
- This function is a C++ wrapper for function SimdAlphaFilling.
- Parameters
-
[in,out] dst - a background image. [in] pixel - a foreground color. [in] alpha - an image with alpha channel.
◆ AlphaPremultiply()
Performs premultiply operation.
All images must have the same width, height and format (BGRA32).
For every point:
dst[x, y, 0] = src[x, y, 0] * src[x, y, 3] / 255; dst[x, y, 1] = src[x, y, 1] * src[x, y, 3] / 255; dst[x, y, 2] = src[x, y, 2] * src[x, y, 3] / 255; dst[x, y, 3] = src[x, y, 3];
This function is used for image drawing as a part of alpha blending operation.
- Note
- This function is a C++ wrapper for function SimdAlphaPremultiply.
- Parameters
-
[in] src - an input image. [out] dst - an output premultiplyed image.
◆ AlphaUnpremultiply()
Performs unpremultiply operation.
All images must have the same width, height and format (BGRA32).
For every point:
dst[x, y, 0] = src[x, y, 0] / src[x, y, 3] * 255; dst[x, y, 1] = src[x, y, 1] / src[x, y, 3] * 255; dst[x, y, 2] = src[x, y, 2] / src[x, y, 3] * 255; dst[x, y, 3] = src[x, y, 3];
This function is used for image drawing as a part of alpha blending operation.
- Note
- This function is a C++ wrapper for function SimdAlphaUnpremultiply.
- Parameters
-
[in] src - an input image. [out] dst - an output unpremultiplyed image.