[3.0] Mark Clipping API as being part of the Tizen 3 version
[platform/core/uifw/dali-core.git] / dali / internal / event / images / frame-buffer-image-impl.h
1 #ifndef __DALI_INTERNAL_FRAME_BUFFER_IMAGE_H__
2 #define __DALI_INTERNAL_FRAME_BUFFER_IMAGE_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/internal/event/images/image-impl.h>
23 #include <dali/public-api/images/frame-buffer-image.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 class FrameBufferImage;
32 typedef IntrusivePtr<FrameBufferImage> FrameBufferImagePtr;
33
34 /**
35  * @copydoc Dali::FrameBufferImage
36  */
37 class FrameBufferImage : public Image
38 {
39 public:
40
41   /**
42    * @copydoc Dali::FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format)
43    */
44   static FrameBufferImagePtr New( unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferformat );
45
46   /**
47    * @copydoc Dali::FrameBufferImage::New(NativeImageInterface&)
48    */
49   static FrameBufferImagePtr New( NativeImageInterface& nativeImage );
50
51   /**
52    * @copydoc Dali::FrameBufferImage::FrameBufferImage
53    */
54   FrameBufferImage( unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferformat );
55
56   /**
57    * @copydoc Dali::FrameBufferImage::FrameBufferImage
58    */
59   FrameBufferImage( NativeImageInterface& image );
60
61   /**
62    * @return true if this FBO is targeting a NativeImageInterface
63    */
64   bool IsNativeFbo() const;
65
66   /**
67    * @brief Required for backwards compatibility. Value is just stored but not used internally.
68    * @param[in] releasePolicy The release policy (ignored as not supported).
69    */
70   void SetReleasePolicy( Dali::Image::ReleasePolicy releasePolicy );
71
72 public: // From Image
73   /**
74    * @copydoc Dali::Internal::Image::Connect()
75    */
76   virtual void Connect();
77
78   /**
79    * @copydoc Dali::Internal::Image::Disconnect()
80    */
81   virtual void Disconnect();
82
83 protected:
84   /**
85    * A reference counted object may only be deleted by calling Unreference()
86    */
87   virtual ~FrameBufferImage();
88
89 private:
90   // cached values for the size / pixel format we were created with. Needed to recreate us when we Connect() to stage and mTicket was reset from a previous call to Disconnect().
91   NativeImageInterfacePtr mNativeImage;
92   Pixel::Format mPixelFormat;
93   RenderBuffer::Format mBufferFormat;
94   bool mIsNativeFbo;
95 }; // class FrameBufferImage
96
97 } // namespace Internal
98
99 /**
100  * Helper methods for public API.
101  */
102 inline Internal::FrameBufferImage& GetImplementation(Dali::FrameBufferImage& image)
103 {
104   DALI_ASSERT_ALWAYS( image && "FrameBufferImage handle is empty" );
105
106   BaseObject& handle = image.GetBaseObject();
107
108   return static_cast<Internal::FrameBufferImage&>(handle);
109 }
110
111 inline const Internal::FrameBufferImage& GetImplementation(const Dali::FrameBufferImage& image)
112 {
113   DALI_ASSERT_ALWAYS( image && "FrameBufferImage handle is empty" );
114
115   const BaseObject& handle = image.GetBaseObject();
116
117   return static_cast<const Internal::FrameBufferImage&>(handle);
118 }
119
120 } // namespace Dali
121
122 #endif // __DALI_INTERNAL_FRAME_BUFFER_IMAGE_H__