Unit BGRAFilters

📄 Source code

Description

Filters that can be applied to a bitmap. The filters take a source image as a parameter and gives a filtered image as a result.

Uses

Overview

Structures

Name Description
Class TGrayscaleTask Grayscale task converts colored pixel into grayscale with same luminosity

Functions and Procedures

function CreateBlurTask(ABmp: TBGRACustomBitmap; ABounds: TRect; AMask: TCustomUniversalBitmap; AMaskIsThreadSafe: boolean = false): TFilterTask;
function CreateGrayscaleTask(bmp: TBGRACustomBitmap; ABounds: TRect): TFilterTask;
function CreateMotionBlurTask(ABmp: TBGRACustomBitmap; ABounds: TRect; ADistance,AAngle: single; AOriented: boolean): TMotionBlurTask;
function CreateRadialBlurTask(ABmp: TBGRACustomBitmap; ABounds: TRect; ARadius: single; ABlurType: TRadialBlurType): TRadialBlurTask; overload;
function CreateRadialBlurTask(ABmp: TBGRACustomBitmap; ABounds: TRect; ARadiusX,ARadiusY: single; ABlurType: TRadialBlurType): TRadialBlurTask; overload;
function CreateRadialPreciseBlurTask(ABmp: TBGRACustomBitmap; ABounds: TRect; ARadius: single): TRadialBlurTask; deprecated 'Use CreateRadialBlurTask with blurType:=rbPrecise and radius multiplied by 10';
function FilterBlur(bmp: TBGRACustomBitmap; AMask: TCustomUniversalBitmap; AMaskIsThreadSafe: boolean = false): TBGRACustomBitmap;
function FilterBlurMotion(bmp: TBGRACustomBitmap; distance: single; angle: single; oriented: boolean): TBGRACustomBitmap;
function FilterBlurRadial(bmp: TBGRACustomBitmap; radius: single; blurType: TRadialBlurType): TBGRACustomBitmap; overload;
function FilterBlurRadial(bmp: TBGRACustomBitmap; radiusX: single; radiusY: single; blurType: TRadialBlurType): TBGRACustomBitmap; overload;
function FilterBlurRadialPrecise(bmp: TBGRACustomBitmap; radius: single): TBGRACustomBitmap; deprecated 'Use FilterBlurRadial with blurType:=rbPrecise and radius multiplied by 10';
function FilterContour(bmp: TBGRACustomBitmap; AGammaCorrection: boolean = false): TBGRACustomBitmap;
function FilterCylinder(bmp: TBGRACustomBitmap): TBGRACustomBitmap;
function FilterEmboss(bmp: TBGRACustomBitmap; angle: single; AStrength: integer= 64; AOptions: TEmbossOptions = []): TBGRACustomBitmap; overload;
function FilterEmboss(bmp: TBGRACustomBitmap; angle: single; ABounds: TRect; AStrength: integer= 64; AOptions: TEmbossOptions = []): TBGRACustomBitmap; overload;
function FilterEmbossHighlight(bmp: TBGRACustomBitmap; FillSelection: boolean; DefineBorderColor: TBGRAPixel): TBGRACustomBitmap;
function FilterEmbossHighlightOffset(bmp: TBGRACustomBitmap; FillSelection: boolean; DefineBorderColor: TBGRAPixel; var Offset: TPoint): TBGRACustomBitmap;
function FilterGrayscale(bmp: TBGRACustomBitmap): TBGRACustomBitmap; overload;
function FilterGrayscale(bmp: TBGRACustomBitmap; ABounds: TRect): TBGRACustomBitmap; overload;
function FilterMedian(bmp: TBGRACustomBitmap; Option: TMedianOption): TBGRACustomBitmap;
function FilterNormalize(bmp: TBGRACustomBitmap; ABounds: TRect; eachChannel: boolean = True): TBGRACustomBitmap; overload;
function FilterNormalize(bmp: TBGRACustomBitmap; eachChannel: boolean = True): TBGRACustomBitmap; overload;
function FilterPixelate(bmp: TBGRACustomBitmap; pixelSize: integer; useResample: boolean; filter: TResampleFilter = rfLinear): TBGRACustomBitmap;
function FilterPlane(bmp: TBGRACustomBitmap): TBGRACustomBitmap;
function FilterRotate(bmp: TBGRACustomBitmap; origin: TPointF; angle: single; correctBlur: boolean = false): TBGRACustomBitmap;
function FilterSharpen(bmp: TBGRACustomBitmap; ABounds: TRect; AAmount: integer = 256): TBGRACustomBitmap; overload;
function FilterSharpen(bmp: TBGRACustomBitmap; AAmount: integer = 256): TBGRACustomBitmap; overload;
function FilterSmartZoom3(bmp: TBGRACustomBitmap; Option: TMedianOption): TBGRACustomBitmap;
function FilterSphere(bmp: TBGRACustomBitmap): TBGRACustomBitmap;
function FilterTwirl(bmp: TBGRACustomBitmap; ACenter: TPoint; ARadius: Single; ATurn: Single=1; AExponent: Single=3): TBGRACustomBitmap; overload;
function FilterTwirl(bmp: TBGRACustomBitmap; ABounds: TRect; ACenter: TPoint; ARadius: Single; ATurn: Single=1; AExponent: Single=3): TBGRACustomBitmap; overload;

