Simd Library Documentation.

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

Functions for image filling. More...

Functions

SIMD_API void SimdFillPixel (uint8_t *dst, size_t stride, size_t width, size_t height, const uint8_t *pixel, size_t pixelSize)
 Fills every image pixel with the given pixel value. More...
 
SIMD_API void SimdFill32f (float *dst, size_t size, const float *value)
 Fills a 32-bit float array with the given value. More...
 
template<template< class > class A>
SIMD_INLINE void Fill (View< A > &dst, uint8_t value)
 Fills every byte of image pixel data with the given 8-bit value. More...
 
template<template< class > class A>
SIMD_INLINE void FillFrame (View< A > &dst, const Rectangle< ptrdiff_t > &frame, uint8_t value)
 Fills image pixel data outside of the given inner frame with the given 8-bit value. More...
 
template<template< class > class A>
SIMD_INLINE void FillBgr (View< A > &dst, uint8_t blue, uint8_t green, uint8_t red)
 Fills every pixel of a 24-bit BGR image with the given color. More...
 
template<template< class > class A>
SIMD_INLINE void FillBgra (View< A > &dst, uint8_t blue, uint8_t green, uint8_t red, uint8_t alpha=0xFF)
 Fills every pixel of a 32-bit BGRA image with the given color. More...
 
template<template< class > class A, class Pixel >
SIMD_INLINE void FillPixel (View< A > &dst, const Pixel &pixel)
 Fills every image pixel with the given pixel value. More...
 

Detailed Description

Functions for image filling.

Function Documentation

◆ SimdFillPixel()

void SimdFillPixel ( uint8_t *  dst,
size_t  stride,
size_t  width,
size_t  height,
const uint8_t *  pixel,
size_t  pixelSize 
)

Fills every image pixel with the given pixel value.

The function supports pixel sizes from 1 to 4 bytes. For pixelSize equal to 1, 2, 3 or 4 it fills the image as 8-bit gray, 16-bit two-channel, 24-bit BGR or 32-bit BGRA data respectively. Padding bytes after width*pixelSize in each row are not modified.

Note
This function has a C++ wrapper Simd::FillPixel(View<A> & dst, const Pixel & pixel).
Parameters
[out]dst- a pointer to pixels data of destination image.
[in]stride- a row size of the dst image (in bytes).
[in]width- an image width (in pixels).
[in]height- an image height (in pixels).
[in]pixel- a pointer to pixel value to fill image. It must point to pixelSize bytes.
[in]pixelSize- a size of one image pixel (in bytes). It must be in range [1, 4].

◆ SimdFill32f()

void SimdFill32f ( float *  dst,
size_t  size,
const float *  value 
)

Fills a 32-bit float array with the given value.

If value is NULL or value[0] is equal to 0.0, the function fills dst with zeros. Otherwise every dst element is set to value[0].

Parameters
[out]dst- a pointer to 32-bit float array.
[in]size- a number of elements in the array.
[in]value- a pointer to value to fill. It can be NULL; in this case filling value is assumed to be zero.

◆ Fill()

void Fill ( View< A > &  dst,
uint8_t  value 
)

Fills every byte of image pixel data with the given 8-bit value.

For each row the function writes width*pixelSize bytes with value and then moves to the next row by stride bytes. Padding bytes after width*pixelSize in each row are not modified.

Note
This function is implemented on the base of function SimdFillPixel.
Parameters
[out]dst- a destination image.
[in]value- a byte value to fill image pixel data.

◆ FillFrame()

void FillFrame ( View< A > &  dst,
const Rectangle< ptrdiff_t > &  frame,
uint8_t  value 
)

Fills image pixel data outside of the given inner frame with the given 8-bit value.

The function fills four areas by calling Simd::Fill for the corresponding image regions: rows above frame.top, rows at or below frame.bottom, columns before frame.left inside the frame vertical range, and columns at or after frame.right inside the frame vertical range. The rectangle [frame.left, frame.right) x [frame.top, frame.bottom) is left unchanged. Frame coordinates must satisfy 0 <= frame.left <= frame.right <= dst.width and 0 <= frame.top <= frame.bottom <= dst.height.

Note
This function is implemented on the base of function Simd::Fill.
Parameters
[out]dst- a destination image.
[in]frame- a rectangle defining the untouched interior region.
[in]value- a byte value to fill image pixel data outside of the frame.

◆ FillBgr()

void FillBgr ( View< A > &  dst,
uint8_t  blue,
uint8_t  green,
uint8_t  red 
)

Fills every pixel of a 24-bit BGR image with the given color.

For every output pixel: dst[0] = blue, dst[1] = green, dst[2] = red. Padding bytes after width*3 in each row are not modified.

Note
This function is implemented on the base of function SimdFillPixel.
Parameters
[out]dst- a destination 24-bit BGR image.
[in]blue- a blue channel value of BGR color.
[in]green- a green channel value of BGR color.
[in]red- a red channel value of BGR color.

◆ FillBgra()

void FillBgra ( View< A > &  dst,
uint8_t  blue,
uint8_t  green,
uint8_t  red,
uint8_t  alpha = 0xFF 
)

Fills every pixel of a 32-bit BGRA image with the given color.

For every output pixel: dst[0] = blue, dst[1] = green, dst[2] = red, dst[3] = alpha. Padding bytes after width*4 in each row are not modified.

Note
This function is implemented on the base of function SimdFillPixel.
Parameters
[out]dst- a destination 32-bit BGRA image.
[in]blue- a blue channel value of BGRA color.
[in]green- a green channel value of BGRA color.
[in]red- a red channel value of BGRA color.
[in]alpha- an alpha channel value of BGRA color. It is equal to 0xFF by default.

◆ FillPixel()

void FillPixel ( View< A > &  dst,
const Pixel &  pixel 
)

Fills every image pixel with the given pixel value.

The function supports pixel sizes from 1 to 4 bytes. For pixelSize equal to 1, 2, 3 or 4 it fills the image as 8-bit gray, 16-bit two-channel, 24-bit BGR or 32-bit BGRA data respectively. Padding bytes after width*pixelSize in each row are not modified. The size of Pixel must match the destination image pixel size and be in range [1, 4].

Note
This function is a C++ wrapper for function SimdFillPixel.
Parameters
[out]dst- a destination image.
[in]pixel- a pixel value of a type that corresponds to the image format.