Skip to content

Commit 3b8f267

Browse files
committed
Renamed MagickAlphaOption to AlphaAction.
1 parent 9b9193b commit 3b8f267

7 files changed

+19
-19
lines changed

src/enums/magick-alpha-option.ts src/enums/alpha-action.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*/
55

66
/**
7-
* Specifies alpha options.
7+
* Specifies alpha actions.
88
*/
9-
export const MagickAlphaOption = {
9+
export const AlphaAction = {
1010
/**
1111
* Undefined.
1212
*/
@@ -107,4 +107,4 @@ export const MagickAlphaOption = {
107107
OffIfOpaque: 16
108108
} as const;
109109

110-
export type MagickAlphaOption = typeof MagickAlphaOption[keyof typeof MagickAlphaOption];
110+
export type AlphaAction = typeof AlphaAction[keyof typeof AlphaAction];

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export * from './drawing/drawable-text';
3434
export * from './drawing/drawable';
3535
export * from './drawing/drawables';
3636
export * from './drawing/drawing-wand';
37+
export * from './enums/alpha-action';
3738
export * from './enums/auto-threshold-method';
3839
export * from './enums/channels';
3940
export * from './enums/class-type';
@@ -55,7 +56,6 @@ export * from './enums/gravity';
5556
export * from './enums/interlace';
5657
export * from './enums/kernel';
5758
export * from './enums/log-event-types';
58-
export * from './enums/magick-alpha-option';
5959
export * from './enums/magick-error-severity';
6060
export * from './enums/magick-format';
6161
export * from './enums/magick-orientation';

src/magick-image.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Licensed under the Apache License, Version 2.0.
44
*/
55

6+
import { AlphaAction } from './enums/alpha-action';
67
import { AsyncImageCallback, AsyncImageCollectionCallback, ImageCallback, ImageCollectionCallback, SyncImageCallback, SyncImageCollectionCallback } from './types/callbacks';
78
import { AutoThresholdMethod } from './enums/auto-threshold-method';
89
import { ByteArray, _isByteArray } from './byte-array';
@@ -42,7 +43,6 @@ import { IDrawable } from './drawing/drawable';
4243
import { ImageMagick } from './image-magick';
4344
import { ImageProfile, IImageProfile } from './profiles/image-profile';
4445
import { Interlace } from './enums/interlace';
45-
import { MagickAlphaOption } from './enums/magick-alpha-option';
4646
import { MagickColor, IMagickColor } from './magick-color';
4747
import { MagickError } from './magick-error';
4848
import { MagickErrorInfo } from './types/magick-error-info';
@@ -440,10 +440,10 @@ export interface IMagickImage extends IDisposable {
440440
addNoise(noiseType: NoiseType, attenuate: number, channels: Channels): void;
441441

442442
/**
443-
* Applies the specified alpha option.
444-
* @param value The option to use.
443+
* Applies the specified alpha action.
444+
* @param value The action to use.
445445
*/
446-
alpha(value: MagickAlphaOption): void;
446+
alpha(value: AlphaAction): void;
447447

448448
/**
449449
* Annotate using specified text, and bounding area.
@@ -2213,7 +2213,7 @@ export class MagickImage extends NativeInstance implements IMagickImage {
22132213
set hasAlpha(value: boolean) {
22142214
this.useExceptionPointer(exception => {
22152215
if (value)
2216-
this.alpha(MagickAlphaOption.Opaque);
2216+
this.alpha(AlphaAction.Opaque);
22172217

22182218
ImageMagick._api._MagickImage_HasAlpha_Set(this._instance, this.fromBool(value), exception);
22192219
});
@@ -2430,7 +2430,7 @@ export class MagickImage extends NativeInstance implements IMagickImage {
24302430
});
24312431
}
24322432

2433-
alpha(value: MagickAlphaOption): void {
2433+
alpha(value: AlphaAction): void {
24342434
this.useExceptionPointer(exception => {
24352435
ImageMagick._api._MagickImage_SetAlpha(this._instance, value, exception);
24362436
});

tests/magick-image/alpha.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
Licensed under the Apache License, Version 2.0.
44
*/
55

6-
import { MagickAlphaOption } from '@src/enums/magick-alpha-option';
6+
import { AlphaAction } from '@src/enums/alpha-action';
77
import { TestFiles } from '@test/test-files';
88

99
describe('MagickImage#alpha', () => {
1010
it('should enable alpha channel', () => {
1111
TestFiles.Images.Builtin.logo.use(image => {
12-
image.alpha(MagickAlphaOption.On);
12+
image.alpha(AlphaAction.On);
1313
expect(image.channelCount).toBe(5);
1414
expect(image.hasAlpha).toBe(true);
1515
});

tests/magick-image/channels.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Licensed under the Apache License, Version 2.0.
44
*/
55

6-
import { MagickAlphaOption } from '@src/enums/magick-alpha-option';
6+
import { AlphaAction } from '@src/enums/alpha-action';
77
import { PixelChannel } from '@src/enums/pixel-channel';
88
import { TestFiles } from '@test/test-files';
99

@@ -21,7 +21,7 @@ describe('MagickImage#channels', () => {
2121

2222
it('should return the correct channels for a cmyk image', () => {
2323
TestFiles.Images.cmykJpg.use(image => {
24-
image.alpha(MagickAlphaOption.Activate);
24+
image.alpha(AlphaAction.Activate);
2525

2626
const channels = image.channels;
2727

tests/magick-image/distort.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { DistortMethod } from '@src/enums/distort-method';
77
import { DistortSettings } from '@src/settings/distort-settings';
8-
import { MagickAlphaOption } from '@src/enums/magick-alpha-option';
8+
import { AlphaAction } from '@src/enums/alpha-action';
99
import { VirtualPixelMethod } from '@src/enums/virtual-pixel-method';
1010
import { TestFiles } from '@test/test-files';
1111

@@ -20,7 +20,7 @@ describe('MagickImage#distort', () => {
2020

2121
it('should distort the image', () => {
2222
TestFiles.Images.Builtin.rose.use(image => {
23-
image.alpha(MagickAlphaOption.Set);
23+
image.alpha(AlphaAction.Set);
2424
image.virtualPixelMethod = VirtualPixelMethod.Transparent;
2525
image.distort(DistortMethod.PerspectiveProjection, [1.40, 0.25, 3.0, 0.15, 1.30, 0.0, 0.007, 0.009]);
2626

@@ -34,7 +34,7 @@ describe('MagickImage#distort', () => {
3434

3535
it('should distort the image with the settings', () => {
3636
TestFiles.Images.Builtin.rose.use(image => {
37-
image.alpha(MagickAlphaOption.Set);
37+
image.alpha(AlphaAction.Set);
3838
image.virtualPixelMethod = VirtualPixelMethod.Transparent;
3939

4040
const settings = new DistortSettings(DistortMethod.PerspectiveProjection);

tests/magick-image/negate-gray-scale.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { Channels } from '@src/enums/channels';
7-
import { MagickAlphaOption } from '@src/enums/magick-alpha-option';
7+
import { AlphaAction } from '@src/enums/alpha-action';
88
import { MagickColors } from '@src/magick-colors';
99
import { TestFiles } from '@test/test-files';
1010

@@ -27,7 +27,7 @@ describe('MagickImage#negateGrayScale', () => {
2727
it('should only negate grascale on specified channels', () => {
2828
TestFiles.Images.empty.use((image) => {
2929
image.read(MagickColors.White, 2, 1);
30-
image.alpha(MagickAlphaOption.Opaque);
30+
image.alpha(AlphaAction.Opaque);
3131

3232
image.getPixels(pixels => {
3333
pixels.setPixel(1, 0, [255, 0, 0]);

0 commit comments

Comments
 (0)