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) |
| Blends source image over destination image using per-pixel 8-bit alpha mask. More... | |
| SIMD_API void | SimdAlphaBlending2x (const uint8_t *src0, size_t src0Stride, const uint8_t *alpha0, size_t alpha0Stride, const uint8_t *src1, size_t src1Stride, const uint8_t *alpha1, size_t alpha1Stride, size_t width, size_t height, size_t channelCount, uint8_t *dst, size_t dstStride) |
| Performs two sequential alpha blendings of source images over destination image. More... | |
| SIMD_API void | SimdAlphaBlendingBgraToYuv420p (const uint8_t *bgra, size_t bgraStride, size_t width, size_t height, uint8_t *y, size_t yStride, uint8_t *u, size_t uStride, uint8_t *v, size_t vStride, SimdYuvType yuvType) |
| Converts BGRA to YUV420P and alpha-blends it with destination Y, U and V planes. More... | |
| SIMD_API void | SimdAlphaBlendingUniform (const uint8_t *src, size_t srcStride, size_t width, size_t height, size_t channelCount, uint8_t alpha, uint8_t *dst, size_t dstStride) |
| Blends source image over destination image with the same alpha value for all pixels. 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) |
| Blends constant pixel value into destination image using per-pixel 8-bit alpha mask. More... | |
| SIMD_API void | SimdAlphaPremultiply (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t *dst, size_t dstStride, SimdBool argb) |
| Converts straight-alpha 4-channel image to premultiplied-alpha representation. More... | |
| SIMD_API void | SimdAlphaUnpremultiply (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t *dst, size_t dstStride, SimdBool argb) |
| Converts premultiplied-alpha 4-channel image to straight-alpha representation. More... | |
| SIMD_API void | SimdDrawLine (uint8_t *canvas, size_t stride, size_t width, size_t height, size_t channels, ptrdiff_t x1, ptrdiff_t y1, ptrdiff_t x2, ptrdiff_t y2, const uint8_t *color, size_t lineWidth) |
| Draws a clipped line segment on an image. More... | |
| SIMD_API void | SimdDrawRectangle (uint8_t *canvas, size_t stride, size_t width, size_t height, size_t channels, ptrdiff_t left, ptrdiff_t top, ptrdiff_t right, ptrdiff_t bottom, const uint8_t *color, size_t lineWidth) |
| Draws a clipped rectangle frame on an image. More... | |
| SIMD_API void * | SimdFontInit () |
| Creates a font context with embedded ASCII glyph data. More... | |
| SIMD_API SimdBool | SimdFontResize (void *context, size_t height) |
| Resizes the font context to the given glyph height. More... | |
| SIMD_API size_t | SimdFontHeight (void *context) |
| Gets current glyph height of the font context. More... | |
| SIMD_API void | SimdFontMeasure (void *context, const char *text, size_t *width, size_t *height) |
| Measures the rectangle required to draw a zero-terminated text string. More... | |
| SIMD_API void | SimdFontDraw (void *context, uint8_t *canvas, size_t stride, size_t width, size_t height, size_t channels, const char *text, size_t left, size_t top, const uint8_t *color) |
| Draws a zero-terminated text string on an 8-bit-per-channel image. 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> | |
| SIMD_INLINE void | AlphaBlending2x (const View< A > &src0, const View< A > &alpha0, const View< A > &src1, const View< A > &alpha1, View< A > &dst) |
| Performs double alpha blending operation. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | AlphaBlendingBgraToYuv420p (const View< A > &bgra, View< A > &y, View< A > &u, View< A > &v, SimdYuvType yuvType=SimdYuvBt601) |
| Performs alpha blending of BGRA image to YUV420P. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | AlphaBlending (const View< A > &src, uint8_t 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 | ||
| ) |
Blends source image over destination image using per-pixel 8-bit alpha mask.
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, UV16, BGR24 or BGRA32). Alpha must be 8-bit gray image.
For every point and channel:
dst[x, y, c] = DivideBy255(src[x, y, c]*alpha[x, y] + dst[x, y, c]*(255 - alpha[x, y]));
where DivideBy255(v) = (v + 1 + (v >> 8)) >> 8.
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.
◆ SimdAlphaBlending2x()
| void SimdAlphaBlending2x | ( | const uint8_t * | src0, |
| size_t | src0Stride, | ||
| const uint8_t * | alpha0, | ||
| size_t | alpha0Stride, | ||
| const uint8_t * | src1, | ||
| size_t | src1Stride, | ||
| const uint8_t * | alpha1, | ||
| size_t | alpha1Stride, | ||
| size_t | width, | ||
| size_t | height, | ||
| size_t | channelCount, | ||
| uint8_t * | dst, | ||
| size_t | dstStride | ||
| ) |
Performs two sequential alpha blendings of source images over destination image.
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, UV16, BGR24 or BGRA32). Alphas must be 8-bit gray image.
For every point and channel:
tmp = DivideBy255(src0[x, y, c]*alpha0[x, y] + dst[x, y, c]*(255 - alpha0[x, y])); dst[x, y, c] = DivideBy255(src1[x, y, c]*alpha1[x, y] + tmp*(255 - alpha1[x, y]));
This function is used for image drawing.
- Note
- This function has a C++ wrapper Simd::AlphaBlending(const View<A>& src0, const View<A>& alpha0, const View<A>& src1, const View<A>& alpha1, View<A>& dst).
- Parameters
-
[in] src0 - a pointer to pixels data of the first foreground image. [in] src0Stride - a row size of the first foreground image. [in] alpha0 - a pointer to pixels data of image with the first alpha channel. [in] alpha0Stride - a row size of the first alpha image. [in] src1 - a pointer to pixels data of the second foreground image. [in] src1Stride - a row size of the second foreground image. [in] alpha1 - a pointer to pixels data of image with the second alpha channel. [in] alpha1Stride - a row size of the second alpha 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,out] dst - a pointer to pixels data of background image. [in] dstStride - a row size of the background image.
◆ SimdAlphaBlendingBgraToYuv420p()
| void SimdAlphaBlendingBgraToYuv420p | ( | const uint8_t * | bgra, |
| size_t | bgraStride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint8_t * | y, | ||
| size_t | yStride, | ||
| uint8_t * | u, | ||
| size_t | uStride, | ||
| uint8_t * | v, | ||
| size_t | vStride, | ||
| SimdYuvType | yuvType | ||
| ) |
Converts BGRA to YUV420P and alpha-blends it with destination Y, U and V planes.
For every BGRA pixel, Y is computed from BGR and blended with corresponding destination Y using this pixel alpha. For every 2x2 BGRA block, U and V are computed from averaged B, G, R values and blended with destination U and V using average alpha of this 2x2 block. The input BGRA and output Y images must have the same width and height. The output U and V images must have half width and half height relative to Y component.
- Note
- This function has a C++ wrapper Simd::AlphaBlendingBgraToYuv420p(const View& bgra, View& y, View& u, View& v, SimdYuvType yuvType = SimdYuvBt601).
- Parameters
-
[in] bgra - a pointer to pixels data of foreground BGRA-32 image. [in] bgraStride - a row size of the foreground BGRA-32 image. [in] width - an image width. It must be even. [in] height - an image height. It must be even. [in,out] y - a pointer to pixels data of Y-component of background YUV420P image. [in] yStride - a row size of Y-component. [in,out] u - a pointer to pixels data of U-component of background YUV420P image. [in] uStride - a row size of U-component. [in,out] v - a pointer to pixels data of V-component of background YUV420P image. [in] vStride - a row size of V-component. [in] yuvType - a type of output YUV image (see description of SimdYuvType).
◆ SimdAlphaBlendingUniform()
| void SimdAlphaBlendingUniform | ( | const uint8_t * | src, |
| size_t | srcStride, | ||
| size_t | width, | ||
| size_t | height, | ||
| size_t | channelCount, | ||
| uint8_t | alpha, | ||
| uint8_t * | dst, | ||
| size_t | dstStride | ||
| ) |
Blends source image over destination image with the same alpha value for all pixels.
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, UV16, BGR24 or BGRA32).
For every point and channel:
dst[x, y, c] = DivideBy255(src[x, y, c]*alpha + dst[x, y, c]*(255 - alpha));
This function is used for image drawing.
- Note
- This function has a C++ wrapper Simd::AlphaBlending(const View<A>& src, uint8_t 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 value of alpha. [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 | ||
| ) |
Blends constant pixel value into destination image using per-pixel 8-bit alpha mask.
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 and channel:
dst[x, y, c] = DivideBy255(channel[c]*alpha[x, y] + dst[x, y, c]*(255 - alpha[x, y]));
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, | ||
| SimdBool | argb | ||
| ) |
Converts straight-alpha 4-channel image to premultiplied-alpha representation.
All images must have the same width, height and format (BGRA32, RGBA32, ARGB32).
For every point:
color = DivideBy255(color * alpha); alpha is copied unchanged.
If argb == SimdFalse then alpha channel index is 3 (BGRA32/RGBA32 layout). If argb == SimdTrue then alpha channel index is 0 (ARGB32 layout).
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 premultiplied image. [in] dstStride - a row size of the output premultiplied image. [in] argb - a boolean flag describing image format (BGRA32, RGBA32 - SimdFalse; ARGB32 - SimdTrue).
◆ SimdAlphaUnpremultiply()
| void SimdAlphaUnpremultiply | ( | const uint8_t * | src, |
| size_t | srcStride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint8_t * | dst, | ||
| size_t | dstStride, | ||
| SimdBool | argb | ||
| ) |
Converts premultiplied-alpha 4-channel image to straight-alpha representation.
All images must have the same width, height and format (BGRA32, RGBA32, ARGB32).
For every point:
color = clamp(int(color * (alpha ? 255.00001f/alpha : 0.0f)), 0, 255); alpha is copied unchanged.
If argb == SimdFalse then alpha channel index is 3 (BGRA32/RGBA32 layout). If argb == SimdTrue then alpha channel index is 0 (ARGB32 layout).
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 unpremultiplied image. [in] dstStride - a row size of the output unpremultiplied image. [in] argb - a boolean flag describing image format (BGRA32, RGBA32 - SimdFalse; ARGB32 - SimdTrue).
◆ SimdDrawLine()
| void SimdDrawLine | ( | uint8_t * | canvas, |
| size_t | stride, | ||
| size_t | width, | ||
| size_t | height, | ||
| size_t | channels, | ||
| ptrdiff_t | x1, | ||
| ptrdiff_t | y1, | ||
| ptrdiff_t | x2, | ||
| ptrdiff_t | y2, | ||
| const uint8_t * | color, | ||
| size_t | lineWidth | ||
| ) |
Draws a clipped line segment on an image.
The function draws a line from (x1, y1) to (x2, y2) into canvas. Coordinates use the usual image coordinate system: X grows to the right and Y grows downward. The segment is clipped to the canvas rectangle [0, width - 1] x [0, height - 1]; if it is completely outside, the function does nothing. Only images with 1, 2, 3 or 4 bytes per pixel are supported. The color buffer must contain channels bytes. The line is drawn with the specified width in pixels around the rasterized segment.
- Note
- This function has a C++ wrapper: Simd::DrawLine(View & canvas, ptrdiff_t x1, ptrdiff_t y1, ptrdiff_t x2, ptrdiff_t y2, const Color & color, size_t width = 1).
- Parameters
-
[out] canvas - a pointer to pixels data of canvas image. [in] stride - a row size of canvas image (in bytes). [in] width - a width of canvas image (in pixels). [in] height - a height of canvas image (in pixels). [in] channels - a size of one canvas pixel in bytes. It must be in range [1, 4]. [in] x1 - X coordinate of the first point of the line. [in] y1 - Y coordinate of the first point of the line. [in] x2 - X coordinate of the second point of the line. [in] y2 - Y coordinate of the second point of the line. [in] color - a pointer to line color. It must point to channels bytes. [in] lineWidth - a line width (in pixels).
◆ SimdDrawRectangle()
| void SimdDrawRectangle | ( | uint8_t * | canvas, |
| size_t | stride, | ||
| size_t | width, | ||
| size_t | height, | ||
| size_t | channels, | ||
| ptrdiff_t | left, | ||
| ptrdiff_t | top, | ||
| ptrdiff_t | right, | ||
| ptrdiff_t | bottom, | ||
| const uint8_t * | color, | ||
| size_t | lineWidth | ||
| ) |
Draws a clipped rectangle frame on an image.
The function draws four clipped lines: (left, top)-(right, top), (right, top)-(right, bottom), (right, bottom)-(left, bottom) and (left, bottom)-(left, top). Coordinates use the usual image coordinate system: X grows to the right and Y grows downward. The rectangle sides may be outside the canvas; each side is clipped by SimdDrawLine. Only images with 1, 2, 3 or 4 bytes per pixel are supported. The color buffer must contain channels bytes.
- Note
- This function has C++ wrappers: Simd::DrawRectangle(View & canvas, ptrdiff_t left, ptrdiff_t top, ptrdiff_t right, ptrdiff_t bottom, const Color & color, size_t width = 1), Simd::DrawRectangle(View & canvas, const Rectangle<ptrdiff_t> & rect, const Color & color, size_t width = 1).
- Parameters
-
[out] canvas - a pointer to pixels data of canvas image. [in] stride - a row size of canvas image (in bytes). [in] width - a width of canvas image (in pixels). [in] height - a height of canvas image (in pixels). [in] channels - a size of one canvas pixel in bytes. It must be in range [1, 4]. [in] left - X coordinate of the left side of the rectangle. [in] top - Y coordinate of the top side of the rectangle. [in] right - X coordinate of the right side of the rectangle. [in] bottom - Y coordinate of the bottom side of the rectangle. [in] color - a pointer to rectangle color. It must point to channels bytes. [in] lineWidth - a width of rectangle frame (in pixels).
◆ SimdFontInit()
| void * SimdFontInit | ( | ) |
Creates a font context with embedded ASCII glyph data.
The context stores a built-in monospace-like font and is used by SimdFontResize, SimdFontHeight, SimdFontMeasure and SimdFontDraw. Call SimdFontResize to choose a drawable font height before measuring or drawing text.
- Returns
- a pointer to font context. On error it returns NULL. This pointer is used in functions SimdFontResize, SimdFontHeight, SimdFontMeasure and SimdFontDraw. It must be released by function SimdRelease.
◆ SimdFontResize()
| SimdBool SimdFontResize | ( | void * | context, |
| size_t | height | ||
| ) |
Resizes the font context to the given glyph height.
The function recreates internal 8-bit alpha glyph images from embedded font data. It returns SimdFalse if height is outside the supported range of the embedded font. Reusing the current height is a successful no-op.
- Parameters
-
[in] context - a font context. It must be created by SimdFontInit and released by SimdRelease. [in] height - a new glyph height in pixels.
◆ SimdFontHeight()
| size_t SimdFontHeight | ( | void * | context | ) |
Gets current glyph height of the font context.
- Parameters
-
[in] context - a font context. It must be created by SimdFontInit and released by SimdRelease.
- Returns
- the current glyph height in pixels.
◆ SimdFontMeasure()
| void SimdFontMeasure | ( | void * | context, |
| const char * | text, | ||
| size_t * | width, | ||
| size_t * | height | ||
| ) |
Measures the rectangle required to draw a zero-terminated text string.
The embedded font supports ASCII glyphs from the built-in font table. Supported glyphs advance the current X position by current glyph width. The '
' character starts a new line and advances Y by current glyph height. Unsupported characters are ignored. If the text contains at least one drawable glyph, the returned size also includes the font indentation on all sides. The width and height output pointers are optional.
- Parameters
-
[in] context - a font context. It must be created by SimdFontInit and released by SimdRelease. [in] text - a pointer to zero-terminated text string. [out] width - a pointer to measured text region width in pixels. It can be NULL. [out] height - a pointer to measured text region height in pixels. It can be NULL.
◆ SimdFontDraw()
| void SimdFontDraw | ( | void * | context, |
| uint8_t * | canvas, | ||
| size_t | stride, | ||
| size_t | width, | ||
| size_t | height, | ||
| size_t | channels, | ||
| const char * | text, | ||
| size_t | left, | ||
| size_t | top, | ||
| const uint8_t * | color | ||
| ) |
Draws a zero-terminated text string on an 8-bit-per-channel image.
The function creates an 8-bit alpha mask from supported glyphs and blends color into canvas through this mask by SimdAlphaFilling. The text position (left, top) specifies the top-left corner of the measured text region; glyphs are shifted by the current font indentation inside it. Drawing is clipped to the canvas. Supported glyphs advance X by current glyph width, '
' starts a new line, and unsupported characters are ignored. The canvas must have 1, 2, 3 or 4 channels.
- Parameters
-
[in] context - a font context. It must be created by SimdFontInit and released by SimdRelease. [out] canvas - a pointer to pixels data of canvas image. [in] stride - a row size of canvas image (in bytes). [in] width - a width of canvas image (in pixels). [in] height - a height of canvas image (in pixels). [in] channels - a number of 8-bit channels in canvas image. It must be in range [1, 4]. [in] text - a pointer to zero-terminated text string. [in] left - X coordinate of the measured text region left side. [in] top - Y coordinate of the measured text region top side. [in] color - a pointer to text color. It must point to channels bytes.
◆ AlphaBlending() [1/2]
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, UV16, 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.
◆ AlphaBlending2x()
| void AlphaBlending2x | ( | const View< A > & | src0, |
| const View< A > & | alpha0, | ||
| const View< A > & | src1, | ||
| const View< A > & | alpha1, | ||
| View< A > & | dst | ||
| ) |
Performs double 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, UV16, BGR24 or BGRA32). Alphas must be 8-bit gray image.
For every point:
tmp = (src0[x, y, c]*alpha0[x, y] + dst[x, y, c]*(255 - alpha0[x, y]))/255; dst[x, y, c] = (src1[x, y, c]*alpha1[x, y] + tmp*(255 - alpha1[x, y]))/255;
This function is used for image drawing.
- Note
- This function is a C++ wrapper for function SimdAlphaBlending2x.
- Parameters
-
[in] src0 - the first foreground image. [in] alpha0 - the first image with alpha channel. [in] src1 - the second foreground image. [in] alpha1 - the second image with alpha channel. [in,out] dst - a background image.
◆ AlphaBlendingBgraToYuv420p()
| void AlphaBlendingBgraToYuv420p | ( | const View< A > & | bgra, |
| View< A > & | y, | ||
| View< A > & | u, | ||
| View< A > & | v, | ||
| SimdYuvType | yuvType = SimdYuvBt601 |
||
| ) |
Performs alpha blending of BGRA image to YUV420P.
This function is used for image drawing. The input BGRA and output Y images must have the same width and height. The output U and V images must have the same width and height (half size relative to Y component).
- Note
- This function is a C++ wrapper for function SimdAlphaBlendingBgraToYuv420p.
- Parameters
-
[in] bgra - a foreground BGRA-32 image. [in,out] y - Y-component of background YUV420P image. [in,out] u - U-component of background YUV420P image. [in,out] v - V-component of background YUV420P image. [in] yuvType - a type of output YUV image (see description of SimdYuvType). By default it is equal to SimdYuvBt601.
◆ AlphaBlending() [2/2]
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, UV16, BGR24 or BGRA32).
For every point:
dst[x, y, c] = (src[x, y, c]*alpha + dst[x, y, c]*(255 - alpha))/255;
This function is used for image drawing.
- Note
- This function is a C++ wrapper for function SimdAlphaBlendingUniform.
- Parameters
-
[in] src - a foreground image. [in] alpha - a value of alpha. [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, RGBA32, ARGB32).
For every point (sample for BGRA32):
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 premultiplied image.
◆ AlphaUnpremultiply()
Performs unpremultiply operation.
All images must have the same width, height and format (BGRA32, RGBA32, ARGB32).
For every point (sample for BGRA32):
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 unpremultiplied image.