-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
40 lines (28 loc) · 829 Bytes
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace TestAlg;
use \TestAlg\Points\Helper as PointsHelper;
use \TestAlg\Image\Image;
use \TestAlg\Algs\DP;
use \TestAlg\Algs\VW;
include 'conf.php';
include 'src.php';
$src_array = isset($_REQUEST['src']) ? 'src'.$_REQUEST['src'] : 'src1';
$src = isset($$src_array) ? $$src_array : $src1;
$src_array = PointsHelper::multiplicateCoordinatesArray($src, 4);
$src_points = PointsHelper::fromArrayToPoints($src_array);
$image = new Image();
$a = 255;
$image -> addPoints($src_array, Image::RED);
for($i = 100; $i < 10000; $i +=$i)
{
dec($a);
$DP = DP::runWithoutRecursion($src_points, $i);
$image->addPoints(PointsHelper::fromPointsToArray($DP), $a);
}
$image -> printImage();
function dec(&$color)
{
if ($color > 128) $color -= 16;
elseif ($color > 32) $color -=4;
elseif ($color > 2) --$color;
}