当前位置: 首页>>代码示例>>PHP>>正文


PHP Converter::ColorToMono方法代码示例

本文整理汇总了PHP中Converter::ColorToMono方法的典型用法代码示例。如果您正苦于以下问题:PHP Converter::ColorToMono方法的具体用法?PHP Converter::ColorToMono怎么用?PHP Converter::ColorToMono使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Converter的用法示例。


在下文中一共展示了Converter::ColorToMono方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Converter

<?php

include 'php/converter.class.php';
$str = "Pxl-Test(TOTO,10)\n";
echo 'Avant: ' . $str . '<br />';
preg_match_all("#Pxl-Test\\([^,]+\\,[^,:\\)\\s→]+#i", $str, $matches);
/*echo $matches[0][0];
echo '<pre>'; 
print_r($matches); 
echo '</pre>';
*/
echo '<br />What we must convert: <br /><ul>';
for ($i = 0; $i < count($matches[0]); $i++) {
    $TestString = new Converter($matches[0][$i] . "\n");
    //echo '<li><b>'.$matches[0][$i].'</b> -->Taille =  '.strlen($matches[0][$i]).' --> '.$TestString->ColorToMono().'</li><br />';
    //echo 'Portion du code à modifier: '.substr($str,stripos($str, $matches[0][$i]),1+strlen($matches[0][$i]));
    $str = str_replace($matches[0][$i], $TestString->ColorToMono(), $str);
    //echo '<br />FINAL='.preg_replace("#Pxl-Test\([^,]+\,[^,:\)\s→]+#i", $TestString->ColorToMono(),$str,1);
}
echo '' . $str;
?>

开发者ID:StarTrekVoyager,项目名称:ticonverter,代码行数:21,代码来源:testregexpxltest.php

示例2: conv_coord


