2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/devel-api/rendering/renderer.h> // Dali::Renderer
22 #include <dali/internal/event/rendering/renderer-impl.h> // Dali::Internal::Renderer
27 Renderer Renderer::New( Geometry& geometry, Shader& shader )
29 Internal::RendererPtr renderer = Internal::Renderer::New( );
30 renderer->SetGeometry( GetImplementation(geometry) );
31 renderer->SetShader( GetImplementation(shader) );
32 return Renderer( renderer.Get() );
43 Renderer::Renderer( const Renderer& handle )
48 Renderer Renderer::DownCast( BaseHandle handle )
50 return Renderer( dynamic_cast<Dali::Internal::Renderer*>(handle.GetObjectPtr()));
53 Renderer& Renderer::operator=( const Renderer& handle )
55 BaseHandle::operator=( handle );
59 void Renderer::SetGeometry( Geometry& geometry )
61 DALI_ASSERT_ALWAYS( geometry && "Geometry handle not initialized" );
62 GetImplementation(*this).SetGeometry( GetImplementation(geometry) );
65 Geometry Renderer::GetGeometry() const
67 Internal::Geometry* geometryPtr( GetImplementation(*this).GetGeometry() );
68 return Dali::Geometry( geometryPtr );
71 void Renderer::SetTextures( TextureSet& textureSet )
73 DALI_ASSERT_ALWAYS( textureSet && "TextureSet handle not initialized" );
74 GetImplementation(*this).SetTextures( GetImplementation(textureSet) );
77 TextureSet Renderer::GetTextures() const
79 Internal::TextureSet* textureSet( GetImplementation(*this).GetTextures() );
80 return Dali::TextureSet( textureSet );
83 void Renderer::SetShader( Shader& shader )
85 DALI_ASSERT_ALWAYS( shader && "Shader handle not initialized" );
86 GetImplementation(*this).SetShader( GetImplementation(shader) );
89 Shader Renderer::GetShader() const
91 Internal::Shader* shaderPtr( GetImplementation(*this).GetShader() );
92 return Dali::Shader( shaderPtr );
95 void Renderer::SetBlendFunc( BlendingFactor::Type srcFactorRgba,
96 BlendingFactor::Type destFactorRgba )
98 GetImplementation(*this).SetBlendFunc( srcFactorRgba, destFactorRgba );
101 void Renderer::SetBlendFunc( BlendingFactor::Type srcFactorRgb,
102 BlendingFactor::Type destFactorRgb,
103 BlendingFactor::Type srcFactorAlpha,
104 BlendingFactor::Type destFactorAlpha )
106 GetImplementation(*this).SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
109 void Renderer::GetBlendFunc( BlendingFactor::Type& srcFactorRgb,
110 BlendingFactor::Type& destFactorRgb,
111 BlendingFactor::Type& srcFactorAlpha,
112 BlendingFactor::Type& destFactorAlpha ) const
114 GetImplementation(*this).GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
117 void Renderer::SetBlendEquation( BlendingEquation::Type equationRgba )
119 GetImplementation(*this).SetBlendEquation( equationRgba );
122 void Renderer::SetBlendEquation( BlendingEquation::Type equationRgb,
123 BlendingEquation::Type equationAlpha )
125 GetImplementation(*this).SetBlendEquation( equationRgb, equationAlpha );
128 void Renderer::GetBlendEquation( BlendingEquation::Type& equationRgb,
129 BlendingEquation::Type& equationAlpha ) const
131 GetImplementation(*this).GetBlendEquation( equationRgb, equationAlpha );
134 Renderer::Renderer( Internal::Renderer* pointer )