添加水印
@param  string  $source 水印图片路径
@param  integer $locate 水印位置
@param  integer $alpha  水印透明度
346484
public function water($source, $locate = self::IMAGE_WATER_SOUTHEAST,$alpha=80){
        //资源检测
        if(empty($this->img)) $this->throwError('没有可以被添加水印的图像资源');
        if(!is_file($source)){
            $source=\yii::getAlias('@web').$source;
            if(!is_file($source)){
                $this->throwError('水印图像不存在');
            }
        }

        //获取水印图像信息
        $info = getimagesize($source);
        if(false === $info || (IMAGETYPE_GIF === $info[2] && empty($info['bits']))){
            $this->throwError('非法水印文件');
        }

        //创建水印图像资源
        $fun   = 'imagecreatefrom' . image_type_to_extension($info[2], false);
        $water = $fun($source);

        //设定水印图像的混色模式
        imagealphablending($water, true);

        /* 设定水印位置 */
        switch ($locate) {
            /* 右下角水印 */
            case self::IMAGE_WATER_SOUTHEAST:
                $x = $this->info['width'] - $info[0];
                $y = $this->info['height'] - $info[1];
                break;

            /* 左下角水印 */
            case self::IMAGE_WATER_SOUTHWEST:
                $x = 0;
                $y = $this->info['height'] - $info[1];
                break;

            /* 左上角水印 */
            case self::IMAGE_WATER_NORTHWEST:
                $x = $y = 0;
                break;

            /* 右上角水印 */
            case self::IMAGE_WATER_NORTHEAST:
                $x = $this->info['width'] - $info[0];
                $y = 0;
                break;

            /* 居中水印 */
            case self::IMAGE_WATER_CENTER:
                $x = ($this->info['width'] - $info[0])/2;
                $y = ($this->info['height'] - $info[1])/2;
                break;

            /* 下居中水印 */
            case self::IMAGE_WATER_SOUTH:
                $x = ($this->info['width'] - $info[0])/2;
                $y = $this->info['height'] - $info[1];
                break;

            /* 右居中水印 */
            case self::IMAGE_WATER_EAST:
                $x = $this->info['width'] - $info[0];
                $y = ($this->info['height'] - $info[1])/2;
                break;

            /* 上居中水印 */
            case self::IMAGE_WATER_NORTH:
                $x = ($this->info['width'] - $info[0])/2;
                $y = 0;
                break;

            /* 左居中水印 */
            case self::IMAGE_WATER_WEST:
                $x = 0;
                $y = ($this->info['height'] - $info[1])/2;
                break;

            default:
                /* 自定义水印坐标 */
                if(is_array($locate)){
                    list($x, $y) = $locate;
                } else {
                    $this->throwError('不支持的水印位置类型');
                }
        }

        do{
            //添加水印
            $src = imagecreatetruecolor($info[0], $info[1]);
            // 调整默认颜色
            $color = imagecolorallocate($src, 255, 255, 255);
            imagefill($src, 0, 0, $color);

            imagecopy($src, $this->img, 0, 0, $x, $y, $info[0], $info[1]);
            imagecopy($src, $water, 0, 0, 0, 0, $info[0], $info[1]);
            imagecopymerge($this->img, $src, $x, $y, 0, 0, $info[0], $info[1], $alpha);

            //销毁零时图片资源
            imagedestroy($src);
        } while(!empty($this->gif) && $this->gifNext());

        //销毁水印资源
        imagedestroy($water);
    }
687921
public function appendStream($source, $offset = 0)
    {
        $chunkFile = $this->chunkFile();
        $this->files->appendStream($chunkFile, $source, (int) $offset);

        return $this;
    }
1220028
public function move($target, $source)
    {
        $this->copy($target, $source);

        $this->delete($target);
    }
920293
public function move($source, $target)
    {
        // Save file
        $this->filesystem->put(
            $target, file_get_contents($source), $this->media->visibility
        );
    }
959196
public function addLocation($contents = array(), $old_contents = null)
    {
        if ($old_contents && @$this->app->compat_42) {
            return $this->base_location->addRelativeLocation($contents, $old_contents);
        }

        /** @type PathFinder_Location $loc */
        $loc = $this->add('PathFinder_Location');

        return $loc->defineContents($contents);
    }