Types

TFilterTask = BGRAFilterType.TFilterTask;
TMotionBlurTask = BGRAFilterBlur.TMotionBlurTask;
TRadialBlurTask = BGRAFilterBlur.TRadialBlurTask;

Description

Functions and Procedures

function CreateBlurTask(ABmp: TBGRACustomBitmap; ABounds: TRect; AMask: TCustomUniversalBitmap; AMaskIsThreadSafe: boolean = false): TFilterTask;

This item has no description.

function CreateGrayscaleTask(bmp: TBGRACustomBitmap; ABounds: TRect): TFilterTask;

This item has no description.

function CreateMotionBlurTask(ABmp: TBGRACustomBitmap; ABounds: TRect; ADistance,AAngle: single; AOriented: boolean): TMotionBlurTask;

This item has no description.

function CreateRadialBlurTask(ABmp: TBGRACustomBitmap; ABounds: TRect; ARadius: single; ABlurType: TRadialBlurType): TRadialBlurTask; overload;

This item has no description.

function CreateRadialBlurTask(ABmp: TBGRACustomBitmap; ABounds: TRect; ARadiusX,ARadiusY: single; ABlurType: TRadialBlurType): TRadialBlurTask; overload;

This item has no description.

function CreateRadialPreciseBlurTask(ABmp: TBGRACustomBitmap; ABounds: TRect; ARadius: single): TRadialBlurTask; deprecated 'Use CreateRadialBlurTask with blurType:=rbPrecise and radius multiplied by 10';

Warning: this symbol is deprecated: Use CreateRadialBlurTask with blurType:=rbPrecise and radius multiplied by 10

This item has no description.

function FilterBlur(bmp: TBGRACustomBitmap; AMask: TCustomUniversalBitmap; AMaskIsThreadSafe: boolean = false): TBGRACustomBitmap;

General purpose blur filter, with a blur mask as parameter to describe how pixels influence each other

function FilterBlurMotion(bmp: TBGRACustomBitmap; distance: single; angle: single; oriented: boolean): TBGRACustomBitmap;

This item has no description.

function FilterBlurRadial(bmp: TBGRACustomBitmap; radius: single; blurType: TRadialBlurType): TBGRACustomBitmap; overload;

This item has no description.

function FilterBlurRadial(bmp: TBGRACustomBitmap; radiusX: single; radiusY: single; blurType: TRadialBlurType): TBGRACustomBitmap; overload;

This item has no description.

function FilterBlurRadialPrecise(bmp: TBGRACustomBitmap; radius: single): TBGRACustomBitmap; deprecated 'Use FilterBlurRadial with blurType:=rbPrecise and radius multiplied by 10';

Warning: this symbol is deprecated: Use FilterBlurRadial with blurType:=rbPrecise and radius multiplied by 10

The precise blur allow to specify the blur radius with subpixel accuracy

function FilterContour(bmp: TBGRACustomBitmap; AGammaCorrection: boolean = false): TBGRACustomBitmap;

Compute a contour, as if the image was drawn with a 2 pixels-wide black pencil

function FilterCylinder(bmp: TBGRACustomBitmap): TBGRACustomBitmap;

Distort the image as if it were on a vertical cylinder

