BatchImageVisual has been made more like Svg/NpatchVisual. It's "less" public now.
Change-Id: I7c57768db634e1859d4752f3745ce905a8a99cfd
// Batch Image visual
propertyMap.Clear();
- propertyMap.Insert( Visual::Property::TYPE, Visual::BATCH_IMAGE );
- propertyMap.Insert( BatchImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
batchImageVisual.SetSize( visualSize );
DALI_TEST_EQUALS( batchImageVisual.GetSize(), visualSize, TEST_LOCATION );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert( Visual::Property::TYPE, Visual::BATCH_IMAGE );
- propertyMap.Insert( BatchImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
- propertyMap.Insert( BatchImageVisual::Property::DESIRED_WIDTH, 20 );
- propertyMap.Insert( BatchImageVisual::Property::DESIRED_HEIGHT, 30 );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 20 );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 30 );
Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( batchImageVisual );
// Check the property values from the returned map from visual
Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<int>() == Visual::BATCH_IMAGE );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
- value = resultMap.Find( BatchImageVisual::Property::URL, Property::STRING );
+ value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_IMAGE_FILE_NAME );
- value = resultMap.Find( BatchImageVisual::Property::DESIRED_WIDTH, Property::INTEGER );
+ value = resultMap.Find( ImageVisual::Property::DESIRED_WIDTH, Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 20 );
- value = resultMap.Find( BatchImageVisual::Property::DESIRED_HEIGHT, Property::INTEGER );
+ value = resultMap.Find( ImageVisual::Property::DESIRED_HEIGHT, Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 30 );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert( Visual::Property::TYPE, Visual::BATCH_IMAGE );
- propertyMap.Insert( BatchImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
// Set the desired size to be larger than the atlas limit of 1024x1024.
- propertyMap.Insert( BatchImageVisual::Property::DESIRED_WIDTH, 2048 );
- propertyMap.Insert( BatchImageVisual::Property::DESIRED_HEIGHT, 2048 );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 2048 );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 2048 );
// Create the visual.
Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( factory );
Property::Map propertyMap;
- propertyMap.Insert( Visual::Property::TYPE, Visual::BATCH_IMAGE );
- propertyMap.Insert( BatchImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
Visual::Base visual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
// Create a normal Image Visual.
propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
// Instruct the factory to change Image Visuals to Batch-Image Visuals.
- propertyMap.Insert( Visual::Property::BATCHING_ENABLED, true );
+ propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
// Properties for the Batch-Image Visual.
- propertyMap.Insert( BatchImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
Visual::Base visual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<int>(), (int)Visual::BATCH_IMAGE, TEST_LOCATION );
+ DALI_TEST_EQUALS( value->Get<int>(), (int)Visual::IMAGE, TEST_LOCATION );
Actor actor = Actor::New();
// Create a property-map that enables batching.
Property::Map propertyMap;
- propertyMap.Insert( Dali::Toolkit::BatchImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
- propertyMap.Insert( Visual::Property::BATCHING_ENABLED, true );
+ propertyMap.Insert( Dali::Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
// Create an ImageView, passing the property-map in to instruct it to use batching.
Toolkit::ImageView imageView = Toolkit::ImageView::New();
#include <dali-toolkit/public-api/text/rendering-backend.h>
-#include <dali-toolkit/public-api/visuals/batch-image-visual-properties.h>
#include <dali-toolkit/public-api/visuals/border-visual-properties.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
#include <dali-toolkit/public-api/visuals/gradient-visual-properties.h>
#include <dali/public-api/rendering/texture-set.h>
// INTERNAL HEADER
-#include <dali-toolkit/public-api/visuals/batch-image-visual-properties.h>
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
void BatchImageVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
std::string oldImageUrl = mImageUrl;
- Property::Value* imageURLValue = propertyMap.Find( Dali::Toolkit::BatchImageVisual::Property::URL, Dali::Toolkit::Internal::IMAGE_URL_NAME );
+ Property::Value* imageURLValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::URL, Dali::Toolkit::Internal::IMAGE_URL_NAME );
if( imageURLValue )
{
imageURLValue->Get( mImageUrl );
int desiredWidth = 0;
- Property::Value* desiredWidthValue = propertyMap.Find( Dali::Toolkit::BatchImageVisual::Property::DESIRED_WIDTH, DESIRED_WIDTH );
+ Property::Value* desiredWidthValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH, DESIRED_WIDTH );
if( desiredWidthValue )
{
desiredWidthValue->Get( desiredWidth );
}
int desiredHeight = 0;
- Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::BatchImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT );
+ Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT );
if( desiredHeightValue )
{
desiredHeightValue->Get( desiredHeight );
void BatchImageVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::BATCH_IMAGE );
+ map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
if( !mImageUrl.empty() )
{
- map.Insert( Toolkit::BatchImageVisual::Property::URL, mImageUrl );
- map.Insert( Toolkit::BatchImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth() );
- map.Insert( Toolkit::BatchImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight() );
+ map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
+ map.Insert( Toolkit::ImageVisual::Property::BATCHING_ENABLED, true );
+ map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth() );
+ map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight() );
}
}
const char * const IMAGE_DESIRED_WIDTH( "desiredWidth" );
const char * const IMAGE_DESIRED_HEIGHT( "desiredHeight" );
const char * const SYNCHRONOUS_LOADING( "synchronousLoading" );
+const char * const BATCHING_ENABLED( "batchingEnabled" );
// fitting modes
DALI_ENUM_TO_STRING_TABLE_BEGIN( FITTING_MODE )
DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, MESH )
DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, PRIMITIVE )
DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, DEBUG )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, BATCH_IMAGE )
DALI_ENUM_TO_STRING_TABLE_END( VISUAL_TYPE )
const char * const VISUAL_TYPE( "visualType" );
const char * const BATCHING_ENABLED( "batchingEnabled" );
-
BaseHandle Create()
{
BaseHandle handle = Toolkit::VisualFactory::Get();
Scripting::GetEnumerationProperty( *typeValue, VISUAL_TYPE_TABLE, VISUAL_TYPE_TABLE_COUNT, visualType );
}
- // If the type is IMAGE, either from a default or the TYPE value in the property-map, change it to a BatchImage if required.
- if( visualType == Toolkit::Visual::IMAGE )
- {
- bool batchingEnabled( false );
- Property::Value* value = propertyMap.Find( Toolkit::Visual::Property::BATCHING_ENABLED, BATCHING_ENABLED );
- if( value )
- {
- value->Get( batchingEnabled );
- if( batchingEnabled )
- {
- visualType = Toolkit::Visual::BATCH_IMAGE;
- }
- }
- }
-
switch( visualType )
{
case Toolkit::Visual::BORDER:
std::string imageUrl;
if( imageURLValue && imageURLValue->Get( imageUrl ) )
{
- if( NinePatchImage::IsNinePatchUrl( imageUrl ) )
+ Property::Value* batchingEnabledValue = propertyMap.Find( Toolkit::ImageVisual::Property::BATCHING_ENABLED, BATCHING_ENABLED );
+ if( batchingEnabledValue )
+ {
+ bool batchingEnabled( false );
+ batchingEnabledValue->Get( batchingEnabled );
+ if( batchingEnabled )
+ {
+ CreateAtlasManager();
+ visualPtr = new BatchImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ break;
+ }
+ }
+ else if( NinePatchImage::IsNinePatchUrl( imageUrl ) )
{
visualPtr = new NPatchVisual( *( mFactoryCache.Get() ) );
}
break;
}
- case Toolkit::Visual::BATCH_IMAGE:
- {
- CreateAtlasManager();
- visualPtr = new BatchImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
- break;
- }
}
if( visualPtr )
$(public_api_src_dir)/controls/video-view/video-view.h
public_api_visuals_header_files = \
- $(public_api_src_dir)/visuals/batch-image-visual-properties.h \
$(public_api_src_dir)/visuals/border-visual-properties.h \
$(public_api_src_dir)/visuals/color-visual-properties.h \
$(public_api_src_dir)/visuals/gradient-visual-properties.h \
+++ /dev/null
-#ifndef DALI_TOOLKIT_BATCH_IMAGE_VISUAL_PROPERTIES_H
-#define DALI_TOOLKIT_BATCH_IMAGE_VISUAL_PROPERTIES_H
-
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace BatchImageVisual
-{
-
-namespace Property
-{
-
-enum
-{
- /**
- * @brief The URL of the image.
- * @details Name "url", type Property::STRING.
- * @SINCE_1_1.46
- * @note Mandatory.
- */
- URL = VISUAL_PROPERTY_START_INDEX,
-
- /**
- * @brief The image width.
- * @details Name "desiredWidth", type Property::INTEGER.
- * @SINCE_1_1.46
- * @note Optional. If not specified, the actual image width is used.
- */
- DESIRED_WIDTH,
-
- /**
- * @brief The image height.
- * @details Name "desiredHeight", type Property::INTEGER.
- * @SINCE_1_1.46
- * @note Optional. If not specified, the actual image height is used.
- */
- DESIRED_HEIGHT,
-};
-
-} // namespace Property
-
-} // namespace BatchImageVisual
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_BATCH_IMAGE_VISUAL_PROPERTIES_H
* @note For N-Patch images only.
*/
BORDER_ONLY,
+
+ /**
+ * @brief This enables Image visuals to automatically be converted to Batch-Image visuals.
+ * @details Name "batchingEnabled", type Property::BOOLEAN.
+ * @SINCE_1_1.46
+ * @note Optional. For Image visuals only. Not to be used with NPatch or SVG images.
+ */
+ BATCHING_ENABLED,
};
} // namespace Property
MESH, ///< Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file. @SINCE_1_1.45
PRIMITIVE, ///< Renders a simple 3D shape, such as a cube or sphere. @SINCE_1_1.45
DEBUG, ///< Renders a simple wire-frame outlining a quad. @SINCE_1_1.45
- BATCH_IMAGE, ///< Renders an image in the geometry batching mode @SINCE_1_1.46
};
namespace Property
* @see Shader::Property
*/
SHADER,
-
- /**
- * @brief This enables Image visuals to automatically be converted to Batch-Image visuals.
- * @details Name "batchingEnabled", type Boolean.
- * @SINCE_1_1.46
- * @note Optional.
- */
- BATCHING_ENABLED,
};
} // namespace Property