Merge "DALi Version 1.0.30" into tizen
[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) 2014 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    * @copydoc Dali::FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format)
42    */
43   static FrameBufferImagePtr  New(unsigned int width, unsigned int height, Pixel::Format pixelFormat, ReleasePolicy releasePolicy);
44
45   /**
46    * @copydoc Dali::FrameBufferImage::New(NativeImage&)
47    */
48   static FrameBufferImagePtr  New( NativeImage& nativeImage );
49
50   /**
51    * @copydoc Dali::FrameBufferImage::New(NativeImage&, ReleasePolicy)
52    */
53   static FrameBufferImagePtr  New( NativeImage& nativeImage, ReleasePolicy releasePolicy );
54
55   /**
56    * @copydoc Dali::FrameBufferImage::FrameBufferImage
57    */
58   FrameBufferImage(unsigned int width, unsigned int height, Pixel::Format pixelFormat);
59
60   /**
61    * @copydoc Dali::FrameBufferImage::FrameBufferImage
62    */
63   FrameBufferImage(unsigned int width, unsigned int height, Pixel::Format pixelFormat, ReleasePolicy releasePolicy);
64
65   /**
66    * @copydoc Dali::FrameBufferImage::FrameBufferImage
67    */
68   FrameBufferImage(NativeImage& image);
69
70   /**
71    * @copydoc Dali::FrameBufferImage::FrameBufferImage
72    */
73   FrameBufferImage(NativeImage& image, ReleasePolicy releasePolicy);
74
75 public: // From Image
76   /**
77    * @copydoc Dali::Internal::Image::Connect()
78    */
79   virtual void Connect();
80
81   /**
82    * @copydoc Dali::Internal::Image::Disconnect()
83    */
84   virtual void Disconnect();
85
86 protected:
87   /**
88    * A reference counted object may only be deleted by calling Unreference()
89    */
90   virtual ~FrameBufferImage();
91
92 private:
93   // 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().
94   NativeImagePtr mNativeImage;
95   Pixel::Format mPixelFormat;
96 }; // class FrameBufferImage
97
98 } // namespace Internal
99
100 /**
101  * Helper methods for public API.
102  */
103 inline Internal::FrameBufferImage& GetImplementation(Dali::FrameBufferImage& image)
104 {
105   DALI_ASSERT_ALWAYS( image && "FrameBufferImage handle is empty" );
106
107   BaseObject& handle = image.GetBaseObject();
108
109   return static_cast<Internal::FrameBufferImage&>(handle);
110 }
111
112 inline const Internal::FrameBufferImage& GetImplementation(const Dali::FrameBufferImage& image)
113 {
114   DALI_ASSERT_ALWAYS( image && "FrameBufferImage handle is empty" );
115
116   const BaseObject& handle = image.GetBaseObject();
117
118   return static_cast<const Internal::FrameBufferImage&>(handle);
119 }
120
121 } // namespace Dali
122
123 #endif // __DALI_INTERNAL_FRAME_BUFFER_IMAGE_H__