//.........这里部分代码省略.........
                 $global = $global . '(' . $ptnocolor[3] . ')' . $sign . $ratio_x_px;
             }
             if ($i == 4 and count($ptnocolor) <= 5) {
                 $global = $global . ',(' . substr($ptnocolor[4], 0, strlen($ptnocolor[4]) - 1) . $sign . $ratio_y_px;
             }
             if ($i == 4 and count($ptnocolor) > 5) {
                 $global = $global . ',(' . $ptnocolor[4] . ')' . $sign . $ratio_y_px;
             }
             if ($i == 6) {
                 $global = $global . ',' . $ptnocolor[6];
             }
         }
         return $global . "\n";
     } elseif (count($ptoffnocolor) > 0 and $typeOfWindows == "delta") {
         $temp = "";
         $global = $ptoffnocolor[1] . '(';
         for ($i = 3; $i <= count($ptoffnocolor); $i++) {
             if ($i == 3) {
                 $global = $global . '(' . $ptoffnocolor[3] . ')' . $sign . $ratio_x_px;
             }
             if ($i == 4 and count($ptoffnocolor) <= 5) {
                 $global = $global . ',(' . substr($ptoffnocolor[4], 0, strlen($ptoffnocolor[4]) - 1) . $sign . $ratio_y_px;
             }
             if ($i == 4 and count($ptoffnocolor) > 5) {
                 $global = $global . ',(' . $ptoffnocolor[4] . ')' . $sign . $ratio_y_px;
             }
             if ($i == 6) {
                 $global = $global . ',' . $ptoffnocolor[6];
             }
         }
         return $global . "\n";
     } elseif (count($horiznocolortab) > 0 and $typeOfWindows == "delta") {
         $global = $horiznocolortab[1] . ' (' . rtrim($horiznocolortab[2]) . $sign . $ratio_y_px . ')';
         return $global . "\n";
     } elseif (count($vertinocolortab) > 0 and $typeOfWindows == "delta") {
         $global = $vertinocolortab[1] . ' (' . rtrim($vertinocolortab[2]) . $sign . $ratio_x_px . ')';
         return $global . "\n";
     } elseif (count($ptchangenocolortab) > 0 and $typeOfWindows == "delta") {
         $global = $ptchangenocolortab[1] . '((' . $ptchangenocolortab[2] . ')' . $sign . $ratio_x_px . ',(' . rtrim($ptchangenocolortab[3]) . $sign . $ratio_y_px;
         return $global . "\n";
     } elseif (count($pxonnocolortab) > 0) {
         $global = $pxonnocolortab[1] . '(int((' . $pxonnocolortab[3] . ')' . $sign . $ratio_x_px . '),int((' . rtrim($pxonnocolortab[4]) . ')' . $sign . $ratio_y_px . '';
         return $global . "\n";
     } elseif (count($pxoffnocolortab) > 0) {
         $global = $pxoffnocolortab[1] . '((' . $pxoffnocolortab[3] . ')' . $sign . $ratio_x_px . ',(' . rtrim($pxoffnocolortab[4]) . $sign . $ratio_y_px;
         return $global . "\n";
     } elseif (count($pxlchangenocolortab) > 0) {
         $global = $pxlchangenocolortab[1] . '((' . $pxlchangenocolortab[2] . ')' . $sign . $ratio_x_px . ',(' . rtrim($pxlchangenocolortab[3]) . $sign . $ratio_y_px;
         return $global . "\n";
     } elseif (count($textnocolortab) > 0) {
         //need fix
         if (strrpos($code, "Text(-1,") === FALSE and strrpos($code, "Texte(-1,") === FALSE) {
             //classic: no -1 argument
             $global = $textnocolortab[1] . '(int((' . $textnocolortab[count($textnocolortab) - 3] . ')' . $sign . $ratio_y_txt . '),int((' . $textnocolortab[count($textnocolortab) - 2] . ')' . $sign . $ratio_x_txt . '),' . $textnocolortab[count($textnocolortab) - 1];
         } else {
             //maj size: -1 argument
             if ($textnocolortab[1] == "Text") {
                 $pos = 8;
             } else {
                 $pos = 9;
             }
             $newstring = $textnocolortab[1] . "(" . substr($code, $pos);
             preg_match($textnocolor, $newstring, $textwt1);
             $global = $textnocolortab[1] . '(-1,(int((' . $textwt1[3] . ')' . $sign . $ratio_y_txt . '),int((' . $textwt1[4] . ')' . $sign . $ratio_y_txt . '),' . $textwt1[5];
         }
         //$global = $textnocolortab[1].'(int(('.$textnocolortab[count($textnocolortab)-3].')'.$sign.$ratio_y_txt.'),int(('.$textnocolortab[count($textnocolortab)-2].')'.$sign.$ratio_x_txt.'),'.$textnocolortab[count($textnocolortab)-1];
         return $global . "\n";
     } elseif (count($cerclenocolortab) > 0 and $typeOfWindows == "delta") {
         $global = $cerclenocolortab[1] . '((' . $cerclenocolortab[3] . ')' . $sign . $ratio_x_px . ',(' . $cerclenocolortab[4] . ')' . $sign . $ratio_y_px . ',(' . rtrim($cerclenocolortab[5]) . $sign . '2.8';
         return $global;
     } elseif (count($pxtesttab) > 0) {
         if (preg_match($pxtest, $code)) {
             //que du pixel test
             if (preg_match("#[\\)]#i", $pxtesttab[3])) {
                 $global = 'pxl-Test((' . $pxtesttab[2] . ')' . $sign . $ratio_y_txt . ',(' . rtrim($pxtesttab[3]) . $sign . $ratio_x_txt;
             } else {
                 $global = 'pxl-Test((' . $pxtesttab[2] . ')' . $sign . $ratio_y_txt . ',(' . rtrim($pxtesttab[3]) . ')' . $sign . $ratio_x_txt;
             }
             return $global . "\n";
             //
         } else {
             //start
             preg_match_all("#Pxl-Test\\([^,]+\\,[^,:\\)\\s→]+#i", $code, $matches);
             for ($i = 0; $i < count($matches[0]); $i++) {
                 $TestString = new Converter($matches[0][$i] . "\n");
                 if ($mode == "CTM") {
                     //Color to Mono
                     $code = str_replace($matches[0][$i], rtrim($TestString->ColorToMono()), $code);
                 } elseif ($mode == "MTC") {
                     //Mono to color
                     $code = str_replace($matches[0][$i], rtrim($TestString->MonoToColor()), $code);
                 }
             }
             return $code;
             //end
         }
     } else {
         return $code;
     }
 }
开发者ID:WilliamRomiguieres,项目名称:ticonverter,代码行数:101,代码来源:converter.class.php


注:本文中的Converter::ColorToMono方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。