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


PHP ImageSetStyle函数代码示例

本文整理汇总了PHP中ImageSetStyle函数的典型用法代码示例。如果您正苦于以下问题:PHP ImageSetStyle函数的具体用法?PHP ImageSetStyle怎么用?PHP ImageSetStyle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: Graf

function Graf($arrayX, $arrayY, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $Color = 'FF0000', $dashed = "N", $thikness = 2, $antialiase = true)
{
    global $xA, $yA, $xPixelLength, $yPixelLength;
    if (sizeof($arrayX) != sizeof($arrayY)) {
        return;
    }
    $arr_Color = ReColor($Color);
    $color = ImageColorAllocate($ImageHandle, $arr_Color[0], $arr_Color[1], $arr_Color[2]);
    $xGrafLength = $MaxX - $MinX;
    $yGrafLength = $MaxY - $MinY;
    if ($antialiase) {
        $bgcolor = imagecolorallocate($ImageHandle, 255, 255, 255);
        $fgcolors = imagecolorsforindex($ImageHandle, $color);
        $bgcolors = imagecolorsforindex($ImageHandle, $bgcolor);
        for ($i = 0; $i < 100; $i++) {
            imagecolorallocate($ImageHandle, ($fgcolors['red'] + $i * $bgcolors['red']) / ($i + 1), ($fgcolors['green'] + $i * $bgcolors['green']) / ($i + 1), ($fgcolors['blue'] + $i * $bgcolors['blue']) / ($i + 1));
        }
    }
    $x1 = $y1 = $x2 = $y2 = 0;
    for ($i = 0, $n = sizeof($arrayX) - 1; $i < $n; $i++) {
        if ($xGrafLength > 0) {
            $x1 = $xA + ($arrayX[$i] - $MinX) * $xPixelLength / $xGrafLength;
            $x2 = $xA + ($arrayX[$i + 1] - $MinX) * $xPixelLength / $xGrafLength;
        }
        if ($yGrafLength > 0) {
            $y1 = $yA - ($arrayY[$i] - $MinY) * $yPixelLength / $yGrafLength;
            $y2 = $yA - ($arrayY[$i + 1] - $MinY) * $yPixelLength / $yGrafLength;
        }
        $x1 = ceil($x1);
        $y1 = ceil($y1);
        $x2 = ceil($x2);
        $y2 = ceil($y2);
        if ($antialiase) {
            /** @noinspection PhpUndefinedVariableInspection */
            _a_draw_line($ImageHandle, $x1, $y1, $x2, $y2, $fgcolors, $dashed, 10, 4);
            if ($thikness > 1) {
                if ($y1 < $y2) {
                    _a_draw_line($ImageHandle, $x1 - 0.4, $y1 + 0.4, $x2 - 0.4, $y2 + 0.4, $fgcolors, $dashed, 10, 4);
                    _a_draw_line($ImageHandle, $x1 + 0.4, $y1 - 0.4, $x2 + 0.4, $y2 - 0.4, $fgcolors, $dashed, 10, 4);
                } else {
                    _a_draw_line($ImageHandle, $x1 + 0.4, $y1 + 0.4, $x2 + 0.4, $y2 + 0.4, $fgcolors, $dashed, 10, 4);
                    _a_draw_line($ImageHandle, $x1 - 0.4, $y1 - 0.4, $x2 - 0.4, $y2 - 0.4, $fgcolors, $dashed, 10, 4);
                }
            }
        } elseif ($dashed == "Y") {
            $style = array($color, $color, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
            ImageSetStyle($ImageHandle, $style);
            ImageLine($ImageHandle, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED);
        } else {
            ImageLine($ImageHandle, $x1, $y1, $x2, $y2, $color);
        }
    }
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:53,代码来源:img.php

示例2: DrawDashedLine

 function DrawDashedLine($x1, $y1, $x2, $y2, $dash_length, $dash_space, $color)
 {
     if ($dash_length) {
         $dashes = array_fill(0, $dash_length, $color);
     } else {
         $dashes = array();
     }
     if ($dash_space) {
         $spaces = array_fill(0, $dash_space, IMG_COLOR_TRANSPARENT);
     } else {
         $spaces = array();
     }
     $style = array_merge($dashes, $spaces);
     ImageSetStyle($this->img, $style);
     ImageLine($this->img, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED);
 }
开发者ID:ViniciusFelix,项目名称:ProjetoPadrao,代码行数:16,代码来源:phplot.php

示例3: FormDecode

<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/tools.php";
include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/advertising/colors.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/img.php";
if (function_exists("FormDecode")) {
    FormDecode();
}
UnQuoteAll();
// создаем изображение
$ImageHendle = CreateImageHandle(45, 2);
$dec = ReColor($color);
$color = ImageColorAllocate($ImageHendle, $dec[0], $dec[1], $dec[2]);
if ($dash == "Y") {
    $style = array($color, $color, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
    //$white = ImageColorAllocate($ImageHendle,255,255,255);
    //$style = array ($color,$color,$white,$white,$white);
    ImageSetStyle($ImageHendle, $style);
    ImageLine($ImageHendle, 3, 0, 40, 0, IMG_COLOR_STYLED);
    ImageLine($ImageHendle, 1, 1, 40, 1, IMG_COLOR_STYLED);
} else {
    ImageLine($ImageHendle, 3, 0, 40, 0, $color);
    ImageLine($ImageHendle, 3, 1, 40, 1, $color);
}
/******************************************************
				ќтображаем изображение
*******************************************************/
ShowImageHeader($ImageHendle);
开发者ID:Satariall,项目名称:izurit,代码行数:28,代码来源:adv_legend.php

示例4: _getLineStyle

 /**
  * Get the GD applicable linestyle
  *
  * @param mixed $lineStyle The line style to return, false if the one
  *   explicitly set
  * @return mixed A GD compatible linestyle
  * @access private
  */
 function _getLineStyle($lineStyle = false)
 {
     if ($this->_gd2) {
         ImageSetThickness($this->_canvas, $this->_thickness);
     }
     if ($lineStyle == 'transparent') {
         return false;
     } elseif ($lineStyle === false) {
         if (is_array($this->_lineStyle)) {
             $colors = array();
             foreach ($this->_lineStyle as $color) {
                 if ($color === 'transparent') {
                     $color = false;
                 }
                 $colors[] = $this->_color($color);
             }
             ImageSetStyle($this->_canvas, $colors);
             return IMG_COLOR_STYLED;
         } else {
             return $this->_color($this->_lineStyle);
         }
     } else {
         return $this->_color($lineStyle);
     }
 }
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:33,代码来源:GD.php

示例5: MDashedLine

 private static function MDashedLine($image, $x0, $y0, $x1, $y1, $fg, $bg)
 {
     $st = array($fg, $fg, $fg, $fg, $bg, $bg, $bg, $bg);
     ImageSetStyle($image, $st);
     ImageLine($image, $x0, $y0, $x1, $y1, IMG_COLOR_STYLED);
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:6,代码来源:WordChart.php

示例6: _DashedLine

 function _DashedLine($x0, $y0, $x1, $y1, $fg, $bg)
 {
     $st = array($fg, $fg, $fg, $fg, $bg, $bg, $bg, $bg);
     ImageSetStyle($this->graph, $st);
     ImageLine($this->graph, $x0, $y0, $x1, $y1, IMG_COLOR_STYLED);
 }
开发者ID:rrsc,项目名称:freemed,代码行数:6,代码来源:GraphNormalize.class.php

示例7: createTimelineImage

 /**
  * Create Timeline Image
  *
  * @param $date
  * @param $draw     if FALSE return coordinates only, for imagemap
  * @param $translate for translate
  * @param $img_type [normal | small]
  * @return image
  */
 public function createTimelineImage($date, $draw = true, $translate = null, $img_type = 'normal')
 {
     $this->GetDataTimeline($date);
     if (empty($this->atime)) {
         // Nothing data to graph
         return;
     }
     $this->calculateImageData($img_type);
     if (!$draw) {
         $img_map = array();
     }
     $ttf_font_error = 0;
     // созд-е пустого холста
     // Create a new true color image :
     // resource imagecreatetruecolor ( int width, int height )
     $img = ImageCreateTrueColor($this->img_width, $this->img_height);
     if (!$img) {
         // Handle the error
         $this->view->result = null;
         $this->getResponse()->setHeader('Content-Type', 'text/html; charset=utf-8');
         throw new Zend_Exception('Internal ERROR: ImageCreateTrueColor');
         return;
     }
     // цвета
     $white = ImageColorAllocate($img, 255, 255, 255);
     $black = ImageColorAllocate($img, 0, 0, 0);
     $blue = ImageColorAllocate($img, 0x49, 0x74, 0xbc0);
     // массив цветов для полос
     $acolor = array(ImageColorAllocate($img, 0xea, 0xea, 0x33), ImageColorAllocate($img, 0xff, 0xba, 0xba), ImageColorAllocate($img, 0xd0, 0xae, 0xff), ImageColorAllocate($img, 0x9d, 0xed, 0x0), ImageColorAllocate($img, 0xdc, 0xdc, 0xdc));
     $acolor_count = count($acolor);
     // кол-во цветов для рисования полос
     $bg_color = $white;
     $text_color = $black;
     // создание фона для рисования
     // Draw a filled rectangle : bool imagefilledrectangle ( resource image, int x1, int y1, int x2, int y2, int color )
     if ($draw) {
         ImageFilledRectangle($img, 0, 0, $this->img_width, $this->img_height, $bg_color);
     }
     // контур фона
     // Draw a rectangle : bool imagerectangle ( resource image, int x1, int y1, int x2, int y2, int color )
     if ($draw) {
         ImageRectangle($img, 0, 0, $this->img_width - 1, $this->img_height - 1, $blue);
     }
     // --------------------------------- вычерчивание координатной сетки ---------------------------------------
     // ось X
     // Draw a line :
     // bool imageline ( resource image, int x1, int y1, int x2, int y2, int color )
     // $y0, $x0 - начало координат
     $y0 = $y2 = $this->img_height - $this->margin_bottom - $this->margin_top + $this->bar_space;
     $x0 = $this->margin_left;
     if ($draw) {
         ImageLine($img, $x0, $y0, $this->img_width - $this->margin_right, $y2, $blue);
     }
     // ось X
     // вертикальные линии - часы
     // пунктирная линия
     $style_dash = array_merge(array_fill(0, 1, $blue), array_fill(0, 3, IMG_COLOR_TRANSPARENT));
     if ($draw) {
         ImageSetStyle($img, $style_dash);
     }
     $hour1 = ceil(($this->img_width - $x0 - $this->margin_right) / 24);
     // шаг засечек или 1 час в пикселах
     $y2 = 0;
     for ($i = 0; $i <= 23; $i++) {
         $x1 = $x0 + $i * $hour1;
         ImageLine($img, $x1, $y0, $x1, $y2, IMG_COLOR_STYLED);
     }
     if ($img_type == 'normal') {
         // подписи к оси X
         $y1 = $this->img_height - $this->margin_bottom - $this->margin_top + $this->bar_space + $this->font_size;
         for ($i = 0; $i <= 23; $i++) {
             // Draw a string horizontally :
             // bool imagestring ( resource image, int font, int x, int y, string sring, int color )
             // Can be 1, 2, 3, 4, 5 for built-in fonts (where higher numbers corresponding to larger fonts)
             // для учета кол-ва символов в цифрах часов
             if ($i < 10) {
                 $div2 = 10;
             } else {
                 $div2 = 5;
             }
             $x1 = $x0 - $div2 + $i * $hour1;
             if ($draw) {
                 ImageString($img, 4, $x1, $y1, sprintf("% 2d", $i), $blue);
             }
         }
         // X axis title / название оси X
         if (empty($this->font_name)) {
             // use system fixed font / ось подписываем встроенным шрифтом
             if ($draw) {
                 ImageString($img, $this->fixfont, floor($this->img_width / 2), $this->img_height - floor(($this->img_height - $y0) / 2), "Hours", $blue);
             }
//.........这里部分代码省略.........
开发者ID:neverstoplwy,项目名称:contrib-webacula,代码行数:101,代码来源:Timeline.php

示例8: DashedLine

 function DashedLine($image, $x1, $y1, $x2, $y2, $color)
 {
     // Style for dashed lines
     //			$style = array($color, $color, $color, $color, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
     $style = array($color, $color, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
     ImageSetStyle($image, $style);
     ImageLine($image, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED);
 }
开发者ID:rennhak,项目名称:zabbix,代码行数:8,代码来源:config.inc.php

示例9: array

<?php

// make a two-pixel thick black and white dashed line
$style = array($black, $black, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
ImageSetStyle($image, $style);
开发者ID:zmwebdev,项目名称:PHPcookbook-code-3ed,代码行数:5,代码来源:transparent2.php

示例10: create_image2

function create_image2()
{
    $GBC = new GBsql();
    $GBC->GB_getSQLsetting();
    $GBSQL = "SELECT * from locations ";
    $result = $GBC->_GBUser->query($GBSQL);
    $locs = $result->fetchAll();
    @(list($level, $gold, $cash, $FarmSizeX, $FarmSizeY) = explode(';', fBGetDataStore('playerinfo')));
    if ($FarmSizeX == '' || $FarmSizeY == '') {
        $GB_place_items = "No";
        return;
    } else {
        $GB_place_items = "OK";
    }
    $maxX = $FarmSizeX * 4;
    $maxX = $maxX + 3;
    $maxY = $FarmSizeY * 4;
    $maxY = $maxY + 3;
    $im = @imagecreate($maxX, $maxY) or AddLog2("Cannot Initialize new GD image stream");
    $background_color = imagecolorallocate($im, 255, 255, 255);
    // yellow
    $red = imagecolorallocate($im, 255, 0, 0);
    // red
    $green = imagecolorallocate($im, 0, 255, 0);
    $blue = imagecolorallocate($im, 0, 0, 255);
    // blue
    $white = imagecolorallocate($im, 255, 255, 255);
    $yellow = imagecolorallocate($im, 255, 255, 0);
    $black = imagecolorallocate($im, 0, 0, 0);
    $purple = ImageColorAllocate($im, 153, 51, 255);
    //purple
    $pink = ImageColorAllocate($im, 255, 0, 128);
    //pink
    $grey = ImageColorAllocate($im, 192, 192, 192);
    //grey
    $brown = ImageColorAllocate($im, 51, 0, 0);
    $loc = "Animal";
    $style = array($white, $white, $white, $blue, $blue, $blue);
    ImageSetStyle($im, $style);
    $X1 = $GBC->GB_Setting[$loc . 'X1'] * 4;
    $Y1 = $maxY - $GBC->GB_Setting[$loc . 'Y1'] * 4;
    $X2 = $GBC->GB_Setting[$loc . 'X2'] * 4;
    $Y2 = $maxY - $GBC->GB_Setting[$loc . 'Y2'] * 4;
    imagefilledrectangle($im, $X1, $Y1, $X2, $Y2, IMG_COLOR_STYLED);
    $loc = "Tree";
    $style = array($white, $white, $white, $yellow, $yellow, $yellow);
    ImageSetStyle($im, $style);
    $X1 = $GBC->GB_Setting[$loc . 'X1'] * 4;
    $Y1 = $maxY - $GBC->GB_Setting[$loc . 'Y1'] * 4;
    $X2 = $GBC->GB_Setting[$loc . 'X2'] * 4;
    $Y2 = $maxY - $GBC->GB_Setting[$loc . 'Y2'] * 4;
    imagefilledrectangle($im, $X1, $Y1, $X2, $Y2, IMG_COLOR_STYLED);
    $loc = "Decoration";
    $style = array($white, $white, $white, $black, $black, $black);
    ImageSetStyle($im, $style);
    $X1 = $GBC->GB_Setting[$loc . 'X1'] * 4;
    $Y1 = $maxY - $GBC->GB_Setting[$loc . 'Y1'] * 4;
    $X2 = $GBC->GB_Setting[$loc . 'X2'] * 4;
    $Y2 = $maxY - $GBC->GB_Setting[$loc . 'Y2'] * 4;
    imagefilledrectangle($im, $X1, $Y1, $X2, $Y2, IMG_COLOR_STYLED);
    foreach ($locs as $loc) {
        $GB_fill = $red;
        if (strpos($loc['_what'], 'E') !== false) {
            $GB_fill = $green;
        }
        if (strpos($loc['_what'], 'Decoration') !== false) {
            $GB_fill = $black;
        }
        if (strpos($loc['_what'], 'Animal') !== false) {
            $GB_fill = $purple;
        }
        if (strpos($loc['_what'], 'Building') !== false) {
            $GB_fill = $pink;
        }
        if (strpos($loc['_what'], 'Plot') !== false) {
            $GB_fill = $brown;
        }
        $Map_PXI = $loc['_X'] * 4;
        $Map_PYI = $loc['_Y'] * 4;
        $Map_PYI = $maxY - $Map_PYI;
        imagefilledrectangle($im, $Map_PXI, $Map_PYI, $Map_PXI + 1, $Map_PYI + 1, $GB_fill);
    }
    $GB_map_image = $_SESSION['userId'] . "_FarmMap3.png";
    imagepng($im, $GB_map_image);
    imagedestroy($im);
}
开发者ID:RadicalLinux,项目名称:faceBot,代码行数:86,代码来源:index.php

示例11: MyDrawLine

function MyDrawLine($image, $x1, $y1, $x2, $y2, $color, $drawtype)
{
    if ($drawtype == MAP_LINK_DRAWTYPE_BOLD_LINE) {
        ImageLine($image, $x1, $y1, $x2, $y2, $color);
        if ($x1 - $x2 < $y1 - $y2) {
            $x1++;
            $x2++;
        } else {
            $y1++;
            $y2++;
        }
        ImageLine($image, $x1, $y1, $x2, $y2, $color);
    } else {
        if ($drawtype == MAP_LINK_DRAWTYPE_DASHED_LINE) {
            if (function_exists("imagesetstyle")) {
                /* Use ImageSetStyle+ImageLIne instead of bugged ImageDashedLine */
                $style = array($color, $color, $color, $color, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
                ImageSetStyle($image, $style);
                ImageLine($image, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED);
            } else {
                ImageDashedLine($image, $x1, $y1, $x2, $y2, $color);
            }
        } else {
            if ($drawtype == MAP_LINK_DRAWTYPE_DOT && function_exists("imagesetstyle")) {
                $style = array($color, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
                ImageSetStyle($image, $style);
                ImageLine($image, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED);
            } else {
                ImageLine($image, $x1, $y1, $x2, $y2, $color);
            }
        }
    }
}
开发者ID:rennhak,项目名称:zabbix,代码行数:33,代码来源:maps.inc.php

示例12: _APCMS_DashedLine

/** 
 * Zeichnen einer gestrichelten Linie 
 * 
 * @param          object $image 
 * @param          int $x0 
 * @param          int $y0 
 * @param          int $x1 
 * @param          int $y1 
 * @param          object $fg 
 * @param          object $bg 
 * @since          0.0.1 
 * @version        0.0.1 
 * @access         private 
 * @return         void 
 * @author         Alexander Mieland 
 * @copyright      2000-2004 by APP - Another PHP Program 
 */
function _APCMS_DashedLine($image, $x0, $y0, $x1, $y1, $fg, $bg)
{
    $st = array($fg, $fg, $fg, $fg, $bg, $bg, $bg, $bg);
    ImageSetStyle($image, $st);
    ImageLine($image, $x0, $y0, $x1, $y1, IMG_COLOR_STYLED);
}
开发者ID:BackupTheBerlios,项目名称:apcms,代码行数:23,代码来源:apcms_general.func.php

示例13: drawYAxe

 /**
  * draw y axe with lines and numbers
  *
  * @param null
  * @returns nothing
  */
 function drawYAxe()
 {
     // draw lines
     $top = $this->posYStart;
     $step = round(($this->posYEnd - $this->posYStart) / $this->yTicks, 2);
     for ($i = 0; $i <= $this->yTicks; $i++) {
         $style = array($this->colorStyle, $this->colorStyle, $this->colorStyle, $this->colorStyle, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
         ImageSetStyle($this->img, $style);
         ImageLine($this->img, $this->posXStart - 5, $top, $this->fullYaxe ? $this->posXEnd : $this->posXStart + 5, $top, $this->colorLines);
         $top += $step;
     }
     // draw numbers
     $xAxeValue = $this->maxData;
     $top = $this->posYStart;
     for ($i = 0; $i <= $this->yTicks; $i++) {
         ImageString($this->img, 2, $this->posXStart - 12 - strlen($xAxeValue) * 4, $top - 6, $xAxeValue, $this->colorText);
         $xAxeValue -= $this->maxData / $this->yTicks;
         if ($xAxeValue < 0.01) {
             $xAxeValue = 0;
         }
         $top += $step;
     }
 }
开发者ID:BackupTheBerlios,项目名称:phpyouradmin,代码行数:29,代码来源:postgraph.class.php


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