mirror of
https://github.com/bspeice/speice.io
synced 2024-12-22 16:48:10 -05:00
More refactoring
This commit is contained in:
parent
79394519c7
commit
e8ec0e0521
@ -137,50 +137,50 @@ export function render(flame: Flame, quality: number, image: ImageData) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const transform1Coefs: Coefs = {
|
export const transform1Weight = 0.56453495;
|
||||||
|
export const transform1 = new Transform(
|
||||||
|
{
|
||||||
a: -1.381068,
|
a: -1.381068,
|
||||||
b: -1.381068,
|
b: -1.381068,
|
||||||
c: 0,
|
c: 0,
|
||||||
d: 1.381068,
|
d: 1.381068,
|
||||||
e: -1.381068,
|
e: -1.381068,
|
||||||
f: 0,
|
f: 0,
|
||||||
};
|
},
|
||||||
export const transform1Weight = 0.56453495;
|
[[1, julia]]
|
||||||
|
);
|
||||||
|
|
||||||
export const transform2Coefs: Coefs = {
|
export const transform2Weight = 0.013135;
|
||||||
|
export const transform2 = new Transform(
|
||||||
|
{
|
||||||
a: 0.031393,
|
a: 0.031393,
|
||||||
b: 0.031367,
|
b: 0.031367,
|
||||||
c: 0,
|
c: 0,
|
||||||
d: -0.031367,
|
d: -0.031367,
|
||||||
e: 0.031393,
|
e: 0.031393,
|
||||||
f: 0,
|
f: 0,
|
||||||
};
|
},
|
||||||
export const transform2Weight = 0.013135;
|
[
|
||||||
|
[1, linear],
|
||||||
|
[1, popcorn],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
export const transform3Coefs: Coefs = {
|
export const transform3Weight = 0.42233;
|
||||||
|
export const transform3Pdj = [1.09358, 2.13048, 2.54127, 2.37267] as const;
|
||||||
|
export const transform3 = new Transform(
|
||||||
|
{
|
||||||
a: 1.51523,
|
a: 1.51523,
|
||||||
b: -3.048677,
|
b: -3.048677,
|
||||||
c: 0.724135,
|
c: 0.724135,
|
||||||
d: 0.740356,
|
d: 0.740356,
|
||||||
e: -1.455964,
|
e: -1.455964,
|
||||||
f: -0.362059,
|
f: -0.362059,
|
||||||
};
|
},
|
||||||
export const transform3Pdj = [1.09358, 2.13048, 2.54127, 2.37267];
|
[[1, pdj(...transform3Pdj)]]
|
||||||
export const transform3Weight = 0.42233;
|
);
|
||||||
|
|
||||||
export function renderBaseline(image: ImageData) {
|
export function renderBaseline(image: ImageData) {
|
||||||
const transform1 = new Transform(transform1Coefs, [[1, julia]]);
|
|
||||||
|
|
||||||
const transform2 = new Transform(transform2Coefs, [
|
|
||||||
[1, linear],
|
|
||||||
[1, popcorn],
|
|
||||||
]);
|
|
||||||
|
|
||||||
const [pdjA, pdjB, pdjC, pdjD] = transform3Pdj;
|
|
||||||
const transform3 = new Transform(transform3Coefs, [
|
|
||||||
[1, pdj(pdjA, pdjB, pdjC, pdjD)],
|
|
||||||
]);
|
|
||||||
|
|
||||||
const flame = new Flame([
|
const flame = new Flame([
|
||||||
[transform1Weight, transform1],
|
[transform1Weight, transform1],
|
||||||
[transform2Weight, transform2],
|
[transform2Weight, transform2],
|
||||||
|
@ -8,13 +8,12 @@ import {
|
|||||||
popcorn,
|
popcorn,
|
||||||
pdj,
|
pdj,
|
||||||
render,
|
render,
|
||||||
transform1Coefs,
|
|
||||||
transform1Weight,
|
transform1Weight,
|
||||||
transform2Coefs,
|
transform1,
|
||||||
transform2Weight,
|
transform2Weight,
|
||||||
transform3Coefs,
|
transform2,
|
||||||
transform3Pdj,
|
|
||||||
transform3Weight,
|
transform3Weight,
|
||||||
|
transform3,
|
||||||
} from "./2a-variations";
|
} from "./2a-variations";
|
||||||
|
|
||||||
export class TransformPost extends Transform {
|
export class TransformPost extends Transform {
|
||||||
@ -45,35 +44,26 @@ export function variationPost(coefs: Coefs, variation: Variation): Variation {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const transform2Post: Coefs = {
|
export const transform2Post = new TransformPost(
|
||||||
|
transform2.coefs,
|
||||||
|
[
|
||||||
|
[1, linear],
|
||||||
|
[1, popcorn],
|
||||||
|
],
|
||||||
|
{
|
||||||
a: 1,
|
a: 1,
|
||||||
b: 0,
|
b: 0,
|
||||||
c: 0.241352,
|
c: 0.241352,
|
||||||
d: 0,
|
d: 0,
|
||||||
e: 1,
|
e: 1,
|
||||||
f: 0.271521,
|
f: 0.271521,
|
||||||
};
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export function renderPost(image: ImageData) {
|
export function renderPost(image: ImageData) {
|
||||||
const transform1 = new Transform(transform1Coefs, [[1, julia]]);
|
|
||||||
|
|
||||||
const transform2 = new TransformPost(
|
|
||||||
transform2Coefs,
|
|
||||||
[
|
|
||||||
[1, linear],
|
|
||||||
[1, popcorn],
|
|
||||||
],
|
|
||||||
transform2Post
|
|
||||||
);
|
|
||||||
|
|
||||||
const [pdjA, pdjB, pdjC, pdjD] = transform3Pdj;
|
|
||||||
const transform3 = new Transform(transform3Coefs, [
|
|
||||||
[1, pdj(pdjA, pdjB, pdjC, pdjD)],
|
|
||||||
]);
|
|
||||||
|
|
||||||
const flame = new Flame([
|
const flame = new Flame([
|
||||||
[transform1Weight, transform1],
|
[transform1Weight, transform1],
|
||||||
[transform2Weight, transform2],
|
[transform2Weight, transform2Post],
|
||||||
[transform3Weight, transform3],
|
[transform3Weight, transform3],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -2,20 +2,15 @@ import {
|
|||||||
Coefs,
|
Coefs,
|
||||||
Flame,
|
Flame,
|
||||||
Transform,
|
Transform,
|
||||||
linear,
|
|
||||||
julia,
|
julia,
|
||||||
popcorn,
|
|
||||||
pdj,
|
|
||||||
transform1Coefs,
|
|
||||||
transform1Weight,
|
transform1Weight,
|
||||||
transform2Coefs,
|
transform1,
|
||||||
transform2Weight,
|
transform2Weight,
|
||||||
transform3Coefs,
|
|
||||||
transform3Pdj,
|
|
||||||
transform3Weight,
|
transform3Weight,
|
||||||
|
transform3,
|
||||||
render,
|
render,
|
||||||
} from "./2a-variations";
|
} from "./2a-variations";
|
||||||
import { TransformPost, transform2Post } from "./2b-post";
|
import { transform2Post } from "./2b-post";
|
||||||
|
|
||||||
export class FlameFinal extends Flame {
|
export class FlameFinal extends Flame {
|
||||||
constructor(
|
constructor(
|
||||||
@ -31,38 +26,23 @@ export class FlameFinal extends Flame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const finalCoefs: Coefs = {
|
export const transformFinal = new Transform(
|
||||||
|
{
|
||||||
a: 2,
|
a: 2,
|
||||||
b: 0,
|
b: 0,
|
||||||
c: 0,
|
c: 0,
|
||||||
d: 0,
|
d: 0,
|
||||||
e: 2,
|
e: 2,
|
||||||
f: 0,
|
f: 0,
|
||||||
};
|
},
|
||||||
|
[[1, julia]]
|
||||||
|
);
|
||||||
|
|
||||||
export function renderFinal(image: ImageData) {
|
export function renderFinal(image: ImageData) {
|
||||||
const transform1 = new Transform(transform1Coefs, [[1, julia]]);
|
|
||||||
|
|
||||||
const transform2 = new TransformPost(
|
|
||||||
transform2Coefs,
|
|
||||||
[
|
|
||||||
[1, linear],
|
|
||||||
[1, popcorn],
|
|
||||||
],
|
|
||||||
transform2Post
|
|
||||||
);
|
|
||||||
|
|
||||||
const [pdjA, pdjB, pdjC, pdjD] = transform3Pdj;
|
|
||||||
const transform3 = new Transform(transform3Coefs, [
|
|
||||||
[1, pdj(pdjA, pdjB, pdjC, pdjD)],
|
|
||||||
]);
|
|
||||||
|
|
||||||
const transformFinal = new Transform(finalCoefs, [[1, julia]]);
|
|
||||||
|
|
||||||
const flame = new FlameFinal(
|
const flame = new FlameFinal(
|
||||||
[
|
[
|
||||||
[transform1Weight, transform1],
|
[transform1Weight, transform1],
|
||||||
[transform2Weight, transform2],
|
[transform2Weight, transform2Post],
|
||||||
[transform3Weight, transform3],
|
[transform3Weight, transform3],
|
||||||
],
|
],
|
||||||
transformFinal
|
transformFinal
|
||||||
|
Loading…
Reference in New Issue
Block a user