1 #ifndef __DALI_TOOLKIT_IMAGE_ATLAS_IMPL_H__
2 #define __DALI_TOOLKIT_IMAGE_ATLAS_IMPL_H__
5 * Copyright (c) 2015 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.
21 #include <dali/public-api/common/intrusive-ptr.h>
22 #include <dali/public-api/object/base-object.h>
23 #include <dali/devel-api/images/atlas.h>
26 #include <dali-toolkit/devel-api/image-atlas/image-atlas.h>
27 #include <dali-toolkit/internal/image-atlas/atlas-packer.h>
28 #include <dali-toolkit/internal/image-atlas/image-load-thread.h>
32 class EventThreadCallback;
40 class ImageAtlas : public BaseObject
44 typedef Toolkit::ImageAtlas::SizeType SizeType;
48 * @param [in] width The atlas width in pixels.
49 * @param [in] height The atlas height in pixels.
50 * @param [in] pixelFormat The pixel format.
52 ImageAtlas( SizeType width, SizeType height, Pixel::Format pixelFormat );
55 * @copydoc Toolkit::ImageAtlas::New
57 static IntrusivePtr<ImageAtlas> New( SizeType width, SizeType height, Pixel::Format pixelFormat );
60 * @copydoc Toolkit::ImageAtlas::GetAtlas
65 * @copydoc Toolkit::ImageAtlas::SetBrokenImage
67 void SetBrokenImage( const std::string& brokenImageUrl );
70 * @copydoc Toolkit::ImageAtlas::Upload( Vector4&, const std::string&, ImageDimensions,FittingMode::Type, bool )
72 bool Upload( Vector4& textureRect,
73 const std::string& url,
75 FittingMode::Type fittingMode,
76 bool orientationCorrection);
79 * @copydoc Toolkit::ImageAtlas::Upload( Vector4&, PixelData )
81 bool Upload( Vector4& textureRect, PixelData pixelData );
84 * @copydoc Toolkit::ImageAtlas::Remove
86 void Remove( const Vector4& textureRect );
98 * Upload the bitmap to atlas when the image is loaded in the worker thread.
100 void UploadToAtlas();
103 * Upload broken image
105 * @param[in] area The pixel area for uploading.
107 void UploadBrokenImage( const Rect<SizeType>& area );
110 ImageAtlas( const ImageAtlas& imageAtlas);
113 ImageAtlas& operator=( const ImageAtlas& imageAtlas );
120 LoadQueue mLoadQueue;
121 CompleteQueue mCompleteQueue;
122 ImageLoadThread mLoadingThread;
124 std::string mBrokenImageUrl;
125 ImageDimensions mBrokenImageSize;
128 Pixel::Format mPixelFormat;
129 bool mLoadingThreadStarted;
133 } // namespace Internal
135 inline const Internal::ImageAtlas& GetImplementation( const Toolkit::ImageAtlas& imageAtlas )
137 DALI_ASSERT_ALWAYS( imageAtlas && "ImageAtlas handle is empty" );
139 const BaseObject& handle = imageAtlas.GetBaseObject();
141 return static_cast<const Internal::ImageAtlas&>(handle);
144 inline Internal::ImageAtlas& GetImplementation( Toolkit::ImageAtlas& imageAtlas )
146 DALI_ASSERT_ALWAYS( imageAtlas && "ImageAtlas handle is empty" );
148 BaseObject& handle = imageAtlas.GetBaseObject();
150 return static_cast<Internal::ImageAtlas&>(handle);
153 } // namespace Toolkit
157 #endif /* __DALI_TOOLKIT_IMAGE_ATLAS_IMPL_H__ */