Example #1
0
<?php

include "./inc/includas.inc";
$hex = 3;
echo $hex . "\n";
$places = 1;
$shiftas = $hex << $places;
printf("%012b\n", $hex <<= 6);
printf("%012b\n", $shiftas);
echo pack("H*", "4D");
echo pack("H*", 137) . "\n";
$bin = sprintf('%4X', 13);
echo str_replace(" ", "0", $bin) . "\n";
echo $bin . "\n";
echo tohex('DB2f011500', 5) . "\n";
$eit = "4EF0500104C5000003EA000000000001D95618000001000080154D136C6974044E616D650A4576656E7420746578740002D95619000001000000144D126C6974065661726461730741707261736173";
echo crc32mpeg($eit) . "  crc \n";
$i = 2;
if ($i < 256) {
    $tbid = 50;
} elseif ($i >= 256 and $i < 512) {
    $tbid = 51;
} elseif ($i >= 512 and $i < 768) {
    $tbid = "52";
} elseif ($i >= 768 and $i < 1024) {
    $tbid = "53";
} elseif ($i >= 1024 and $i < 1280) {
    $tbid = "54";
} elseif ($i >= 1280 and $i < 1536) {
    $tbid = "55";
} elseif ($i >= 1536 and $i < 1792) {
Example #2
0
function format($mode = 'rgb', $rgba, $alpha = false, $name = false)
{
    if (!$rgba) {
        return false;
    }
    $r = $rgba['r'];
    $g = $rgba['g'];
    $b = $rgba['b'];
    $a = $rgba['a'];
    if ($alpha) {
        switch ($mode) {
            case 'hex':
                return tohex($r, $g, $b, $a);
            case 'hsl':
                return tohsl($r, $g, $b, $a);
            case 'rgb':
                return torgb($r, $g, $b, $a);
            case 'rgb_pcnt':
                return torgb_pcnt($r, $g, $b, $a);
            case 'name':
                return torgb($r, $g, $b, $a);
        }
    }
    switch ($mode) {
        case 'hex':
            return tohex($r, $g, $b);
        case 'hsl':
            return tohsl($r, $g, $b);
        case 'rgb':
            return torgb($r, $g, $b);
        case 'rgb_pcnt':
            return torgb_pcnt($r, $g, $b);
        case 'name':
            if ($name) {
                $colorName = toname(tohexraw($r, $g, $b));
                if ($colorName !== false) {
                    return $colorName;
                }
            }
            return torgb($r, $g, $b);
    }
}
Example #3
0
    //Sekcijos Nr.
    $eit .= tohex($pasksecnr, 2);
    //Paskutines sekcijos Nr.
    $eit .= tohex($row1[esid], 4);
    //Transport stream ID
    $eit .= pack("H*", "0457");
    //Originalus tinklo ID
    $eit .= tohex($pasksecnr, 2);
    //Segmeno paskutines sekcijos numeris !!!!!!!!!!kolkas nera,  ideta sekcijos numeris
    $eit .= pack("H*", "4E");
    //Paskutines lentos ID
    $sekilg = strlen($eit . $eventall . $descall);
    //Sekcijos ilgis
    $sekilg = $sekilg + 61444;
    //  61444 reikalingas bitu prastumimui
    $sekilg = tohex($sekilg, 4);
    $tabid = pack("H*", "4E");
    // Lentos ID
    $creit = $tabid . $sekilg . $eit . $eventall . $descall;
    $creit = bin2hex($creit);
    $crc = pack("H*", crc32mpeg($creit));
    //CRC mpeg2
    $eit = $tabid . $sekilg . $eit;
    fwrite($fp1, pack("H*", "00"));
    // prieki sekcijos du 00
    fwrite($fp1, $eit);
    fwrite($fp1, $eventall);
    fwrite($fp1, $descall);
    fwrite($fp1, $crc);
}
fclose($fp1);
Example #4
0
$g = $rgba[1];
$b = $rgba[2];
$a = $rgba[3];
$hexraw = tohexraw($r, $g, $b, $a);
if (!$w->read($w->cache() . "/{$hexraw}.png")) {
    $img_rgba = array(round($r * 255), round($g * 255), round($b * 255), round(abs($a - 1) * 127));
    $img = imagecreatefrompng('checker.png');
    $color = imagecolorallocatealpha($img, $img_rgba[0], $img_rgba[1], $img_rgba[2], $img_rgba[3]);
    imagefilledrectangle($img, 8, 8, 120, 120, $color);
    imagepng($img, $w->cache() . "/{$hexraw}.png");
    imagedestroy($img);
}
if ($a == 1) {
    $a = false;
}
$hex = tohex($r, $g, $b, $a);
//$hexraw = tohexraw($r,$g,$b,$a);
$hsl = tohsl($r, $g, $b, $a);
$name = toname(tohexraw($r, $g, $b));
$rgb = torgb($r, $g, $b, $a);
$rgb_pcnt = torgb_pcnt($r, $g, $b, $a);
$modes = array('hex' => $hex, 'hsl' => $hsl, 'name' => $name, 'rgb' => $rgb, 'rgb_pcnt' => $rgb_pcnt);
if (!$a) {
    $description = array('hex' => 'Hexadecimal format', 'hsl' => 'HSL format', 'name' => 'CSS3 named color', 'rgb' => 'RGB format', 'rgb_pcnt' => 'RGB percent format');
} else {
    $description = array('hex' => 'Hexadecimal format', 'hsl' => 'HSLA format', 'name' => 'CSS3 named color', 'rgb' => 'RGBA format', 'rgb_pcnt' => 'RGBA percent format');
}
foreach ($modes as $this_mode => $result) {
    if ($result == false) {
        continue;
    }