Add dark defaults, modular effect templates and canvas leveling

这个提交包含在:
mac 于 2026-11-06 11:29:52 +08:00 提交
1 父节点 ffabdca5b1
当前提交 5ca307414c
25 个文件已更改
+1702 -88

没有与搜索条件相匹配的文件

+29
查看文件
@@ -0,0 +1,29 @@
#pragma once
#include <CoreGraphics/CoreGraphics.h>
#include <cmath>
#include <algorithm>
inline double DYLevelDelta(CGPoint first, CGPoint second, double aspect, bool vertical) {
const double angle = std::atan2(second.y - first.y, (second.x - first.x) * aspect);
return std::remainder((vertical ? M_PI_2 : 0.) - angle, M_PI);
}
// Coordinates are normalized to a top-down image. Rotation is measured in
// display pixels so the same line aligns in landscape, portrait and anamorphic footage.
struct DYLevelTransform {
double aspect, cosine, sine, zoom;
DYLevelTransform(double angle, double displayAspect)
: aspect(displayAspect), cosine(std::cos(angle)), sine(std::sin(angle)),
zoom(std::max(1., std::abs(cosine) + std::abs(sine) * std::max(aspect, 1. / aspect))) {}
CGPoint toSource(CGPoint output) const {
const double x = (output.x - .5) * aspect / zoom, y = (output.y - .5) / zoom;
return CGPointMake(.5 + (cosine * x + sine * y) / aspect, .5 + cosine * y - sine * x);
}
CGPoint toOutput(CGPoint source) const {
const double x = (source.x - .5) * aspect * zoom, y = (source.y - .5) * zoom;
return CGPointMake(.5 + (cosine * x - sine * y) / aspect, .5 + cosine * y + sine * x);
}
};