////////////////////////////////////////////////////////////////////////////////////////////////////
// NoesisGUI - http://www.noesisengine.com
// Copyright (c) 2013 Noesis Technologies S.L. All Rights Reserved.
////////////////////////////////////////////////////////////////////////////////////////////////////


#ifndef __APP_NINESLICEMASKBRUSHSHADER_H__
#define __APP_NINESLICEMASKBRUSHSHADER_H__


#include <NsApp/ShadersApi.h>
#include <NsGui/BrushShader.h>
#include <NsDrawing/Color.h>


namespace Noesis { class DependencyProperty; }

namespace NoesisApp
{

NS_WARNING_PUSH
NS_MSVC_WARNING_DISABLE(4251)

////////////////////////////////////////////////////////////////////////////////////////////////////
/// BrushShader that turns an image into a monochrome color
///
/// .. code-block:: xml
///
///  <StackPanel
///    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
///    xmlns:noesis="clr-namespace:NoesisGUIExtensions"
///    Orientation="Horizontal">
///    <Image Source="Images/tulip.png"/>
///    <Rectangle Width="300" Height="300">
///      <Rectangle.Fill>
///        <ImageBrush ImageSource="Images/tulip.png">
///          <noesis:Brush.Shader>
///            <noesis:MonochromeBrushShader />
///          </noesis:Brush.Shader>
///        </ImageBrush>
///      </Rectangle.Fill>
///    </Rectangle>
///  </StackPanel>
///
/// .. image:: Monochrome.jpg
///
////////////////////////////////////////////////////////////////////////////////////////////////////
class NS_APP_SHADERS_API NineSliceMaskBrushShader final: public Noesis::BrushShader
{
public:
    NineSliceMaskBrushShader();

public:
    static const Noesis::DependencyProperty* SlicesProperty;
    static const Noesis::DependencyProperty* WidthProperty;
    static const Noesis::DependencyProperty* HeightProperty;
    static void* Shader;

private:
    struct Constants
    { 
        float left, top, right, bottom;
        float width, height;
    };

    Constants mConstants;

    NS_DECLARE_REFLECTION(NineSliceMaskBrushShader, BrushShader)
};

NS_WARNING_POP

}

#endif
