blend_mode.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Harry Storbacka
00027 */
00028 
00031 
00032 #pragma once
00033 
00034 #include "../api_display.h"
00035 #include "../../Core/System/sharedptr.h"
00036 
00037 class CL_Colorf;
00038 class CL_BlendMode_Impl;
00039 
00043 enum CL_BlendFunc
00044 {
00046         cl_blend_zero,
00047 
00049         cl_blend_one,
00050 
00052         cl_blend_dest_color,
00053 
00055         cl_blend_src_color,
00056 
00058         cl_blend_one_minus_dest_color,
00059 
00061         cl_blend_one_minus_src_color,
00062 
00064         cl_blend_src_alpha,
00065 
00067         cl_blend_one_minus_src_alpha,
00068 
00070         cl_blend_dest_alpha,
00071 
00073         cl_blend_one_minus_dest_alpha,
00074 
00076         cl_blend_src_alpha_saturate,
00077 
00079         cl_blend_constant_color,
00080 
00082         cl_blend_one_minus_constant_color,
00083 
00085         cl_blend_constant_alpha,
00086 
00088         cl_blend_one_minus_constant_alpha
00089 };
00090 
00094 enum CL_BlendEquation
00095 {
00096         cl_blend_equation_add,
00097         cl_blend_equation_subtract,
00098         cl_blend_equation_reverse_subtract,
00099         cl_blend_equation_min,
00100         cl_blend_equation_max
00101 };
00102 
00106 class CL_API_DISPLAY CL_BlendMode
00107 {
00110 
00111 public:
00112         CL_BlendMode();
00113 
00114         ~CL_BlendMode();
00115 
00119 
00120 public:
00122         const CL_Colorf &get_blend_color() const;
00123 
00125         CL_BlendEquation get_blend_equation() const;
00126 
00128         CL_BlendEquation get_blend_equation_alpha() const;
00129 
00131         CL_BlendFunc get_blend_function_src() const;
00132 
00134         CL_BlendFunc get_blend_function_dest() const;
00135 
00137         CL_BlendFunc get_blend_function_src_alpha() const;
00138 
00140         CL_BlendFunc get_blend_function_dest_alpha() const;
00141 
00143         bool is_blend_enabled() const;
00144 
00148 
00149 public:
00151         bool operator ==(const CL_BlendMode &other) const;
00152 
00154         void enable_blending(bool value);
00155 
00157         void set_blend_color(const CL_Colorf &color);
00158 
00160         void set_blend_equation(CL_BlendEquation color, CL_BlendEquation alpha);
00161 
00163         void set_blend_function(CL_BlendFunc src, CL_BlendFunc dest, CL_BlendFunc src_alpha, CL_BlendFunc dest_alpha);
00164 
00168 
00169 private:
00170         CL_SharedPtr<CL_BlendMode_Impl> impl;
00172 };
00173