<?php

namespace IZON\Thumber\ImageConverter;

use IZON\IO\Image;
use IZON\Thumber\Image\IImagePoint;
use IZON\Thumber\Image\IImageSize;

/**
 * Converts image into specified format.
 *
 * @author Aleš Kopecký <kopecky@izon.cz>
 */
interface IImageConverter {
    
    const EXTENSION_WEBP = 'webp';
    const EXTENSION_JPG = 'jpg';
    const EXTENSION_PNG = 'png';
    
    const EXTENSIONS_AVAILABLE = [
        self::EXTENSION_WEBP,
        self::EXTENSION_JPG,
        self::EXTENSION_PNG
    ];

    /**
     * Sets ImageSize object.
     * @param IImageSize $imageSize Image size object containing image size info.
     * @return IImageConverter
     */
    public function setSize(IImageSize $imageSize) : IImageConverter;
    
    /**
     * Sets quality.
     * @param int $quality
     * @return IImageConverter
     */
    public function setQuality(int $quality) : IImageConverter;
    
    /**
     * Sets format.
     * @param string $format Use constants of IImageConverter interface.
     * @return IImageConverter
     */
    public function setFormat(string $format) : IImageConverter;
   
    /**
     * set image to interlace 
     * @param bool $interlace
     * @return \IZON\Thumber\ImageConverter\IImageConverter
     */
    public function setInterlace(bool $interlace) : IImageConverter;
    
    /**
     * 
     * @param string $filename
     * @return Image
     */
    public function convert(string $filename) : Image;
    /**
     * 
     * @param IImageSize $size
     * @param IImagePoint $point
     * @return IImageConverter
     */
    public function crop(IImageSize $size, IImagePoint $point) : IImageConverter;
        
    
}
