Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub | SourceForge

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...
 
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...
 

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[i] = (src[i]*alpha[i] + dst[i]*(255 - alpha[i]))/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.

◆ AlphaBlending()

void AlphaBlending ( const View< A > &  src,
const View< A > &  alpha,
View< A > &  dst 
)

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[i] = (src[i]*alpha[i] + dst[i]*(255 - alpha[i]))/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.