This repository has been archived by the owner on Feb 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbarvy.php
113 lines (90 loc) · 2.68 KB
/
barvy.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
require_once('class.color.php');
if ( empty($x) )
$x = 10;
$number = $x;
echo '
<html>
<head><title>Color Class Test</title></head>
<body bgcolor="white">
<h1 align="center">Pøíklady použití tøídy Image_color projektu wasysIS</h1>
<table cellspacing="0" cellpadding="2" width="400" border="0" align="center">
<caption><b>Barevny pøechod: FF0000 na 0000FF s zmìnou odstinu (HUE)</b></caption>
';
$color = new Image_Color;
//Porovnavame bilou a cervenou
$color->setColors("FFFFFF", "F28580");
echo "\t\t</tr>\n";
//$i = 1;
//bila - cervena
for ($x = 1; $x <= 25; $x++ ) {
$colors = $color->getRange($number);
echo "\t\t<tr>\n";
foreach ( $colors as $key => $col ) {
echo "\t\t\t".'<td bgcolor="'.$col.'"><font color="#'.Image_Color::getTextColor($col).'">'.$col.'</font></td>'."\n";
$i++;
}
echo "\t\t</tr>\n";
//Zmena odstinu o -10 stupnu (- = ztmaveni)
$color->changeHue(-10);
}
//cervena - cerna
$color->setWebSafe();
$color->setColors("FF0000", "0000FF");
echo '<tr><td colspan="'.$number.'">Zapnuto ColorSafety</td></tr>';
for ( $x = 1; $x <= 25; $x++ ) {
$colors = $color->getRange($number);
echo "\t\t<tr>\n";
foreach ( $colors as $key => $col ) {
echo "\t\t\t".'<td bgcolor="'.$col.'"><font color="#'.Image_Color::getTextColor($col).'">'.$col.'</font></td>'."\n"; $i++;
}
echo "\t\t</tr>\n";
$color->changeHue(-10);
}
$bgcolor = $color->mixColors('336699', 'ffffff');
echo '
</table>
<table cellspacing="0" cellpadding="2" width="400" height="50" border="1" align="center">
<caption><b>Color Mix dvou barev: 336699 a FFFFFF Web Safe</b></caption>
<tr>
<td bgcolor="#336699">336699</td>
</tr>
<tr>
<td bgcolor="#'.$bgcolor.'"><font color="#'.Image_Color::getTextColor($bgcolor).'">'.$bgcolor.'</font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">FFFFFF</td>
</tr>
</table>
';
$color->setWebSafe(false);
$bgcolor = $color->mixColors('336699', 'ffffff');
echo '
</table>
<table cellspacing="0" cellpadding="2" width="400" height="50" border="1" align="center">
<caption><b>Color Mix dvou barev: 336699 a FFFFFF Web Safe = false</b></caption> <tr>
<td bgcolor="#336699">336699</td>
</tr>
<tr>
<td bgcolor="#'.$bgcolor.'"><font color="#'.Image_Color::getTextColor($bgcolor).'">'.$bgcolor.'</font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">FFFFFF</td>
</tr>
</table>
';
$rgb = Image_Color::hex2rgb("336699");
echo "<h1>hex2rgb()</h1>";
echo '<pre>';
print_r($rgb);
echo '</pre>';
$rgb = Image_Color::rgb2hex($rgb);
echo "<h1>rgb2hex()</h1>";
echo '<pre>';
print_r($rgb);
echo '</pre>';
echo '
</body>
</html>
';
?>