Delphi-Quellcode:
type
// Base
TCustomFilterLayer = class(TPositionedLayer)
private
FBitmap: TBitmap32;
// ...
protected
procedure Paint(Buffer: TBitmap32); override; // get layer rect and repaint buffer with filter; work with FBitmap
procedure DoFilter(Buffer: TBitmap32); virtual; abstract;
public
constructor Create(ALayerCollection: TLayerCollection); override; // create FBitmap
destructor Destroy; override; // free FBitmap
published
property Bitmap: TBitmap32 read FBitmap;
// ...
end;
// Example filter
TInvertFilterLayer = class(TCustomFilterLayer)
protected
procedure DoFilter(Buffer: TBitmap32); override; // buffer is received in TCustomFilterLayer.Paint()
end;
var
L: TCustomFilterLayer;
// ...
L := TInvertFilterLayer.Create(ImgView.Layers);
TInvertFilterLayer(L).Bitmap.SaveToFile(...);
Only one task for TCustomFilterLayer is receive bitmap from buffer in rect=layer rect. So, in filter class just need to override DoFilter() method to get processed image in layer. It working for any filter I created.
But question is about Bitmap property: when I want to save it, eg. to file, output is empty. Why?