Simple Graphics Library 1.0.0.0
Runtime-independent image processing primitives
Loading...
Searching...
No Matches
Crop

Rectangular crop of a tightly packed image. More...

Functions

sgl_result_t sgl_generic_crop (sgl_threadpool_t *pool, const sgl_uint8_t *src, sgl_int32_t src_width, sgl_int32_t src_height, sgl_uint8_t *dst, sgl_int32_t x, sgl_int32_t y, sgl_int32_t crop_width, sgl_int32_t crop_height, sgl_int32_t bpp)
 Copies a rectangular source region to a compact destination image.
 
sgl_result_t sgl_simd_crop (sgl_threadpool_t *pool, const sgl_uint8_t *src, sgl_int32_t src_width, sgl_int32_t src_height, sgl_uint8_t *dst, sgl_int32_t x, sgl_int32_t y, sgl_int32_t crop_width, sgl_int32_t crop_height, sgl_int32_t bpp)
 SIMD crop implementation.
 

Detailed Description

Rectangular crop of a tightly packed image.

Function Documentation

◆ sgl_generic_crop()

sgl_result_t sgl_generic_crop ( sgl_threadpool_t *  pool,
const sgl_uint8_t *  src,
sgl_int32_t  src_width,
sgl_int32_t  src_height,
sgl_uint8_t *  dst,
sgl_int32_t  x,
sgl_int32_t  y,
sgl_int32_t  crop_width,
sgl_int32_t  crop_height,
sgl_int32_t  bpp 
)

Copies a rectangular source region to a compact destination image.

Parameters
[in]poolWorker pool, or SGL_NULL for single-thread execution.
[in]srcBuffer of at least src_width * src_height * bpp bytes.
[in]src_widthSource width in pixels.
[in]src_heightSource height in pixels.
[out]dstBuffer of at least crop_width * crop_height * bpp bytes.
[in]xZero-based source x coordinate of the crop origin.
[in]yZero-based source y coordinate of the crop origin.
[in]crop_widthPositive crop width in pixels.
[in]crop_heightPositive crop height in pixels.
[in]bppPositive number of bytes per packed pixel.
Return values
SGL_SUCCESSCrop completed.
SGL_ERROR_INVALID_ARGUMENTSInvalid buffer, geometry, or byte count.
SGL_ERROR_MEMORY_ALLOCATIONParallel work storage was unavailable.
Precondition
The crop rectangle lies completely inside the source and the source and destination buffers do not overlap.

◆ sgl_simd_crop()

sgl_result_t sgl_simd_crop ( sgl_threadpool_t *  pool,
const sgl_uint8_t *  src,
sgl_int32_t  src_width,
sgl_int32_t  src_height,
sgl_uint8_t *  dst,
sgl_int32_t  x,
sgl_int32_t  y,
sgl_int32_t  crop_width,
sgl_int32_t  crop_height,
sgl_int32_t  bpp 
)

SIMD crop implementation.

Parameters
[in]poolWorker pool, or SGL_NULL for single-thread execution.
[in]srcBuffer of at least src_width * src_height * bpp bytes.
[in]src_widthSource width in pixels.
[in]src_heightSource height in pixels.
[out]dstBuffer of at least crop_width * crop_height * bpp bytes.
[in]xZero-based source x coordinate of the crop origin.
[in]yZero-based source y coordinate of the crop origin.
[in]crop_widthPositive crop width in pixels.
[in]crop_heightPositive crop height in pixels.
[in]bppPositive number of bytes per packed pixel.
Return values
SGL_SUCCESSCrop completed.
SGL_ERROR_INVALID_ARGUMENTSInvalid buffer, geometry, or byte count.
SGL_ERROR_MEMORY_ALLOCATIONParallel work storage was unavailable.
Precondition
The crop rectangle lies completely inside the source and the source and destination buffers do not overlap.