1 #ifndef DALI_TOOLKIT_INTERNAL_BATCH_IMAGE_VISUAL_H
2 #define DALI_TOOLKIT_INTERNAL_BATCH_IMAGE_VISUAL_H
5 * Copyright (c) 2016 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.
22 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
23 #include <dali-toolkit/internal/visuals/image-atlas-manager.h>
26 #include <dali/public-api/images/resource-image.h>
35 class BatchImageVisual: public Visual::Base, public ConnectionTracker
42 * @param[in] factoryCache The VisualFactoryCache object
43 * @param[in] atlasManager The atlasManager object
45 BatchImageVisual( VisualFactoryCache& factoryCache, ImageAtlasManager& atlasManager );
48 * @brief A reference counted object may only be deleted by calling Unreference().
52 public: // from Visual
55 * @copydoc Visual::Base::SetSize
57 virtual void SetSize( const Vector2& size );
60 * @copydoc Visual::Base::GetNaturalSize
62 virtual void GetNaturalSize( Vector2& naturalSize ) const;
65 * @copydoc Visual::Base::SetClipRect
67 virtual void SetClipRect( const Rect<int>& clipRect );
70 * @copydoc Visual::Base::CreatePropertyMap
72 virtual void DoCreatePropertyMap( Property::Map& map ) const;
77 * @copydoc Visua::Base::DoInitialize
79 virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
82 * @copydoc Visual::Base::DoSetOnStage
84 virtual void DoSetOnStage( Actor& actor );
87 * @copydoc Visual::Base::DoSetOffStage
89 virtual void DoSetOffStage( Actor& actor );
94 * Get the batch image rendering shader.
95 * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
97 static Shader GetBatchShader( VisualFactoryCache& factoryCache );
100 * @brief Initializes the Dali::Renderer from an image url string
102 * @param[in] imageUrl The image url string to intialize this ImageVisual from
104 void InitializeRenderer( const std::string& imageUrl );
107 * Clean the Visual from cache, and remove the image from atlas if it is not used anymore
109 void CleanCache( const std::string& url );
113 ImageAtlasManager& mAtlasManager;
115 std::string mImageUrl;
116 Dali::ImageDimensions mDesiredSize;
119 } // namespace Internal
121 } // namespace Toolkit
125 #endif // DALI_TOOLKIT_INTERNAL_BATCH_IMAGE_VISUAL_H