Added Texture object and FrameBuffer object to rendering API
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / sampler-impl.h
1 #ifndef DALI_INTERNAL_SAMPLER_H
2 #define DALI_INTERNAL_SAMPLER_H
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/actors/sampling.h>
23 #include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
24 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
25 #include <dali/devel-api/rendering/sampler.h> // Dali::Sampler
26 #include <dali/internal/event/common/connectable.h> // Dali::Internal::Connectable
27 #include <dali/internal/event/common/object-connector.h> // Dali::Internal::ObjectConnector
28 #include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
29 #include <dali/internal/event/images/image-connector.h> // Dali::Internal::ImageConnector
30
31 namespace Dali
32 {
33 namespace Internal
34 {
35 namespace Render
36 {
37 struct Sampler;
38 }
39
40 class Sampler;
41 typedef IntrusivePtr<Sampler> SamplerPtr;
42
43 /**
44  * Sampler is an object that contains an array of structures of values that
45  * can be accessed as properties.
46  */
47 class Sampler : public BaseObject
48 {
49 public:
50
51   /**
52    * Create a new Sampler.
53    * @return A smart-pointer to the newly allocated Sampler.
54    */
55   static SamplerPtr New( );
56
57   /**
58    * @copydoc Dali::Sampler::SetFilterMode()
59    */
60   void SetFilterMode( Dali::FilterMode::Type minFilter, Dali::FilterMode::Type magFilter );
61
62   /**
63    * @copydoc Dali::Sampler::SetWrapMode()
64    */
65   void SetWrapMode( Dali::WrapMode::Type rWrap, Dali::WrapMode::Type sWrap, Dali::WrapMode::Type tWrap );
66
67   /**
68    * Get the render thread sampler
69    *
70    * @return The render thread sampler
71    */
72   Render::Sampler* GetSamplerRenderObject();
73
74 private:
75   Sampler();
76
77   /**
78    * Second stage initialization
79    */
80   void Initialize( );
81
82 protected:
83   /**
84    * A reference counted object may only be deleted by calling Unreference()
85    */
86   virtual ~Sampler();
87
88 private: // data
89   EventThreadServices& mEventThreadServices;    ///<Used to send messages to the render thread via the update thread
90   Render::Sampler* mRenderObject;               ///<Render thread sampler for this sampler
91
92 };
93
94 } // namespace Internal
95
96 // Helpers for public-api forwarding methods
97 inline Internal::Sampler& GetImplementation(Dali::Sampler& handle)
98 {
99   DALI_ASSERT_ALWAYS(handle && "Sampler handle is empty");
100
101   BaseObject& object = handle.GetBaseObject();
102
103   return static_cast<Internal::Sampler&>(object);
104 }
105
106 inline const Internal::Sampler& GetImplementation(const Dali::Sampler& handle)
107 {
108   DALI_ASSERT_ALWAYS(handle && "Sampler handle is empty");
109
110   const BaseObject& object = handle.GetBaseObject();
111
112   return static_cast<const Internal::Sampler&>(object);
113 }
114
115 } // namespace Dali
116
117 #endif // DALI_INTERNAL_SAMPLER_H