-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Motion Blur #105
Added Motion Blur #105
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,8 @@ export interface IMagickImage extends IDisposable { | |
modulate(brightness: Percentage): void; | ||
modulate(brightness: Percentage, saturation: Percentage): void; | ||
modulate(brightness: Percentage, saturation: Percentage, hue: Percentage): void; | ||
motionBlur():void; | ||
motionBlur(radius?: number, sigma?: number, angle?: number): void; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All these numbers should be mandatory in this overload. |
||
negate(): void; | ||
negate(channels: Channels): void; | ||
negateGrayScale(): void; | ||
|
@@ -1149,6 +1151,18 @@ export class MagickImage extends NativeInstance implements IMagickImage { | |
}); | ||
} | ||
|
||
motionBlur():void; | ||
motionBlur(radiusOrUndefined?: number, sigmaOrUndefined?: number, angleOrUndefined?: number): void { | ||
const radius = this.valueOrDefault(radiusOrUndefined, 10); | ||
const sigma = this.valueOrDefault(sigmaOrUndefined, 1); | ||
const angle = this.valueOrDefault(angleOrUndefined, 0); | ||
|
||
Exception.use(exception => { | ||
const instance = ImageMagick._api._MagickImage_MotionBlur(this._instance, radius, sigma, angle, exception.ptr); | ||
this._setInstance(instance, exception); | ||
}); | ||
} | ||
|
||
oilPaint(): void; | ||
oilPaint(radius: number): void | ||
oilPaint(radiusOrUndefined?: number): void { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright Dirk Lemstra https://github.com/dlemstra/magick-wasm. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
import { IMagickImage, MagickImage } from '../../src/magick-image'; | ||
|
||
let image: IMagickImage; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need this anymore. You can use |
||
|
||
beforeEach(() => { | ||
image = MagickImage.create(); | ||
image.read('logo:'); | ||
}); | ||
|
||
afterEach(() => { | ||
image.dispose(); | ||
}); | ||
|
||
describe('MagickImage#motionBlur', () => { | ||
it('should change pixels of the image', () => { | ||
image.motionBlur(100, 10, -90); | ||
|
||
expect(image).toHavePixelWithColor(222, 60, '#ff0d0dff'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please remove this overload? The user will always need to specify the values. In ImageMagick the last value is not mandatory but I don't want to create a specific overload for this. And this overload is also not available in the Magick.NET api and I am trying to keep this library as close as possible to the Magick.NET library.