-
Notifications
You must be signed in to change notification settings - Fork 212
Open
Description
In functions: crop, rotate
Self.delegate.crop(left, top, width, height)
Self.delegate.rotateCounterClockwise
Self.delegate.rotateCounterClockwise4
returns new instance of TLuminanceSource, it should be stored and released in TInvertedLuminanceSource.Destructor;
suggested changes:
constructor TInvertedLuminanceSource.Create(delegate: TLuminanceSource; ownDelegate : Boolean = FALSE);
begin
inherited Create(delegate.Width, delegate.Height);
Self.delegate := delegate;
Self.ownDelegate := ownDelegate; // new property
end;
destructor TInvertedLuminanceSource.Destroy;
begin
if Self.ownDelegate then
begin
FreeAndNil(Self.delegate);
end;
inherited;
end;
function TInvertedLuminanceSource.crop(const left, top, width, height: Integer): TLuminanceSource;
begin
Result := TInvertedLuminanceSource.Create(
Self.delegate.crop(left, top, width, height),
TRUE);
end;
function TInvertedLuminanceSource.rotateCounterClockwise(): TLuminanceSource;
begin
Result := TInvertedLuminanceSource.Create(
Self.delegate.rotateCounterClockwise,
TRUE);
end;
function TInvertedLuminanceSource.rotateCounterClockwise45(): TLuminanceSource;
begin
Result := TInvertedLuminanceSource.Create(
Self.delegate.rotateCounterClockwise45,
TRUE);
end;
// should return new instance like TBaseLuminanceSource.Invert()
// not optimal, but consistent with the crop and rotate functions
function TInvertedLuminanceSource.invert: TLuminanceSource;
begin
Result := TInvertedLuminanceSource.Create(SELF);
end;
Metadata
Metadata
Assignees
Labels
No labels