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 = {
|
|
||||||
a: -1.381068,
|
|
||||||
b: -1.381068,
|
|
||||||
c: 0,
|
|
||||||
d: 1.381068,
|
|
||||||
e: -1.381068,
|
|
||||||
f: 0,
|
|
||||||
};
|
|
||||||
export const transform1Weight = 0.56453495;
|
export const transform1Weight = 0.56453495;
|
||||||
|
export const transform1 = new Transform(
|
||||||
|
{
|
||||||
|
a: -1.381068,
|
||||||
|
b: -1.381068,
|
||||||
|
c: 0,
|
||||||
|
d: 1.381068,
|
||||||
|
e: -1.381068,
|
||||||
|
f: 0,
|
||||||
|
},
|
||||||
|
[[1, julia]]
|
||||||
|
);
|
||||||
|
|
||||||
export const transform2Coefs: Coefs = {
|
|
||||||
a: 0.031393,
|
|
||||||
b: 0.031367,
|
|
||||||
c: 0,
|
|
||||||
d: -0.031367,
|
|
||||||
e: 0.031393,
|
|
||||||
f: 0,
|
|
||||||
};
|
|
||||||
export const transform2Weight = 0.013135;
|
export const transform2Weight = 0.013135;
|
||||||
|
export const transform2 = new Transform(
|
||||||
export const transform3Coefs: Coefs = {
|
{
|
||||||
a: 1.51523,
|
a: 0.031393,
|
||||||
b: -3.048677,
|
b: 0.031367,
|
||||||
c: 0.724135,
|
c: 0,
|
||||||
d: 0.740356,
|
d: -0.031367,
|
||||||
e: -1.455964,
|
e: 0.031393,
|
||||||
f: -0.362059,
|
f: 0,
|
||||||
};
|
},
|
||||||
export const transform3Pdj = [1.09358, 2.13048, 2.54127, 2.37267];
|
[
|
||||||
export const transform3Weight = 0.42233;
|
|
||||||
|
|
||||||
export function renderBaseline(image: ImageData) {
|
|
||||||
const transform1 = new Transform(transform1Coefs, [[1, julia]]);
|
|
||||||
|
|
||||||
const transform2 = new Transform(transform2Coefs, [
|
|
||||||
[1, linear],
|
[1, linear],
|
||||||
[1, popcorn],
|
[1, popcorn],
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
|
|
||||||
const [pdjA, pdjB, pdjC, pdjD] = transform3Pdj;
|
export const transform3Weight = 0.42233;
|
||||||
const transform3 = new Transform(transform3Coefs, [
|
export const transform3Pdj = [1.09358, 2.13048, 2.54127, 2.37267] as const;
|
||||||
[1, pdj(pdjA, pdjB, pdjC, pdjD)],
|
export const transform3 = new Transform(
|
||||||
]);
|
{
|
||||||
|
a: 1.51523,
|
||||||
|
b: -3.048677,
|
||||||
|
c: 0.724135,
|
||||||
|
d: 0.740356,
|
||||||
|
e: -1.455964,
|
||||||
|
f: -0.362059,
|
||||||
|
},
|
||||||
|
[[1, pdj(...transform3Pdj)]]
|
||||||
|
);
|
||||||
|
|
||||||
|
export function renderBaseline(image: ImageData) {
|
||||||
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(
|
||||||
a: 1,
|
transform2.coefs,
|
||||||
b: 0,
|
[
|
||||||
c: 0.241352,
|
[1, linear],
|
||||||
d: 0,
|
[1, popcorn],
|
||||||
e: 1,
|
],
|
||||||
f: 0.271521,
|
{
|
||||||
};
|
a: 1,
|
||||||
|
b: 0,
|
||||||
|
c: 0.241352,
|
||||||
|
d: 0,
|
||||||
|
e: 1,
|
||||||
|
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,
|
{
|
||||||
b: 0,
|
a: 2,
|
||||||
c: 0,
|
b: 0,
|
||||||
d: 0,
|
c: 0,
|
||||||
e: 2,
|
d: 0,
|
||||||
f: 0,
|
e: 2,
|
||||||
};
|
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