CorTeX Core ABI 7
ToolTech Software · C++ library reference
Loading...
Searching...
No Matches
ctxImageResampling Class Reference

Separable, antialiased resizing of one unsigned-byte component. More...

#include <ctxImageResampling.h>

Static Public Member Functions

static gzBool getWorkspaceBytes (gzUInt32 sourceWidth, gzUInt32 sourceHeight, gzUInt32 outputWidth, gzUInt32 outputHeight, ctxImageResamplingFilter filter, gzUInt64 &bytes)
static gzBool getRegionWorkspaceBytes (gzUInt32 sourceWidth, gzUInt32 sourceHeight, gzUInt32 outputWidth, gzUInt32 outputHeight, const ctxImageResamplingBox &box, ctxImageResamplingFilter filter, gzUInt64 &bytes)
 Query filtered-region workspace.
static gzBool resize (const ctxImageByteView &source, gzUInt32 outputWidth, gzUInt32 outputHeight, ctxImageResamplingFilter filter, gzUByte *output, gzUInt64 outputBytes, void *workspace, gzUInt64 workspaceBytes)
static gzBool resizeRegion (const ctxImageByteView &source, gzUInt32 outputWidth, gzUInt32 outputHeight, const ctxImageResamplingBox &box, ctxImageResamplingFilter filter, gzUByte *output, gzUInt64 outputBytes, void *workspace, gzUInt64 workspaceBytes)
 Filter a contained, nonempty fractional source region.
static gzBool getReducedSize (gzUInt32 width, gzUInt32 height, gzUInt32 factorX, gzUInt32 factorY, gzUInt32 &outputWidth, gzUInt32 &outputHeight)
 Integer block reduction with clipped right/bottom blocks.
static gzBool reduce (const ctxImageByteView &source, gzUInt32 factorX, gzUInt32 factorY, gzUByte *output, gzUInt64 outputBytes)

Detailed Description

Separable, antialiased resizing of one unsigned-byte component.

Integer pixel centers are sampled through half-cell resize coordinates. Boundary support is clipped to the source and renormalized. Intermediate bytes are rounded/clipped between passes, with22-bit normalized integer coefficients. Horizontal filtering comes first except when height>100*width and height shrinks: the vertical pass then comes first. This matches the established byte-resize recipe, including very tall glyphs. This is not the point-interpolation/border contract.

Caller-owned source, tightly packed destination and used workspace must be disjoint. Padding/tails remain unchanged. Workspace must be UInt32-aligned. No IO, allocation, image object, model or execution context is retained. Invalid preflight or an unusable coefficient plan leaves output unchanged.

Definition at line 47 of file ctxImageResampling.h.

Member Function Documentation

◆ getReducedSize()

gzBool ctxImageResampling::getReducedSize ( gzUInt32 width,
gzUInt32 height,
gzUInt32 factorX,
gzUInt32 factorY,
gzUInt32 & outputWidth,
gzUInt32 & outputHeight )
inlinestatic

Integer block reduction with clipped right/bottom blocks.

Factors and their product are positive and at most65535. Output dimensions are ceiling quotients. Sums use a24-bit binary32 reciprocal and half-area bias, then truncate. This explicit byte recipe is not arbitrary-precision division. No workspace/IO/allocation; invalid preflight preserves output/counters.

Definition at line 136 of file ctxImageResampling.h.

Referenced by reduce().

◆ getRegionWorkspaceBytes()

gzBool ctxImageResampling::getRegionWorkspaceBytes ( gzUInt32 sourceWidth,
gzUInt32 sourceHeight,
gzUInt32 outputWidth,
gzUInt32 outputHeight,
const ctxImageResamplingBox & box,
ctxImageResamplingFilter filter,
gzUInt64 & bytes )
inlinestatic

Query filtered-region workspace.

Output bytes change only on success.

Definition at line 59 of file ctxImageResampling.h.

Referenced by getWorkspaceBytes().

◆ getWorkspaceBytes()

gzBool ctxImageResampling::getWorkspaceBytes ( gzUInt32 sourceWidth,
gzUInt32 sourceHeight,
gzUInt32 outputWidth,
gzUInt32 outputHeight,
ctxImageResamplingFilter filter,
gzUInt64 & bytes )
inlinestatic

Definition at line 51 of file ctxImageResampling.h.

References getRegionWorkspaceBytes().

◆ reduce()

gzBool ctxImageResampling::reduce ( const ctxImageByteView & source,
gzUInt32 factorX,
gzUInt32 factorY,
gzUByte * output,
gzUInt64 outputBytes )
inlinestatic

◆ resize()

gzBool ctxImageResampling::resize ( const ctxImageByteView & source,
gzUInt32 outputWidth,
gzUInt32 outputHeight,
ctxImageResamplingFilter filter,
gzUByte * output,
gzUInt64 outputBytes,
void * workspace,
gzUInt64 workspaceBytes )
inlinestatic

◆ resizeRegion()

gzBool ctxImageResampling::resizeRegion ( const ctxImageByteView & source,
gzUInt32 outputWidth,
gzUInt32 outputHeight,
const ctxImageResamplingBox & box,
ctxImageResamplingFilter filter,
gzUByte * output,
gzUInt64 outputBytes,
void * workspace,
gzUInt64 workspaceBytes )
inlinestatic

Filter a contained, nonempty fractional source region.

All used buffers remain disjoint. Coefficient coordinates/extent subtraction are binary32 before double-precision kernel evaluation, as explicitly declared by box.

Definition at line 82 of file ctxImageResampling.h.

References ctxImageResamplingBox::bottom, ctxBinaryImageAnalysis::getPixelCount(), ctxImageByteView::height, ctxImageResamplingBox::left, ctxImageByteView::pixels, ctxImageResamplingBox::right, ctxImageByteView::rowStride, ctxImageResamplingBox::top, and ctxImageByteView::width.

Referenced by resize().


The documentation for this class was generated from the following file: