Add gegl:newsprint.

This commit is contained in:
Bauke 2022-03-07 17:34:00 +01:00
parent cf1a9032ba
commit fc8f9ad724
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
3 changed files with 71 additions and 16 deletions

View File

@ -1,4 +1,4 @@
import {Generic, SimplexNoise} from './gegl/exports.js';
import {Generic, Newsprint, SimplexNoise} from './gegl/exports.js';
import Project from './project.js';
const [width, height] = [1920, 1080];
@ -7,21 +7,21 @@ const project: Project = {
name: '2022-03-06',
operations: [
new SimplexNoise({scale: 4, seed: 2_071_140_406}),
new Generic('gegl:newsprint', {
new Newsprint({
colorModel: 'rgb',
pattern2: 'line',
period2: '200',
angle2: '15',
period2: 200,
angle2: 15,
pattern3: 'line',
period3: '200',
angle3: '45',
period3: 200,
angle3: 45,
pattern4: 'line',
period4: '200',
angle4: '0',
period4: 200,
angle4: 0,
}),
new Generic('gegl:mirrors'),
new Generic('gegl:softglow'),
new Generic('gegl:newsprint'),
new Newsprint(),
new Generic('gegl:stereographic-projection', {tilt: 123}),
new Generic('gegl:focus-blur', {
blurType: 'gaussian',
@ -29,17 +29,17 @@ const project: Project = {
radius: 0.9,
midpoint: 0.6,
}),
new Generic('gegl:newsprint', {
new Newsprint({
colorModel: 'rgb',
pattern2: 'diamond',
period2: '200',
angle2: '0',
period2: 200,
angle2: 0,
pattern3: 'diamond',
period3: '200',
angle3: '35',
period3: 200,
angle3: 35,
pattern4: 'diamond',
period4: '200',
angle4: '55',
period4: 200,
angle4: 55,
}),
new Generic('gegl:focus-blur', {
blurType: 'gaussian',

View File

@ -1,4 +1,5 @@
export * from './base.js';
export * from './crop.js';
export * from './generic.js';
export * from './newsprint.js';
export * from './simplex-noise.js';

54
source/gegl/newsprint.ts Normal file
View File

@ -0,0 +1,54 @@
import {BaseOperation} from './base.js';
type NewsprintPattern = 'line' | 'circle' | 'diamond' | 'pssquare' | 'cross';
export interface NewsprintParameters {
aaSamples: number;
angle: number;
angle2: number;
angle3: number;
angle4: number;
angleboost: number;
blackPullout: number;
blocksize: number;
colorModel: 'black-on-white' | 'cmyk' | 'rgb' | 'white-on-black';
pattern: NewsprintPattern;
pattern2: NewsprintPattern;
pattern3: NewsprintPattern;
pattern4: NewsprintPattern;
period: number;
period2: number;
period3: number;
period4: number;
turbulence: number;
}
export class Newsprint extends BaseOperation<NewsprintParameters> {
public static default: NewsprintParameters = {
aaSamples: 16,
angle: 75,
angle2: 15,
angle3: 45,
angle4: 0,
angleboost: 0,
blackPullout: 1,
blocksize: -1,
colorModel: 'black-on-white',
pattern: 'line',
pattern2: 'line',
pattern3: 'line',
pattern4: 'line',
period: 12,
period2: 12,
period3: 12,
period4: 12,
turbulence: 0,
};
public appendCrop = false;
public name = 'gegl:newsprint';
constructor(parameters?: Partial<NewsprintParameters>) {
super({...Newsprint.default, ...parameters});
}
}