2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FUiCtrl_OverlayAgent.h
19 * @brief This is the header file for the _OverlayAgent class.
21 * This header file contains the declarations of the _OverlayAgent class.
24 #ifndef _FUI_INTERNAL_OVERLAY_AGENT_H_
25 #define _FUI_INTERNAL_OVERLAY_AGENT_H_
28 #include <X11/extensions/Xvlib.h>
34 #include <FBaseDataType.h>
36 namespace Tizen { namespace Base
41 namespace Tizen { namespace Ui
46 namespace Tizen { namespace Graphics
53 namespace Tizen { namespace Ui { namespace Animations
58 namespace Tizen { namespace Ui { namespace Controls
60 enum _OverlayAgentRotation
62 _OVERLAY_AGENT_ROTATION_NONE,
63 _OVERLAY_AGENT_ROTATION_90,
64 _OVERLAY_AGENT_ROTATION_180,
65 _OVERLAY_AGENT_ROTATION_270,
66 _OVERLAY_AGENT_ROTATION_NONE_LR,
67 _OVERLAY_AGENT_ROTATION_NONE_UD,
68 _OVERLAY_AGENT_ROTATION_90_LR,
69 _OVERLAY_AGENT_ROTATION_90_UD,
70 _OVERLAY_AGENT_ROTATION_180_LR,
71 _OVERLAY_AGENT_ROTATION_180_UD,
72 _OVERLAY_AGENT_ROTATION_270_LR,
73 _OVERLAY_AGENT_ROTATION_270_UD,
74 _OVERLAY_AGENT_ROTATION_MAX
77 enum _OverlayAgentBufferPixelFormat
79 _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_ARGB8888,
80 _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_RGB565,
81 _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_YCbCr420_PLANAR,
82 _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_NV12,
83 _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_UYVY
86 enum _OverlayAgentStyle
88 _OVERLAY_AGENT_STYLE_NONE,
89 _OVERLAY_AGENT_STYLE_REGION_SW,
90 _OVERLAY_AGENT_STYLE_REGION_GL,
91 _OVERLAY_AGENT_STYLE_PANEL_SW,
92 _OVERLAY_AGENT_STYLE_PANEL_GL
98 static _OverlayAgent* CreateInstanceN(_OverlayAgentStyle style, const _Control& control, const Tizen::Graphics::Rectangle& phyBounds);
102 result GetBufferInfo(Tizen::Graphics::BufferInfo& bufferInfo) const;
104 result SetInputBuffer(const Tizen::Graphics::Dimension& destDim, const Tizen::Base::ByteBuffer& srcBuffer,
105 const Tizen::Graphics::Dimension& srcDim, _OverlayAgentBufferPixelFormat srcFormat);
106 result SetRotation(_OverlayAgentRotation rotation);
107 result SetDestination(const Tizen::Graphics::Dimension& dimension);
108 result SetAspectRatio(bool enable);
110 result CreatePixmap(void);
111 Pixmap GetPixmap(void) const;
112 Evas_Object* GetPixmapImageObject(void) const;
114 result GrabXvPort(void);
115 void UngrabXvPort(void);
117 result Show(void) const;
118 result AdjustImageObject(void);
120 static int GetOverlayAgentCount(void);
122 static int GetDstRectMinWidth(void);
123 static int GetDstRectMinHeight(void);
124 static int GetSrcRectMinWidth(void);
125 static int GetSrcRectMinHeight(void);
128 result CreateImageObjectForOverlayRegion(const _Control& control, const Tizen::Graphics::Rectangle& bounds);
129 result CreateImageObject(const _Control& control, const Tizen::Graphics::Rectangle& bounds);
131 result PutXvImage(void);
132 result PutEvasImage(void);
134 bool IsValidSourceDimension(const Tizen::Graphics::Dimension& dimension) const;
135 bool IsValidDestinationDimension(const Tizen::Graphics::Dimension& dimension) const;
137 _OverlayAgent(_OverlayAgentStyle style, const _Control& control, const Tizen::Graphics::Rectangle& bounds);
139 _OverlayAgent(const _OverlayAgent& rhs);
140 _OverlayAgent& operator=(const _OverlayAgent& rhs);
143 const static int _OVERLAYAGENT_XV_PORT = 100;
145 static int overlayAgentcount;
146 static int overlayAgentXvPortCount;
147 static int baseXvPort;
148 static bool isPortGrapped[_OVERLAYAGENT_XV_PORT];
150 static int dstRectMinWidth;
151 static int dstRectMinHegith;
152 static int srcRectMinWidth;
153 static int srcRectMinHegith;
155 Evas_Object* __pImageObject;
156 Evas_Object* __pRenderImageObject;
157 Evas_Object* __pSmartObject;
159 Ecore_X_Damage __pixmapDamageHandle;
160 Ecore_Event_Handler *__pPixmapEventHandler;
163 Tizen::Ui::Animations::_VisualElement* __pVisualElement;
164 Tizen::Graphics::Color __bgColor;
169 unsigned int __colorFormat;
176 Tizen::Graphics::Dimension __srcDimension;
177 Tizen::Graphics::Dimension __destDimension;
178 Tizen::Graphics::Rectangle __pixmapPhyRect;
179 Tizen::Graphics::Rectangle __resizeRect;
181 _OverlayAgentStyle __style;
184 unsigned int __newColorFormat;
185 XShmSegmentInfo* __pShmInfo;
187 _OverlayAgentBufferPixelFormat __overlayAgentColorFormat;
188 const Tizen::Base::ByteBuffer* __pRefUserByteBuffer;
189 Tizen::Base::ByteBuffer* __pOrgUserByteBuffer;
190 Tizen::Graphics::Dimension __orgImgDimension;
196 #endif // _FUI_INTERNAL_OVERLAY_AGENT_H_