Spaces:
Running
Running
Update script.js
Browse files
script.js
CHANGED
@@ -121,9 +121,9 @@ const applyFilters = function() {
|
|
121 |
const blueCurve = createCurveData(blueCurvePoints);
|
122 |
|
123 |
this.process("rgbCurve", function(rgba) {
|
124 |
-
rgba.r = redCurve[rgba.r];
|
125 |
-
rgba.g = greenCurve[rgba.g];
|
126 |
-
rgba.b = blueCurve[rgba.b];
|
127 |
return rgba;
|
128 |
});
|
129 |
};
|
@@ -131,23 +131,23 @@ const applyFilters = function() {
|
|
131 |
// 輝度カーブ調整を適用
|
132 |
const applyLuminanceCurve = function() {
|
133 |
const luminanceCurve = createCurveData(luminanceCurvePoints);
|
134 |
-
const shadowAmount = parseInt(shadowsSlider.value);
|
135 |
-
const highlightAmount = parseInt(highlightsSlider.value);
|
136 |
|
137 |
this.process("luminanceAdjustment", function(rgba) {
|
138 |
const luminance = 0.299 * rgba.r + 0.587 * rgba.g + 0.114 * rgba.b;
|
139 |
const normalizedLum = luminance / 255;
|
140 |
|
141 |
-
//
|
142 |
-
const curveAdjustment = (luminanceCurve[luminance] - luminance);
|
143 |
|
144 |
// シャドウ調整(低輝度ほど強く適用)
|
145 |
-
const shadowAdjust = shadowAmount * (1 - normalizedLum);
|
146 |
|
147 |
// ハイライト調整(高輝度ほど強く適用)
|
148 |
-
const highlightAdjust = highlightAmount * normalizedLum;
|
149 |
|
150 |
-
//
|
151 |
const totalAdjust = curveAdjustment + shadowAdjust + highlightAdjust;
|
152 |
|
153 |
rgba.r = Math.min(255, Math.max(0, rgba.r + totalAdjust));
|
@@ -169,7 +169,6 @@ const applyFilters = function() {
|
|
169 |
isApplyingFilters = false;
|
170 |
}
|
171 |
};
|
172 |
-
|
173 |
// カーブを描画する関数
|
174 |
const drawCurve = function(canvas, points, color) {
|
175 |
const ctx = canvas.getContext('2d');
|
|
|
121 |
const blueCurve = createCurveData(blueCurvePoints);
|
122 |
|
123 |
this.process("rgbCurve", function(rgba) {
|
124 |
+
rgba.r = Math.min(255, Math.max(0, redCurve[rgba.r]));
|
125 |
+
rgba.g = Math.min(255, Math.max(0, greenCurve[rgba.g]));
|
126 |
+
rgba.b = Math.min(255, Math.max(0, blueCurve[rgba.b]));
|
127 |
return rgba;
|
128 |
});
|
129 |
};
|
|
|
131 |
// 輝度カーブ調整を適用
|
132 |
const applyLuminanceCurve = function() {
|
133 |
const luminanceCurve = createCurveData(luminanceCurvePoints);
|
134 |
+
const shadowAmount = parseInt(shadowsSlider.value) / 2; // 調整量を減らす
|
135 |
+
const highlightAmount = parseInt(highlightsSlider.value) / 2;
|
136 |
|
137 |
this.process("luminanceAdjustment", function(rgba) {
|
138 |
const luminance = 0.299 * rgba.r + 0.587 * rgba.g + 0.114 * rgba.b;
|
139 |
const normalizedLum = luminance / 255;
|
140 |
|
141 |
+
// カーブ調整(0-255範囲に収める)
|
142 |
+
const curveAdjustment = (luminanceCurve[luminance] - luminance) / 3;
|
143 |
|
144 |
// シャドウ調整(低輝度ほど強く適用)
|
145 |
+
const shadowAdjust = shadowAmount * (1 - normalizedLum) / 2;
|
146 |
|
147 |
// ハイライト調整(高輝度ほど強く適用)
|
148 |
+
const highlightAdjust = highlightAmount * normalizedLum / 2;
|
149 |
|
150 |
+
// 合計調整量(より控えめに)
|
151 |
const totalAdjust = curveAdjustment + shadowAdjust + highlightAdjust;
|
152 |
|
153 |
rgba.r = Math.min(255, Math.max(0, rgba.r + totalAdjust));
|
|
|
169 |
isApplyingFilters = false;
|
170 |
}
|
171 |
};
|
|
|
172 |
// カーブを描画する関数
|
173 |
const drawCurve = function(canvas, points, color) {
|
174 |
const ctx = canvas.getContext('2d');
|