157915
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
    {
        $source->filepath = $this->buildFilepath($source, $_template);

        if ($source->filepath !== false) {
            if (is_object($source->smarty->security_policy)) {
                $source->smarty->security_policy->isTrustedResourceDir($source->filepath);
            }

            $source->uid = sha1($source->filepath);
            if ($source->smarty->compile_check) {
                $source->timestamp = @filemtime($source->filepath);
                $source->exists = !!$source->timestamp;
            }
        }
    }
668139
public function prepareSource(&$source = null, $reference = false)
    {
        if (is_null($source)) {
            $raw = static::loadRawFromRequest();

            $this->data = json_decode($raw, true);

            if (!is_array($this->data)) {
                $this->data = [];
            }
        } else {
            if ($reference) {
                $this->data = &$source;
            } else {
                $this->data = $source;
            }
        }
    }
962146
public function loadSource($source)
    {
        $parser = new Parser();

        list($this->headers, $this->content) = $parser->parsePart($source);
    }
292875
public function addHTML($place, $content){
		if(!isset($this->content[$place]))
			$this->content[$place] = array();
		$this->content[$place][] = array('type'=>'html', 'html'=>$content);
	}
241296
public function setSource($source): void
    {
        if (!\is_array($source) && !($source instanceof \ArrayAccess)) {
            throw new Grid\GridException('Source of `ArraySource` should be array or implement ArrayAccess interface');
        }
        parent::setSource($source);
    }
166727
public static void changeAlpha(InputStream srcInput, OutputStream destOutput, byte alpha,
                                   AlphaFilter filter) throws IOException {
        //加载图片
        log.debug("开始加载图片");
        BufferedImage old = ImageIO.read(srcInput);
        log.debug("图片加载完毕，开始改变图片的alpha值");

        //使用32位深带alpha通道模式
        BufferedImage bufferedImage = new BufferedImage(old.getWidth(), old.getHeight(),
            BufferedImage.TYPE_4BYTE_ABGR);

        if (filter == null) {
            filter = (x, y, rgb) -> true;
        }

        // 循环每一个像素点，改变像素点的Alpha值
        for (int x = 0; x < bufferedImage.getWidth(); x++) {
            for (int y = 0; y < bufferedImage.getHeight(); y++) {
                int rgb = old.getRGB(x, y);
                if (filter.filter(x, y, rgb)) {
                    //设置alpha值
                    rgb = (alpha << 24) | (rgb & 0x00ffffff);
                }
                bufferedImage.setRGB(x, y, rgb);
            }
        }
        log.debug("图片aphasia值更改完毕");
        // 生成图片为PNG
        ImageIO.write(bufferedImage, "png", destOutput);
    }
553532
public function setSource($source)
    {
        if (is_string($source)) {
            $this->source = new PhingFile($source);
        } else {
            $this->source = $source;
        }
    }
1230120
public function addSource($filename, $source, $fileData)
    {
        $this->_sources[substr($filename, strlen($this->_phpdoctor->sourcePath()) + 1)] = array(
            $source, $fileData
        );
    }
1358772
public static function assetsInCache($source, $filename)
    {
        $dest = OL_ZEUS_DISTPATH.$filename;

        // Create file
        if (!file_exists($dest)) {
            $ctns = file_exists($source) ? file_get_contents($source) : '';
            Helpers::filePutContents($dest, $ctns, 'This file has been auto-generated');
        }
    }
102685
public function populateTimestamp(Smarty_Template_Source $source)
    {
        $source->exists = true;
        foreach ($source->components as $s) {
            $source->exists = $source->exists && $s->exists;
        }
        $source->timestamp = $s->timestamp;
    }
1057230
public function AddSource($header_name, &$content, $subdir="src")
    {
        if($subdir)
        {
            $subdir = trim($subdir, "\\/") . "/";
            
            if(!file_exists($this->output_path . $subdir))
                \Peg\Lib\Utilities\FileSystem::MakeDir(
                    $this->output_path . $subdir, 
                    0755, 
                    true
                );
        }
        
        $header = $this->output_path 
            . $subdir
            . $this->GetSourceNamePHP($header_name)
        ;
        
        \Peg\Lib\Utilities\FileSystem::WriteFileIfDifferent($header, $content);
    }
359611
public function update(
            Common\ISource $source,
            $isGroupJoin,
            IFilter $filter = null,
            $hasDefault = false
    ) {
        if ($this->source === $source
                && $this->isGroupJoin === $isGroupJoin
                && $this->filter === $filter
                && $this->hasDefault === $hasDefault
        ) {
            return $this;
        }

        return new self($source, $isGroupJoin, $filter, $hasDefault, $this->defaultValueId, $this->defaultKeyId);
    }