filmtools/standards

FilmTools胶片冲洗标准的接口和类

1.1.1 2019-09-01 07:01 UTC

This package is auto-updated.

Last update: 2024-08-29 04:49:03 UTC


README

仍在实验状态

安装

$ composer require filmtools/standards

接口和特性

StandardInterface

<?php
use FilmTools\Standards\StandardInterface;

// Returns a name or short description of this developing standard.
public function getName() : string;

// Returns the minimum film density of interest
public function getDmin() : float;

// Returns the maximum film density of interest
public function getDmax() : float;

// Returns the file path to CSV with norm data
public function getNormDataFile() : string;

StandardProviderInterface

<?php
use FilmTools\Standards\StandardProviderInterface;

// Returns the Standard instance, or null.
public function getStandard() : ?StandardInterface;

StandardProviderTrait

此特性实现了作为公共 standard 成员属性的 getStandard 方法。

<?php
use FilmTools\Standards\StandardProviderTrait;
use FilmTools\Standards\StandardProviderInterface;

class MyClass implements StandardProviderInterface {
  use StandardProviderTrait;
}

$foo = new MyClass;

print_r( $foo->standard );
print_r( $foo->getStandard() );

StandardAwareInterface

StandardAwareInterface 扩展了 StandardProviderInterface

<?php
use FilmTools\Standards\StandardAwareInterface;

// Sets the Standard instance.
public function setStandard( StandardInterface $standard);

StandardAwareTrait

StandardAwareTrait 使用 StandardProviderTrait 并实现了 setStandard 方法

<?php
use FilmTools\Standards\StandardAwareTrait;
use FilmTools\Standards\StandardAwareInterface;
use FilmTools\Standards\TraditionalStandard;

class MyClass implements StandardAwareInterface {
  use StandardAwareTrait;
}

$foo = new MyClass;
$foo->setStandard( new TraditionalStandard );
print_r( $foo->standard );
print_r( $foo->getStandard() );

标准工厂

此可调用类根据开发标准名称创建一个 StandardInterface 实例。结果是 Standard 类的扩展。

构造函数接受默认标准的名称,默认为 iso6

请参见以下示例,了解如何设置开发标准。

<?php
use FilmTools\Standards\StandardsFactory;

$standard_factory = new StandardsFactory;
$standard_factory = new StandardsFactory("iso6");

// Call without standard name
$standard = $standard_factory();

echo get_class($standard);
// FilmTools\Standards\TraditionalStandard

标准类

ISO 6(传统标准)

<?php
use FilmTools\Standards\TraditionalStandard;
use FilmTools\Standards\TraditionalInterface;

echo TraditionalInterface::DMIN; // 0.1
echo TraditionalInterface::DMAX; // 1.29

$standard = new TraditionalStandard;
$standard = $standard_factory("iso6");
$standard = $standard_factory("traditional");

echo $standard->getName(); // "Traditional (ISO6)"
echo $standard->getDmin(); // 0.1
echo $standard->getDmax(); // 1.29
echo $standard->getNormDataFile // "/path/to/normdensities-iso6.csv"

Lambrecht/Woodhouse 标准

Ralph W. Lambrecht 和 Chris Woodhouse 在他们著名的书籍《超越黑白》中使用略高的密度值。

<?php
use FilmTools\Standards\LambrechtWoodhouseStandard;
use FilmTools\Standards\LambrechtWoodhouseInterface;

echo LambrechtWoodhouseInterface::DMIN; // 0.17
echo LambrechtWoodhouseInterface::DMAX; // 1.37

$standard = $standard_factory("wbm");
$standard = new LambrechtWoodhouseStandard;

echo $standard->getName(); // "Way Beyond Monochrome (Lambrecht/Woodhouse)"
echo $standard->getDmin(); // 0.17
echo $standard->getDmax(); // 1.37
echo $standard->getNormDataFile // "/path/to/normdensities-wbm.csv"

Kodak 标准

Kodak 标准扩展自 TraditionalStandard

<?php
use FilmTools\Standards\KodakStandard;

$standard = $standard_factory("kodak");
$standard = $standard_factory("ci");
$standard = new KodakStandard;

echo $standard->getName(); // "Contrast Index (Kodak)"
echo $standard->getDmin(); // 0.1
echo $standard->getDmax(); // 1.29
echo $standard->getNormDataFile // "/path/to/normdensities-ci.csv"

Ilford 标准

Ilford 标准扩展自 TraditionalStandard

<?php
use FilmTools\Standards\IlfordStandard;

$standard = $standard_factory("ilford");
$standard = $standard_factory("gbar");
$standard = new IlfordStandard;

echo $standard->getName(); // "G-bar (Ilford)"
echo $standard->getDmin(); // 0.1
echo $standard->getDmax(); // 1.29
echo $standard->getNormDataFile // "/path/to/normdensities-iso6.csv"