1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-10 10:40:54 +00:00

gamma correction introduced;

This commit is contained in:
lgtst 2022-01-28 19:33:05 +03:00
parent 4fea70f605
commit f7e4b2ec53
3 changed files with 10 additions and 0 deletions

View File

@ -27,6 +27,7 @@
"start": "npm run build"
},
"dependencies": {
"@pixi/filter-adjustment": "^4.1.3",
"howler": "^2.2.1",
"log4javascript": "github:Ritzlgrmft/log4javascript",
"pako": "^1.0.10",

View File

@ -218,6 +218,7 @@ export class PsychoJS
name,
fullscr,
color,
gamma,
units,
waitBlanking,
autoLog,
@ -239,6 +240,7 @@ export class PsychoJS
name,
fullscr,
color,
gamma,
units,
waitBlanking,
autoLog,

View File

@ -8,6 +8,7 @@
*/
import * as PIXI from "pixi.js-legacy";
import {AdjustmentFilter} from "@pixi/filter-adjustment";
import { MonotonicClock } from "../util/Clock.js";
import { Color } from "../util/Color.js";
import { PsychObject } from "../util/PsychObject.js";
@ -25,6 +26,7 @@ import { Logger } from "./Logger.js";
* @param {string} [options.name] the name of the window
* @param {boolean} [options.fullscr= false] whether or not to go fullscreen
* @param {Color} [options.color= Color('black')] the background color of the window
* @param {number} [options.gamma= 1] sets the delimiter for gamma correction. In other words gamma correction is calculated as pow(rgb, 1/gamma)
* @param {string} [options.units= 'pix'] the units of the window
* @param {boolean} [options.waitBlanking= false] whether or not to wait for all rendering operations to be done
* before flipping
@ -49,6 +51,7 @@ export class Window extends PsychObject
name,
fullscr = false,
color = new Color("black"),
gamma = 1,
units = "pix",
waitBlanking = false,
autoLog = true,
@ -64,6 +67,7 @@ export class Window extends PsychObject
this._addAttribute("fullscr", fullscr);
this._addAttribute("color", color);
this._addAttribute("gamma", gamma);
this._addAttribute("units", units);
this._addAttribute("waitBlanking", waitBlanking);
this._addAttribute("autoLog", autoLog);
@ -428,6 +432,9 @@ export class Window extends PsychObject
// create a top-level PIXI container:
this._rootContainer = new PIXI.Container();
this._rootContainer.interactive = true;
this._rootContainer.filters = [new AdjustmentFilter({
gamma: this.gamma
})];
// set the initial size of the PIXI renderer and the position of the root container:
Window._resizePixiRenderer(this);