Вход Регистрация
Файл: concrete5.7.5.6/concrete/vendor/imagine/imagine/lib/Imagine/Gd/Layers.php
Строк: 97
<?php

/*
 * This file is part of the Imagine package.
 *
 * (c) Bulat Shakirzyanov <mallluhuct@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace ImagineGd;

use 
ImagineImageAbstractLayers;
use 
ImagineExceptionRuntimeException;
use 
ImagineImageMetadataMetadataBag;
use 
ImagineImagePalettePaletteInterface;
use 
ImagineExceptionNotSupportedException;

class 
Layers extends AbstractLayers
{
    private 
$image;
    private 
$offset;
    private 
$resource;
    private 
$palette;

    public function 
__construct(Image $imagePaletteInterface $palette$resource)
    {
        if (!
is_resource($resource)) {
            throw new 
RuntimeException('Invalid Gd resource provided');
        }

        
$this->image $image;
        
$this->resource $resource;
        
$this->offset 0;
        
$this->palette $palette;
    }

    
/**
     * {@inheritdoc}
     */
    
public function merge()
    {
    }

    
/**
     * {@inheritdoc}
     */
    
public function coalesce()
    {
    }

    
/**
     * {@inheritdoc}
     */
    
public function animate($format$delay$loops)
    {
        return 
$this;
    }

    
/**
     * {@inheritdoc}
     */
    
public function current()
    {
        return new 
Image($this->resource$this->palette, new MetadataBag());
    }

    
/**
     * {@inheritdoc}
     */
    
public function key()
    {
        return 
$this->offset;
    }

    
/**
     * {@inheritdoc}
     */
    
public function next()
    {
        ++
$this->offset;
    }

    
/**
     * {@inheritdoc}
     */
    
public function rewind()
    {
        
$this->offset 0;
    }

    
/**
     * {@inheritdoc}
     */
    
public function valid()
    {
        return 
$this->offset 1;
    }

    
/**
     * {@inheritdoc}
     */
    
public function count()
    {
        return 
1;
    }

    
/**
     * {@inheritdoc}
     */
    
public function offsetExists($offset)
    {
        return 
=== $offset;
    }

    
/**
     * {@inheritdoc}
     */
    
public function offsetGet($offset)
    {
        if (
=== $offset) {
            return new 
Image($this->resource$this->palette, new MetadataBag());
        }

        throw new 
RuntimeException('GD only supports one layer at offset 0');
    }

    
/**
     * {@inheritdoc}
     */
    
public function offsetSet($offset$value)
    {
        throw new 
NotSupportedException('GD does not support layer set');
    }

    
/**
     * {@inheritdoc}
     */
    
public function offsetUnset($offset)
    {
        throw new 
NotSupportedException('GD does not support layer unset');
    }
}
Онлайн: 1
Реклама