1 #ifndef __DALI_INTERNAL_PIXMAP_IMAGE_H__
2 #define __DALI_INTERNAL_PIXMAP_IMAGE_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
25 #include <pixmap-image.h>
35 class EglImageExtensions;
38 * Dali internal PixmapImage.
45 * Create a new PixmapImage internally.
46 * Depending on hardware the width and height may have to be a power of two.
47 * @param[in] width The width of the image.
48 * @param[in] height The height of the image.
49 * @param[in] depth color depth of the pixmap
50 * @param[in] pixmap contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty
51 * @return A smart-pointer to a newly allocated image.
53 static PixmapImage* New(unsigned int width,
55 Dali::PixmapImage::ColorDepth depth,
59 * @copydoc Dali::PixmapImage::GetPixels()
61 bool GetPixels(std::vector<unsigned char> &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format& pixelFormat ) const;
64 * @copydoc Dali::PixmapImage::EncodeToFile(const std::string& )
66 bool EncodeToFile(const std::string& filename) const;
74 * @copydoc Dali::PixmapImage::GlExtensionCreate()
76 bool GlExtensionCreate();
79 * @copydoc Dali::PixmapImage::GlExtensionDestroy()
81 void GlExtensionDestroy();
84 * @copydoc Dali::PixmapImage::TargetTexture()
86 unsigned int TargetTexture();
89 * @copydoc Dali::PixmapImage::GetWidth()
91 unsigned int GetWidth() const
97 * @copydoc Dali::PixmapImage::GetHeight()
99 unsigned int GetHeight() const
105 * @copydoc Dali::PixmapImage::GetPixelFormat()
107 Pixel::Format GetPixelFormat() const
115 * Private constructor; @see PixmapImage::New()
116 * @param[in] width The width of the image.
117 * @param[in] height The height of the image.
118 * @param[in] colour depth of the pixmap
119 * @param[in] pixmap contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty
121 PixmapImage(unsigned int width,
123 Dali::PixmapImage::ColorDepth depth,
127 * 2nd phase construction.
132 * Uses X11 to get the default depth.
133 * @param depth the PixelImage depth enum
134 * @return default x11 pixel depth
136 int GetPixelDepth(Dali::PixmapImage::ColorDepth depth) const;
139 * Sets the pixel format based on the bit depth
140 * @param depth depth in bytes
142 void SetPixelFormat(int depth);
145 * Gets the pixmap from the Any parameter
146 * @param pixmap contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty
147 * @return pixmap x11 pixmap
149 Ecore_X_Pixmap GetPixmapFromAny(Any pixmap) const;
152 * Given an existing pixmap, the function uses X to find out
153 * the width, heigth and depth of that pixmap.
155 void GetPixmapDetails();
159 unsigned int mWidth; ///< pixmap width
160 unsigned int mHeight; ///< pixmap heights
161 bool mOwnPixmap; ///< Whether we created pixmap or not
162 Ecore_X_Pixmap mPixmap; ///< From Xlib
163 Pixel::Format mPixelFormat; ///< pixmap pixel format
164 Dali::PixmapImage::ColorDepth mColorDepth; ///< color depth of pixmap
165 void* mEglImageKHR; ///< From EGL extension
166 EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions
169 } // namespace Adaptor
171 } // namespace Internal
175 #endif // __DALI_INTERNAL_PIXMAP_IMAGE_H__