Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
Mask.php
1
<?php
9
namespace
Bitrix\Main\File\Image
;
10
11
class
Mask
implements
\ArrayAccess
12
{
13
protected
$mask
= [
14
[1, 1, 1],
15
[1, 1, 1],
16
[1, 1, 1],
17
];
18
23
public
function
__construct
(array
$mask
=
null
)
24
{
25
if
(
$mask
!==
null
)
26
{
27
$this->mask =
$mask
;
28
}
29
}
30
34
public
function
getValue
()
35
{
36
return
$this->mask
;
37
}
38
42
public
function
getVector
()
43
{
44
$result = [];
45
foreach
($this->mask as $row)
46
{
47
foreach
($row as $column)
48
{
49
$result[] = $column;
50
}
51
}
52
return
$result;
53
}
54
59
public
static
function
createSharpen
($precision)
60
{
61
$mask
=
null
;
62
if
($precision > 0)
63
{
64
$k = 1.0/((int)$precision);
65
$mask
= [
66
[-$k, -$k, -$k],
67
[-$k, 1+8*$k, -$k],
68
[-$k, -$k, -$k],
69
];
70
}
71
return
new
static
(
$mask
);
72
}
73
74
public
function
offsetSet
($offset, $value): void
75
{
76
if
(is_null($offset))
77
{
78
$this->mask[] = $value;
79
}
80
else
81
{
82
$this->mask[$offset] = $value;
83
}
84
}
85
86
public
function
offsetExists
($offset): bool
87
{
88
return
isset($this->mask[$offset]);
89
}
90
91
public
function
offsetUnset
($offset): void
92
{
93
unset($this->mask[$offset]);
94
}
95
96
#[\ReturnTypeWillChange]
97
public
function
offsetGet
($offset)
98
{
99
return
($this->mask[$offset] ??
null
);
100
}
101
}
Bitrix\Main\File\Image\Mask
Definition
Mask.php:12
Bitrix\Main\File\Image\Mask\offsetUnset
offsetUnset($offset)
Definition
Mask.php:91
Bitrix\Main\File\Image\Mask\offsetExists
offsetExists($offset)
Definition
Mask.php:86
Bitrix\Main\File\Image\Mask\offsetGet
offsetGet($offset)
Definition
Mask.php:97
Bitrix\Main\File\Image\Mask\getVector
getVector()
Definition
Mask.php:42
Bitrix\Main\File\Image\Mask\createSharpen
static createSharpen($precision)
Definition
Mask.php:59
Bitrix\Main\File\Image\Mask\$mask
$mask
Definition
Mask.php:13
Bitrix\Main\File\Image\Mask\getValue
getValue()
Definition
Mask.php:34
Bitrix\Main\File\Image\Mask\offsetSet
offsetSet($offset, $value)
Definition
Mask.php:74
Bitrix\Main\File\Image\Mask\__construct
__construct(array $mask=null)
Definition
Mask.php:23
Bitrix\Main\File\Image
Definition
Color.php:9
modules
main
lib
File
Image
Mask.php
Создано системой
1.10.0