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/public-api/common/intrusive-ptr.h>
25 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
26 #include <dali-toolkit/internal/visuals/image-atlas-manager.h>
35 class BatchImageVisual;
36 typedef IntrusivePtr< BatchImageVisual > BatchImageVisualPtr;
38 class BatchImageVisual: public Visual::Base, public ConnectionTracker
43 * @brief Create a new batch-image visual.
45 * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
46 * @return A smart-pointer to the newly allocated visual.
48 static BatchImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& url );
50 public: // from Visual
53 * @copydoc Visual::Base::SetSize
55 virtual void SetSize( const Vector2& size );
58 * @copydoc Visual::Base::GetNaturalSize
60 virtual void GetNaturalSize( Vector2& naturalSize ) const;
63 * @copydoc Visual::Base::CreatePropertyMap
65 virtual void DoCreatePropertyMap( Property::Map& map ) const;
68 * @copydoc Visual::Base::DoSetProperty
70 virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
73 * @copydoc Visual::Base::DoGetProperty
75 virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
82 * @param[in] factoryCache The VisualFactoryCache object
84 BatchImageVisual( VisualFactoryCache& factoryCache );
87 * @brief A reference counted object may only be deleted by calling Unreference().
92 * @copydoc Visua::Base::DoSetProperties
94 virtual void DoSetProperties( const Property::Map& propertyMap );
97 * @copydoc Visual::Base::DoSetOnStage
99 virtual void DoSetOnStage( Actor& actor );
102 * @copydoc Visual::Base::DoSetOffStage
104 virtual void DoSetOffStage( Actor& actor );
109 * Get the batch image rendering shader.
110 * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
112 static Shader GetBatchShader( VisualFactoryCache& factoryCache );
115 * @brief Initializes the Dali::Renderer from an image url string
117 * @param[in] imageUrl The image url string to intialize this ImageVisual from
119 void InitializeRenderer( const std::string& imageUrl );
122 * Clean the Visual from cache, and remove the image from atlas if it is not used anymore
124 void CleanCache( const std::string& url );
129 std::string mImageUrl;
130 Dali::ImageDimensions mDesiredSize;
133 } // namespace Internal
135 } // namespace Toolkit
139 #endif // DALI_TOOLKIT_INTERNAL_BATCH_IMAGE_VISUAL_H