function FilterEmboss(bmp: TBGRACustomBitmap; angle: single; AStrength: integer= 64; AOptions: TEmbossOptions = []): TBGRACustomBitmap; overload;

Emboss filter compute a color difference in the angle direction

function FilterEmboss(bmp: TBGRACustomBitmap; angle: single; ABounds: TRect; AStrength: integer= 64; AOptions: TEmbossOptions = []): TBGRACustomBitmap; overload;

This item has no description.

function FilterEmbossHighlight(bmp: TBGRACustomBitmap; FillSelection: boolean; DefineBorderColor: TBGRAPixel): TBGRACustomBitmap;

Emboss highlight computes a sort of emboss with 45 degrees angle and with standard selection color (white/black and filled with blue)

function FilterEmbossHighlightOffset(bmp: TBGRACustomBitmap; FillSelection: boolean; DefineBorderColor: TBGRAPixel; var Offset: TPoint): TBGRACustomBitmap;

This item has no description.

function FilterGrayscale(bmp: TBGRACustomBitmap): TBGRACustomBitmap; overload;

Grayscale converts colored pixel into grayscale with same luminosity

function FilterGrayscale(bmp: TBGRACustomBitmap; ABounds: TRect): TBGRACustomBitmap; overload;

This item has no description.

function FilterMedian(bmp: TBGRACustomBitmap; Option: TMedianOption): TBGRACustomBitmap;

The median filter consist in calculating the median value of pixels. Here a square of 9x9 pixel is considered. The median allow to select the most representative colors. The option parameter allow to choose to smooth the result or not.

function FilterNormalize(bmp: TBGRACustomBitmap; ABounds: TRect; eachChannel: boolean = True): TBGRACustomBitmap; overload;

This item has no description.

function FilterNormalize(bmp: TBGRACustomBitmap; eachChannel: boolean = True): TBGRACustomBitmap; overload;

Normalize use the whole available range of values, making dark colors darkest possible and light colors lightest possible

function FilterPixelate(bmp: TBGRACustomBitmap; pixelSize: integer; useResample: boolean; filter: TResampleFilter = rfLinear): TBGRACustomBitmap;

This item has no description.

function FilterPlane(bmp: TBGRACustomBitmap): TBGRACustomBitmap;

Compute a plane projection towards infinity (SLOW)

function FilterRotate(bmp: TBGRACustomBitmap; origin: TPointF; angle: single; correctBlur: boolean = false): TBGRACustomBitmap;

Rotate filter rotate the image and clip it in the bounding rectangle

function FilterSharpen(bmp: TBGRACustomBitmap; ABounds: TRect; AAmount: integer = 256): TBGRACustomBitmap; overload;

This item has no description.

function FilterSharpen(bmp: TBGRACustomBitmap; AAmount: integer = 256): TBGRACustomBitmap; overload;

Sharpen filter add more contrast between pixels

function FilterSmartZoom3(bmp: TBGRACustomBitmap; Option: TMedianOption): TBGRACustomBitmap;

SmartZoom x3 is a filter that upsizes 3 times the picture and add pixels that could be logically expected (horizontal, vertical, diagonal lines)

function FilterSphere(bmp: TBGRACustomBitmap): TBGRACustomBitmap;

Distort the image as if it were on a sphere

function FilterTwirl(bmp: TBGRACustomBitmap; ACenter: TPoint; ARadius: Single; ATurn: Single=1; AExponent: Single=3): TBGRACustomBitmap; overload;

Twirl distortion, i.e. a progressive rotation

function FilterTwirl(bmp: TBGRACustomBitmap; ABounds: TRect; ACenter: TPoint; ARadius: Single; ATurn: Single=1; AExponent: Single=3): TBGRACustomBitmap; overload;

This item has no description.

Types

TFilterTask = BGRAFilterType.TFilterTask;

Task to apply a filter on an image

TMotionBlurTask = BGRAFilterBlur.TMotionBlurTask;

Motion blur merge pixels in a direction. The oriented parameter specifies if the weights of the pixels are the same along the line or not.

TRadialBlurTask = BGRAFilterBlur.TRadialBlurTask;

A radial blur applies a blur with a circular influence, i.e, each pixel is merged with pixels within the specified radius. There is an exception with rbFast blur, the optimization entails a hyperbolic shape.