AggPas - Anti-Grain Geomertry for Object Pascal

TAggImageFilter

Description

TAggImageFilter defines the type of pixel-image aliasing resample operation when enlarging or shrinking bitmaps.

This resample operation (filter or in most cases interpolation) of images occurs when user resizes or remaps (distorts) image from one pixel grid to another. Image resizing is necessary when user needs to increase or decrease the total number of pixels, whereas remapping can occur under a wider variety of scenarios: correcting for lens distortion, changing perspective, rotating an image, etc.

Interpolation works by using known data to estimate values at unknown points.

Image interpolation works in two directions, and different alghorithms tries in a variety of ways to achieve the best approximation of a pixel's color and intensity based on the values at surrounding pixels.

Constant Values

AGG_NoFilter

No smoothing, just nearest neighbour method (point sampling) is used. The closest pixel center to each sample grid point is used, with no input from other surrounding pixels.

no smoothing (nearest neighbor)

AGG_Bilinear

A sample point takes the four closest pixel centers and linearly interpolates their color values according to their distance from the sample point. The averaging has an anti-aliasing effect and therefore produces relatively smooth edges with hardly any jaggies.

This method is particularly useful when an image is being enlarged, or transformed or distorted without decrease in average size.

bilinear resampling

AGG_Hanning

Results in medium quality image with medium performance.

Hanning  resampling

AGG_Hermite

The Hermite method interpolates using Hermite spline interpolation.

Results in medium quality image with medium performance.

Hermite resampling

AGG_Quadric

Results in good image quality with slightly higher performance.

quadric resampling

AGG_Bicubic

Is more sophisticated and produces smoother edges thanbilinear interpolation.

Bicubic goes one step beyond bilinear by considering the closest 4x4 neighborhood of known pixels - for a total of 16 pixels. Since these are at various distances from the unknown pixel, closer pixels are given a higher weighting in the calculation. Bicubic produces noticeably sharper images than the previous method bilinear, and is perhaps the ideal combination of processing time and output quality.

bicubic resampling

AGG_Catrom

Catmull-Rom splines are frequently used to get smooth interpolated motion between key frames. They are popular mainly for being relatively easy to compute, guaranteeing that each key frame position will be hit exactly, and also guaranteeing that the tangents of the generated curve are continuous over multiple segments.

Catmull-Rom resampling

AGG_Spline16, AGG_Spline36

An approximation of spline interpolation, for some applications its result may be too smooth and blurry, but when using with large magnification factors, it usually yields better image compared to bilinear.

spline16 resampling

AGG_Blackman144

Results in slightly distorted image quality with high performance.

Blackman resampling