From 243e53c4134bf9300402dce84322f85660ae88fe Mon Sep 17 00:00:00 2001 From: Bauke Date: Mon, 7 Mar 2022 22:08:28 +0100 Subject: [PATCH] Add abstract getter for default parameters. --- source/gegl/base.ts | 2 ++ source/gegl/crop.ts | 4 ++++ source/gegl/generic.ts | 4 ++++ source/gegl/mirrors.ts | 4 ++++ source/gegl/newsprint.ts | 4 ++++ source/gegl/simplex-noise.ts | 4 ++++ 6 files changed, 22 insertions(+) diff --git a/source/gegl/base.ts b/source/gegl/base.ts index 2061bdf..e809032 100644 --- a/source/gegl/base.ts +++ b/source/gegl/base.ts @@ -1,4 +1,6 @@ export abstract class BaseOperation

{ + public abstract get default(): P; + public parameters: P; /** diff --git a/source/gegl/crop.ts b/source/gegl/crop.ts index 44ec09c..2c3fcea 100644 --- a/source/gegl/crop.ts +++ b/source/gegl/crop.ts @@ -17,6 +17,10 @@ export class Crop extends BaseOperation { y: 0, }; + public get default() { + return Crop.default; + } + public appendCrop = false; public name = 'gegl:crop'; diff --git a/source/gegl/generic.ts b/source/gegl/generic.ts index 09341e1..c5f6a60 100644 --- a/source/gegl/generic.ts +++ b/source/gegl/generic.ts @@ -3,6 +3,10 @@ import {BaseOperation} from './base.js'; export type GenericParameters = Record; export class Generic extends BaseOperation { + public get default() { + return {}; + } + public appendCrop: boolean; public name: string; diff --git a/source/gegl/mirrors.ts b/source/gegl/mirrors.ts index 6f41fc9..680c4d3 100644 --- a/source/gegl/mirrors.ts +++ b/source/gegl/mirrors.ts @@ -33,6 +33,10 @@ export class Mirrors extends BaseOperation { warp: true, }; + public get default() { + return Mirrors.default; + } + public appendCrop = false; public name = 'gegl:mirrors'; diff --git a/source/gegl/newsprint.ts b/source/gegl/newsprint.ts index f669388..40398b7 100644 --- a/source/gegl/newsprint.ts +++ b/source/gegl/newsprint.ts @@ -45,6 +45,10 @@ export class Newsprint extends BaseOperation { turbulence: 0, }; + public get default() { + return Newsprint.default; + } + public appendCrop = false; public name = 'gegl:newsprint'; diff --git a/source/gegl/simplex-noise.ts b/source/gegl/simplex-noise.ts index 6d6c7ea..6f94688 100644 --- a/source/gegl/simplex-noise.ts +++ b/source/gegl/simplex-noise.ts @@ -13,6 +13,10 @@ export class SimplexNoise extends BaseOperation { seed: 1, }; + public get default() { + return SimplexNoise.default; + } + public appendCrop = true; public name = 'gegl:simplex-noise';