//
//  TextureProtocol.h
//  Meteor
//
//  Created by Cesar Parent on 14/07/2015.
//  Copyright (c) 2015 Cesar Parent. All rights reserved.
//

#ifndef Meteor_TextureProtocol_h
#define Meteor_TextureProtocol_h

#include "../CPFoundation.h"
#include "../Geometry.h"
#include "Color.h"

NS_BEGIN

/*!
 * @interface       TextureProtocol
 * @ingroup         Graphics
 * @brief           A protocol that defines the API used to work with hardware-backed textures.
 */
class TextureProtocol : public virtual CPObjectProtocol {
    
public:
    
    /**
     * @enum        BlendMode
     * @ingroup     Graphics
     * @brief       The modes that describe how the source and destination pixel colors are used to
     *              calculate the new destination color.
     */
    enum class BlendMode {
        ///   The source and destination colors are blended by multiplying  the source alpha value.
        Replace,
        /// The source color replaces the destination color.
        Alpha,
        /// The source and destination colors are added together.
        Add,
        /// The source color is multiplied by the destination color.
        Multiply,
    };
    
    // MARK: Getters
    
    /*!
     * @name        Inspecting the Texture's properties
     * @{
     */
    
    /*!
     * @brief       Returns the texture's opacity.
     * @return      The texture's opacity.
     */
    virtual float
    alpha() const = 0;
    
    /*!
     * @brief       Returns the texture's color blending mode.
     * @return      The texture's blending mode.
     */
    virtual BlendMode
    blendMode() const = 0;
    
    /*!
     * @brief       Returns the texture's color.
     * @return      The texture's color.
     */
    virtual Color
    color() const = 0;
    
    /*!
     * @brief       Returns the texture's area to render on the screen.
     * @return      The texture's area to render.
     */
    virtual Rect
    clippingQuad() const = 0;
    
    /*!
     * @brief       Returns the texture's dimensions in pixels.
     * @return      The texture's dimensions in pixels.
     */
    virtual size2
    size() const = 0;
    
    /*!
     * @}
     * @name        Changing the Texture's properties
     * @{
     */
    
    // MARK: Setters
    
    /*!
     * @brief       Set the texture's opacity.
     * @param       alpha       The texture's opacity.
     */
    virtual void
    setAlpha(float alpha) = 0;
    
    /*!
     * @brief       Set the texture's blending mode.
     * @param       blendMode   The texture's blending mode.
     */
    virtual void
    setBlendMode(BlendMode blendMode) = 0;
    
    /*!
     * @brief       Set the texture's color.
     * @param       color       The texture's color.
     */
    virtual void
    setColor(const Color& color) = 0;
    
    /*!
     * @brief       Set the texture's area to render.
     * @param       quad        Nhe texture's area to be render.
     */
    virtual void
    setClippingQuad(const Rect& quad) = 0;
    
    /*!
     * @}
     */
    
};

NS_END

#endif
