mirror of
https://github.com/bspeice/speice.io
synced 2024-12-22 08:38:09 -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 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 transform3Coefs: Coefs = {
|
||||
a: 1.51523,
|
||||
b: -3.048677,
|
||||
c: 0.724135,
|
||||
d: 0.740356,
|
||||
e: -1.455964,
|
||||
f: -0.362059,
|
||||
};
|
||||
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, [
|
||||
export const transform2 = new Transform(
|
||||
{
|
||||
a: 0.031393,
|
||||
b: 0.031367,
|
||||
c: 0,
|
||||
d: -0.031367,
|
||||
e: 0.031393,
|
||||
f: 0,
|
||||
},
|
||||
[
|
||||
[1, linear],
|
||||
[1, popcorn],
|
||||
]);
|
||||
]
|
||||
);
|
||||
|
||||
const [pdjA, pdjB, pdjC, pdjD] = transform3Pdj;
|
||||
const transform3 = new Transform(transform3Coefs, [
|
||||
[1, pdj(pdjA, pdjB, pdjC, pdjD)],
|
||||
]);
|
||||
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,
|
||||
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([
|
||||
[transform1Weight, transform1],
|
||||
[transform2Weight, transform2],
|
||||
|
@ -8,13 +8,12 @@ import {
|
||||
popcorn,
|
||||
pdj,
|
||||
render,
|
||||
transform1Coefs,
|
||||
transform1Weight,
|
||||
transform2Coefs,
|
||||
transform1,
|
||||
transform2Weight,
|
||||
transform3Coefs,
|
||||
transform3Pdj,
|
||||
transform2,
|
||||
transform3Weight,
|
||||
transform3,
|
||||
} from "./2a-variations";
|
||||
|
||||
export class TransformPost extends Transform {
|
||||
@ -45,35 +44,26 @@ export function variationPost(coefs: Coefs, variation: Variation): Variation {
|
||||
};
|
||||
}
|
||||
|
||||
export const transform2Post: Coefs = {
|
||||
a: 1,
|
||||
b: 0,
|
||||
c: 0.241352,
|
||||
d: 0,
|
||||
e: 1,
|
||||
f: 0.271521,
|
||||
};
|
||||
export const transform2Post = new TransformPost(
|
||||
transform2.coefs,
|
||||
[
|
||||
[1, linear],
|
||||
[1, popcorn],
|
||||
],
|
||||
{
|
||||
a: 1,
|
||||
b: 0,
|
||||
c: 0.241352,
|
||||
d: 0,
|
||||
e: 1,
|
||||
f: 0.271521,
|
||||
}
|
||||
);
|
||||
|
||||
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([
|
||||
[transform1Weight, transform1],
|
||||
[transform2Weight, transform2],
|
||||
[transform2Weight, transform2Post],
|
||||
[transform3Weight, transform3],
|
||||
]);
|
||||
|
||||
|
@ -2,20 +2,15 @@ import {
|
||||
Coefs,
|
||||
Flame,
|
||||
Transform,
|
||||
linear,
|
||||
julia,
|
||||
popcorn,
|
||||
pdj,
|
||||
transform1Coefs,
|
||||
transform1Weight,
|
||||
transform2Coefs,
|
||||
transform1,
|
||||
transform2Weight,
|
||||
transform3Coefs,
|
||||
transform3Pdj,
|
||||
transform3Weight,
|
||||
transform3,
|
||||
render,
|
||||
} from "./2a-variations";
|
||||
import { TransformPost, transform2Post } from "./2b-post";
|
||||
import { transform2Post } from "./2b-post";
|
||||
|
||||
export class FlameFinal extends Flame {
|
||||
constructor(
|
||||
@ -31,38 +26,23 @@ export class FlameFinal extends Flame {
|
||||
}
|
||||
}
|
||||
|
||||
export const finalCoefs: Coefs = {
|
||||
a: 2,
|
||||
b: 0,
|
||||
c: 0,
|
||||
d: 0,
|
||||
e: 2,
|
||||
f: 0,
|
||||
};
|
||||
export const transformFinal = new Transform(
|
||||
{
|
||||
a: 2,
|
||||
b: 0,
|
||||
c: 0,
|
||||
d: 0,
|
||||
e: 2,
|
||||
f: 0,
|
||||
},
|
||||
[[1, julia]]
|
||||
);
|
||||
|
||||
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(
|
||||
[
|
||||
[transform1Weight, transform1],
|
||||
[transform2Weight, transform2],
|
||||
[transform2Weight, transform2Post],
|
||||
[transform3Weight, transform3],
|
||||
],
|
||||
transformFinal
|
||||
|
Loading…
Reference in New Issue
Block a user