Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

Commit a512a69

Browse files
committed
Seriously.js: use color picker to define keyed color, use Seriously.js by default
Change-Id: Ia50fc5776ed8e833991b12e78f3db45e23a34bfa
1 parent 7bd905c commit a512a69

File tree

5 files changed

+23
-46
lines changed

5 files changed

+23
-46
lines changed

config/config.inc.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,9 @@
164164
$config['keying']['size'] = '1500px';
165165
$config['live_keying']['enabled'] = false;
166166
// possible variant values: 'marvinj', 'seriouslyjs'
167-
$config['keying']['variant'] = 'marvinj';
167+
$config['keying']['variant'] = 'seriouslyjs';
168168
// Seriously.js RGB values
169-
$config['seriouslyjs']['r'] = '98';
170-
$config['seriouslyjs']['g'] = '175';
171-
$config['seriouslyjs']['b'] = '116';
169+
$config['keying']['seriouslyjs_color'] = '#62af74';
172170
$config['keying']['background_path'] = 'resources/img/background';
173171
$config['live_keying']['show_all'] = false;
174172

lib/configsetup.inc.php

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -962,38 +962,12 @@
962962
],
963963
'value' => $config['keying']['variant'],
964964
],
965-
'seriouslyjs_r' => [
966-
'view' => 'expert',
967-
'type' => 'range',
968-
'placeholder' => $defaultConfig['seriouslyjs']['r'],
969-
'name' => 'seriouslyjs[r]',
970-
'value' => $config['seriouslyjs']['r'],
971-
'range_min' => 0,
972-
'range_max' => 255,
973-
'range_step' => 1,
974-
'unit' => 'empty',
975-
],
976-
'seriouslyjs_g' => [
977-
'view' => 'expert',
978-
'type' => 'range',
979-
'placeholder' => $defaultConfig['seriouslyjs']['g'],
980-
'name' => 'seriouslyjs[g]',
981-
'value' => $config['seriouslyjs']['g'],
982-
'range_min' => 0,
983-
'range_max' => 255,
984-
'range_step' => 1,
985-
'unit' => 'empty',
986-
],
987-
'seriouslyjs_b' => [
988-
'view' => 'expert',
989-
'type' => 'range',
990-
'placeholder' => $defaultConfig['seriouslyjs']['b'],
991-
'name' => 'seriouslyjs[b]',
992-
'value' => $config['seriouslyjs']['b'],
993-
'range_min' => 0,
994-
'range_max' => 255,
995-
'range_step' => 1,
996-
'unit' => 'empty',
965+
'keying_seriouslyjs_color' => [
966+
'view' => 'advanced',
967+
'type' => 'color',
968+
'name' => 'keying[seriouslyjs_color]',
969+
'placeholder' => $defaultConfig['keying']['seriouslyjs_color'],
970+
'value' => $config['keying']['seriouslyjs_color'],
997971
],
998972
'keying_background_path' => [
999973
'view' => 'expert',

resources/lang/en.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,11 @@
140140
"keying": "Chroma keying",
141141
"keying:keying_background_path": "Background images path",
142142
"keying:keying_enabled": "Allow chroma keying",
143+
"keying:keying_seriouslyjs_color": "Seriously.js keying color",
143144
"keying:keying_size": "Chromakeying size",
144145
"keying:keying_variant": "Keying algorithm",
145146
"keying:live_keying_enabled": "Use live keying as start page",
146147
"keying:live_keying_show_all": "Show original and keyed image inside gallery while using live keying",
147-
"keying:seriouslyjs_b": "Blue channel",
148-
"keying:seriouslyjs_g": "Green channel",
149-
"keying:seriouslyjs_r": "Red channel",
150148
"keyingerror": "Chroma keying not possible!",
151149
"login_invalid": "Username or password is invalid!",
152150
"login_password": "Password",
@@ -275,7 +273,6 @@
275273
"manual:keying:keying_variant": "Choose between different chromakeying algorithms. <b>Please note:</b> Seriously.js requires a browser that supports WebGL.",
276274
"manual:keying:live_keying_enabled": "Redirect from index to livechroma.php, default start page can't be accessed!",
277275
"manual:keying:live_keying_show_all": "If enabled, the original image and the keyed image get added to the gallery.",
278-
"manual:keying:seriouslyjs_b": "Enter the RGB blue channel value used on chromakeying (Seriously.js).",
279276
"manual:keying:seriouslyjs_g": "Enter the RGB green channel value used on chromakeying (Seriously.js).",
280277
"manual:keying:seriouslyjs_r": "Enter the RGB red channel value used on chromakeying (Seriously.js).",
281278
"manual:mail:mail_enabled": "If enabled, a email button is visible on each picture inside the gallery. Depending on your setup you can send pictures via email directly or collect entered email address inside a database.",

src/js/chromakeying.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,13 @@ function setMainImage(imgSrc) {
119119
chroma = seriously.effect('chroma');
120120
chroma.source = seriouslyimage;
121121
target.source = chroma;
122-
const r = config.seriouslyjs.r / 255;
123-
const g = config.seriouslyjs.g / 255;
124-
const b = config.seriouslyjs.b / 255;
122+
const color = config.keying.seriouslyjs_color;
123+
const r = parseInt(color.substr(1, 2), 16) / 255;
124+
const g = parseInt(color.substr(3, 2), 16) / 255;
125+
const b = parseInt(color.substr(5, 2), 16) / 255;
126+
if (config.dev.enabled) {
127+
console.log('Chromakeying channels. Red:', r, 'Green:', g, 'Blue:', b);
128+
}
125129
chroma.screen = [r, g, b, 1];
126130
seriously.go();
127131
mainImage = new Image();

src/js/livechroma.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,13 @@ function setMainImage(imgSrc) {
109109
chroma = seriously.effect('chroma');
110110
chroma.source = seriouslyimage;
111111
target.source = chroma;
112-
const r = config.seriouslyjs.r / 255;
113-
const g = config.seriouslyjs.g / 255;
114-
const b = config.seriouslyjs.b / 255;
112+
const color = config.keying.seriouslyjs_color;
113+
const r = parseInt(color.substr(1, 2), 16) / 255;
114+
const g = parseInt(color.substr(3, 2), 16) / 255;
115+
const b = parseInt(color.substr(5, 2), 16) / 255;
116+
if (config.dev.enabled) {
117+
console.log('Chromakeying channels. Red:', r, 'Green:', g, 'Blue:', b);
118+
}
115119
chroma.screen = [r, g, b, 1];
116120
seriously.go();
117121
mainImage = new Image();

0 commit comments

Comments
 (0)