diff --git a/README b/README index dc7b5af..5187f08 100644 --- a/README +++ b/README @@ -43,7 +43,6 @@ To build the repository enter the 'build/tizen' folder: Then run the following commands: - autoreconf --install - ./configure --prefix=$DESKTOP_PREFIX + cmake -DCMAKE_INSTALL_PREFIX=$DESKTOP_PREFIX . make install -j8 diff --git a/build/tizen/.gitignore b/build/tizen/.gitignore index 1e145df..1712ae7 100644 --- a/build/tizen/.gitignore +++ b/build/tizen/.gitignore @@ -1,16 +1,8 @@ -/aclocal.m4 -/autom4te.cache -/compile -/config.guess -/config.log -/config.status -/config.sub -/configure -/depcomp -/install-sh -/libtool -/ltmain.sh -/missing +CMakeCache.txt +CMakeFiles/ +cmake_install.cmake +demo/dali-demo +install_manifest.txt /demo/dali-demo /demo/dali-examples /demo/dali-performance diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt new file mode 100644 index 0000000..5147cb3 --- /dev/null +++ b/build/tizen/CMakeLists.txt @@ -0,0 +1,73 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(dali-demo C CXX) + +SET(dali-demo_VERSION_MAJOR 1) +SET(dali-demo_VERSION_MINOR 0) + +SET(ROOT_SRC_DIR ${CMAKE_SOURCE_DIR}/../..) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) + +IF(DEFINED DALI_APP_DIR) + SET(APP_DATA_DIR ${DALI_APP_DIR}) + SET(BINDIR ${APP_DATA_DIR}/bin) +ELSE() + SET(APP_DATA_DIR ${PREFIX}/share/com.samsung.dali-demo) + SET(BINDIR ${PREFIX}/bin) +ENDIF() + +SET(LOCAL_IMAGES_DIR ${ROOT_SRC_DIR}/demo/images) +SET(LOCAL_MODELS_DIR ${ROOT_SRC_DIR}/demo/models) +SET(LOCAL_SCRIPTS_DIR ${ROOT_SRC_DIR}/demo/scripts) + +SET(IMAGES_DIR ${APP_DATA_DIR}/images/) +SET(MODELS_DIR ${APP_DATA_DIR}/models/) +SET(SCRIPTS_DIR ${APP_DATA_DIR}/scripts/) + +SET(DALI_IMAGE_DIR \\"${IMAGES_DIR}\\") +SET(DALI_MODEL_DIR \\"${MODELS_DIR}\\") +SET(DALI_SCRIPT_DIR \\"${SCRIPTS_DIR}\\") +SET(DALI_EXAMPLE_BIN \\"${BINDIR}/\\") + +FILE(GLOB LOCAL_IMAGES_PNG RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.png") +FILE(GLOB LOCAL_IMAGES_JPG RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.jpg") +FILE(GLOB LOCAL_IMAGES_GIF RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.gif") +FILE(GLOB LOCAL_IMAGES_BMP RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.bmp") +FILE(GLOB LOCAL_IMAGES_ICO RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.ico") +FILE(GLOB LOCAL_IMAGES_WBMP RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.wbmp") + +SET(LOCAL_IMAGES_LIST ${LOCAL_IMAGES_PNG};${LOCAL_IMAGES_JPG};${LOCAL_IMAGES_GIF};${LOCAL_IMAGES_BMP};${LOCAL_IMAGES_ICO};${LOCAL_IMAGES_WBMP}) +FOREACH(flag ${LOCAL_IMAGES_LIST}) + INSTALL(FILES ../../demo/images/${flag} DESTINATION ${IMAGES_DIR}) +ENDFOREACH(flag) + +FILE(GLOB LOCAL_MODELS_LIST RELATIVE "${LOCAL_MODELS_DIR}" "${LOCAL_MODELS_DIR}/*") +FOREACH(flag ${LOCAL_MODELS_LIST}) + INSTALL(FILES ../../demo/models/${flag} DESTINATION ${MODELS_DIR}) +ENDFOREACH(flag) + +FILE(GLOB LOCAL_SCRIPTS_LIST RELATIVE "${LOCAL_SCRIPTS_DIR}" "${LOCAL_SCRIPTS_DIR}/*") +FOREACH(flag ${LOCAL_SCRIPTS_LIST}) + INSTALL(FILES ../../demo/scripts/${flag} DESTINATION ${SCRIPTS_DIR}) +ENDFOREACH(flag) + +SET(PKG_LIST dali + dali-toolkit) + +INCLUDE(FindPkgConfig) +pkg_check_modules(REQUIRED_PKGS REQUIRED ${PKG_LIST}) + +FOREACH(flag ${REQUIRED_PKGS_CFLAGS}) + SET(REQUIRED_CFLAGS "${REQUIRED_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(DALI_DEMO_CFLAGS "-DDALI_IMAGE_DIR=${DALI_IMAGE_DIR} -DDALI_MODEL_DIR=${DALI_MODEL_DIR} -DDALI_SCRIPT_DIR=${DALI_SCRIPT_DIR} -DDALI_EXAMPLE_BIN=${DALI_EXAMPLE_BIN} -fvisibility=hidden -DHIDE_DALI_INTERNALS") + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${REQUIRED_CFLAGS} ${DALI_DEMO_CFLAGS} -Werror -Wall") +SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") + +INCLUDE_DIRECTORIES(${ROOT_SRC_DIR}) +INCLUDE_DIRECTORIES(${DEMO_SRC_DIR}) + +ADD_SUBDIRECTORY(demo) +ADD_SUBDIRECTORY(examples) diff --git a/build/tizen/Makefile.am b/build/tizen/Makefile.am deleted file mode 100644 index e8fb71e..0000000 --- a/build/tizen/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -SUBDIRS = examples demo - -MAINTAINERCLEANFILES = \ - aclocal.m4 \ - autom4te.cache \ - config.guess \ - config.sub \ - configure \ - depcomp \ - install-sh \ - ltmain.sh \ - missing \ - `find "$(srcdir)" -type f -name Makefile.in -print` \ - `find . \( -name "*.gcov" -o -name "*.gcno" -o -name "*.gcda" \) -print` - -CLEANFILES = \ - `find . \( -name "*.gcov" -o -name "*.gcno" -o -name "*.gcda" \) -print` diff --git a/build/tizen/configure.ac b/build/tizen/configure.ac deleted file mode 100644 index 8ac8f52..0000000 --- a/build/tizen/configure.ac +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright (c) 2014 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. - - -m4_define([dali_version],[0.1.0]) -AC_INIT([dali], [dali_version]) -AM_INIT_AUTOMAKE([-Wall foreign]) - -AC_PROG_CXX -AC_PROG_LIBTOOL - -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -LT_INIT - -DALI_VERSION=dali_version -AC_SUBST(DALI_VERSION) - -PKG_CHECK_MODULES(DALI, dali) -PKG_CHECK_MODULES(DALI_TOOLKIT, dali-toolkit) - -DALIDEMO_CFLAGS=-DPLATFORM_SLP - -AC_ARG_ENABLE([debug], - [AC_HELP_STRING([--enable-debug], - [Turns on debugging])], - [enable_debug=$enableval], - [enable_debug=no]) - -if test "x$enable_debug" = "xyes"; then - DALIDEMO_CFLAGS="$DALIDEMO_CFLAGS -DDEBUG_ENABLED" -fi - -if test x$DALI_APP_DIR != x; then - appdatadir=$DALI_APP_DIR - exedir=${appdatadir}/bin/ -else - appdatadir=${prefix}/share/com.samsung.dali-demo/ - exedir=${prefix}/bin/ -fi - -AC_SUBST(datadir) -AC_SUBST(appdatadir) -AC_SUBST(exedir) -AC_SUBST(DALIDEMO_CFLAGS) - -dnl ************************************************************************** -dnl ** Set Debian install Prefix ** -dnl ************************************************************************** -debian_prefix=${prefix#*/} -AC_SUBST(debian_prefix) - -AC_CONFIG_FILES([ - Makefile - demo/Makefile - examples/Makefile -]) - - -AC_OUTPUT - -echo " -Configuration -------------- - Prefix: $prefix - Debug Build: $enable_debug - Application Data Dir: $appdatadir - Application Exe Dir: $exedir - DALIDEMO_CFLAGS: ${DALIDEMO_CFLAGS} -" diff --git a/build/tizen/demo/CMakeLists.txt b/build/tizen/demo/CMakeLists.txt new file mode 100644 index 0000000..83fe747 --- /dev/null +++ b/build/tizen/demo/CMakeLists.txt @@ -0,0 +1,8 @@ +SET(DEMO_SRC_DIR ${ROOT_SRC_DIR}/demo) + +AUX_SOURCE_DIRECTORY(${DEMO_SRC_DIR} DEMO_SRCS) + +ADD_EXECUTABLE(${PROJECT_NAME} ${DEMO_SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS}) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) diff --git a/build/tizen/demo/Makefile.am b/build/tizen/demo/Makefile.am deleted file mode 100644 index a1713fe..0000000 --- a/build/tizen/demo/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (c) 2014 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. - - -bin_PROGRAMS = \ - dali-demo - -demo_src_dir = ../../../demo -include ../../../demo/file.list - -dalidemoimagesdir = $(appdatadir)/images/ -dalidemoimages_DATA = $(demo_image_files) - -dalidemomodelsdir = $(appdatadir)/models/ -dalidemomodels_DATA = $(demo_model_files) - -dalidemoshadersdir = $(appdatadir)/shaders/ -dalidemoshaders_DATA = $(demo_shader_files) - -dalidemoscriptsdir = $(appdatadir)/scripts/ -dalidemoscripts_DATA = $(demo_script_files) - - -DEMO_CXXFLAGS = -DDALI_IMAGE_DIR="\"$(dalidemoimagesdir)\"" \ - -DDALI_MODEL_DIR="\"$(dalidemomodelsdir)\"" \ - -DDALI_SCRIPT_DIR="\"$(dalidemoscriptsdir)\"" \ - -DDALI_SHADER_DIR="\"$(dalidemoshadersdir)\"" \ - -DDALI_EXAMPLE_BIN="\"$(exedir)\"" \ - -I../../../demo -I../../.. \ - $(DALIDEMO_CFLAGS) \ - $(DALI_TOOLKIT_CFLAGS) \ - $(DALI_CFLAGS) \ - $(AUL_CFLAGS) \ - -Werror -Wall - -DEMO_DEPS = - -DEMO_LDADD = $(DALI_LIBS) $(DALI_TOOLKIT_LIBS) $(AUL_LIBS) - -dali_demo_SOURCES = $(demo_src_files) -dali_demo_CXXFLAGS = $(DEMO_CXXFLAGS) -dali_demo_DEPENDENCIES = $(DEMO_DEPS) -dali_demo_LDADD = $(DEMO_LDADD) diff --git a/build/tizen/docs/Makefile.am b/build/tizen/docs/Makefile.am deleted file mode 100644 index 8d70825..0000000 --- a/build/tizen/docs/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -all-local: - @rm -f doxygen-errors.txt - @-doxygen dali.doxy &> doxygen-errors.txt || rm doxygen-errors.txt - @touch doxygen-errors.txt - @cat doxygen-errors.txt - @if [ -s doxygen-errors.txt ]; then exit 1 ; fi - @rm doxygen-errors.txt diff --git a/build/tizen/examples/CMakeLists.txt b/build/tizen/examples/CMakeLists.txt new file mode 100644 index 0000000..0ea3823 --- /dev/null +++ b/build/tizen/examples/CMakeLists.txt @@ -0,0 +1,111 @@ +SET(EXAMPLES_SRC_DIR ${ROOT_SRC_DIR}/examples) + +SET(BLOCKS_SRCS ${EXAMPLES_SRC_DIR}/blocks/blocks-example.cpp) +ADD_EXECUTABLE(blocks.example ${BLOCKS_SRCS}) +TARGET_LINK_LIBRARIES(blocks.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS blocks.example DESTINATION ${BINDIR}) + +SET(BUBBLE_EFFECT_SRCS ${EXAMPLES_SRC_DIR}/shader-effect/bubble-effect-example.cpp) +ADD_EXECUTABLE(bubble-effect.example ${BUBBLE_EFFECT_SRCS}) +TARGET_LINK_LIBRARIES(bubble-effect.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS bubble-effect.example DESTINATION ${BINDIR}) + +SET(CLUSTER_SRCS ${EXAMPLES_SRC_DIR}/cluster/cluster-example.cpp) +ADD_EXECUTABLE(cluster.example ${CLUSTER_SRCS}) +TARGET_LINK_LIBRARIES(cluster.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS cluster.example DESTINATION ${BINDIR}) + +SET(CUBE_TRANSITION_EFFECT_SRCS ${EXAMPLES_SRC_DIR}/transition/cube-transition-effect-example.cpp) +ADD_EXECUTABLE(cube-transition-effect.example ${CUBE_TRANSITION_EFFECT_SRCS}) +TARGET_LINK_LIBRARIES(cube-transition-effect.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS cube-transition-effect.example DESTINATION ${BINDIR}) + +SET(DISSOLVE_EFFECT_SRCS ${EXAMPLES_SRC_DIR}/shader-effect/dissolve-effect-example.cpp) +ADD_EXECUTABLE(dissolve-effect.example ${DISSOLVE_EFFECT_SRCS}) +TARGET_LINK_LIBRARIES(dissolve-effect.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS dissolve-effect.example DESTINATION ${BINDIR}) + +SET(HELLO_WORLD_SRCS ${EXAMPLES_SRC_DIR}/hello-world/hello-world-example.cpp) +ADD_EXECUTABLE(hello-world.example ${HELLO_WORLD_SRCS}) +TARGET_LINK_LIBRARIES(hello-world.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS hello-world.example DESTINATION ${BINDIR}) + +SET(ITEM_VIEW_SRCS ${EXAMPLES_SRC_DIR}/item-view/item-view-example.cpp) +ADD_EXECUTABLE(item-view.example ${ITEM_VIEW_SRCS}) +TARGET_LINK_LIBRARIES(item-view.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS item-view.example DESTINATION ${BINDIR}) + +SET(MAGNIFIER_SRCS ${EXAMPLES_SRC_DIR}/magnifier/magnifier-example.cpp) +ADD_EXECUTABLE(magnifier.example ${MAGNIFIER_SRCS}) +TARGET_LINK_LIBRARIES(magnifier.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS magnifier.example DESTINATION ${BINDIR}) + +SET(MOTION_BLUR_SRCS ${EXAMPLES_SRC_DIR}/motion/motion-blur-example.cpp) +ADD_EXECUTABLE(motion-blur.example ${MOTION_BLUR_SRCS}) +TARGET_LINK_LIBRARIES(motion-blur.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS motion-blur.example DESTINATION ${BINDIR}) + +SET(MOTION_STRETCH_SRCS ${EXAMPLES_SRC_DIR}/motion/motion-stretch-example.cpp) +ADD_EXECUTABLE(motion-stretch.example ${MOTION_STRETCH_SRCS}) +TARGET_LINK_LIBRARIES(motion-stretch.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS motion-stretch.example DESTINATION ${BINDIR}) + +SET(NEW_WINDOW_SRCS ${EXAMPLES_SRC_DIR}/new-window/new-window-example.cpp) +ADD_EXECUTABLE(new-window.example ${NEW_WINDOW_SRCS}) +TARGET_LINK_LIBRARIES(new-window.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS new-window.example DESTINATION ${BINDIR}) + +SET(PAGE_TURN_VIEW_SRCS ${EXAMPLES_SRC_DIR}/page-turn-view/page-turn-view-example.cpp) +ADD_EXECUTABLE(page-turn-view.example ${PAGE_TURN_VIEW_SRCS}) +TARGET_LINK_LIBRARIES(page-turn-view.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS page-turn-view.example DESTINATION ${BINDIR}) + +AUX_SOURCE_DIRECTORY(${EXAMPLES_SRC_DIR}/radial-menu RADIAL_MENU_SRCS) +ADD_EXECUTABLE(radial-menu.example ${RADIAL_MENU_SRCS}) +TARGET_LINK_LIBRARIES(radial-menu.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS radial-menu.example DESTINATION ${BINDIR}) + +SET(REFRACTION_EFFECT_SRCS ${EXAMPLES_SRC_DIR}/shader-effect/refraction-effect-example.cpp) +ADD_EXECUTABLE(refraction-effect.example ${REFRACTION_EFFECT_SRCS}) +TARGET_LINK_LIBRARIES(refraction-effect.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS refraction-effect.example DESTINATION ${BINDIR}) + +SET(SCROLL_VIEW_SRCS ${EXAMPLES_SRC_DIR}/scroll-view/scroll-view-example.cpp) +ADD_EXECUTABLE(scroll-view.example ${SCROLL_VIEW_SRCS}) +TARGET_LINK_LIBRARIES(scroll-view.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS scroll-view.example DESTINATION ${BINDIR}) + +SET(SHADOW_BONE_LIGHTING_SRCS ${EXAMPLES_SRC_DIR}/shadows/shadow-bone-lighting-example.cpp) +ADD_EXECUTABLE(shadow-bone-lighting.example ${SHADOW_BONE_LIGHTING_SRCS}) +TARGET_LINK_LIBRARIES(shadow-bone-lighting.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS shadow-bone-lighting.example DESTINATION ${BINDIR}) + +SET(DALI_BUILDER_SRCS ${EXAMPLES_SRC_DIR}/builder/dali-builder.cpp) +ADD_EXECUTABLE(dali-builder ${DALI_BUILDER_SRCS}) +TARGET_LINK_LIBRARIES(dali-builder ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS dali-builder DESTINATION ${BINDIR}) + +SET(BUILDER_SRCS ${EXAMPLES_SRC_DIR}/builder/examples.cpp) +ADD_EXECUTABLE(builder.example ${BUILDER_SRCS}) +TARGET_LINK_LIBRARIES(builder.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS builder.example DESTINATION ${BINDIR}) + +SET(IMAGE_SCALING_IRREGULAR_GRID_SRCS ${EXAMPLES_SRC_DIR}/image/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp) +ADD_EXECUTABLE(image-scaling-irregular-grid.example ${IMAGE_SCALING_IRREGULAR_GRID_SRCS}) +TARGET_LINK_LIBRARIES(image-scaling-irregular-grid.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS image-scaling-irregular-grid.example DESTINATION ${BINDIR}) + +SET(BUTTONS_SRCS ${EXAMPLES_SRC_DIR}/buttons/buttons-example.cpp) +ADD_EXECUTABLE(buttons.example ${BUTTONS_SRCS}) +TARGET_LINK_LIBRARIES(buttons.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS buttons.example DESTINATION ${BINDIR}) + +SET(TEXT_VIEW_SRCS ${EXAMPLES_SRC_DIR}/text-view/text-view-example.cpp) +ADD_EXECUTABLE(text-view.example ${TEXT_VIEW_SRCS}) +TARGET_LINK_LIBRARIES(text-view.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS text-view.example DESTINATION ${BINDIR}) + +SET(LOGGING_SRCS ${EXAMPLES_SRC_DIR}/logging/logging-example.cpp) +ADD_EXECUTABLE(logging.example ${LOGGING_SRCS}) +TARGET_LINK_LIBRARIES(logging.example ${REQUIRED_PKGS_LDFLAGS}) +INSTALL(TARGETS logging.example DESTINATION ${BINDIR}) diff --git a/build/tizen/examples/Makefile.am b/build/tizen/examples/Makefile.am deleted file mode 100644 index bb61a9c..0000000 --- a/build/tizen/examples/Makefile.am +++ /dev/null @@ -1,178 +0,0 @@ -# Copyright (c) 2014 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. - - -examples_src_dir = ../../../examples - -bin_PROGRAMS = \ - blocks.example \ - bubble-effect.example \ - cluster.example \ - cube-transition-effect.example \ - dissolve-effect.example \ - hello-world.example \ - item-view.example \ - magnifier.example \ - motion-blur.example \ - motion-stretch.example \ - new-window.example \ - page-turn-view.example \ - radial-menu.example \ - refraction-effect.example \ - scroll-view.example \ - shadow-bone-lighting.example \ - dali-builder \ - builder.example \ - image-scaling-irregular-grid.example \ - buttons.example \ - text-view.example \ - logging.example - - -daliimagedir = $(appdatadir)/images/ -dalimodeldir = $(appdatadir)/models/ -daliscriptdir = $(appdatadir)/scripts/ - -BASE_CXXFLAGS = -I../../../examples \ - -DDALI_IMAGE_DIR="\"${daliimagedir}\"" \ - -DDALI_MODEL_DIR="\"${dalimodeldir}\"" \ - -DDALI_SCRIPT_DIR="\"${daliscriptdir}\"" \ - $(DALIDEMO_CFLAGS) \ - $(ECORE_X_CFLAGS) \ - $(CAPI_MEDIA_PLAYER_CFLAGS) \ - $(CAPI_APPFW_APPLICATION_CFLAGS) \ - -I/usr/include/media \ - -Werror -Wall - -EXAMPLE_CXXFLAGS = $(DALI_CFLAGS) \ - $(DALI_TOOLKIT_CFLAGS) \ - $(BASE_CXXFLAGS) - - -EXAMPLE_DEPS = - -EXAMPLE_LDADD = $(DALI_LIBS) $(DALI_TOOLKIT_LIBS) $(ECORE_X_LIBS) $(CAPI_MEDIA_PLAYER_LIBS) $(CAPI_APPFW_APPLICATION_LIBS) -lrt -lEGL - - -blocks_example_SOURCES = $(examples_src_dir)/blocks/blocks-example.cpp -blocks_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -blocks_example_DEPENDENCIES = $(EXAMPLE_DEPS) -blocks_example_LDADD = $(EXAMPLE_LDADD) - -bubble_effect_example_SOURCES = $(examples_src_dir)/shader-effect/bubble-effect-example.cpp -bubble_effect_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -bubble_effect_example_DEPENDENCIES = $(EXAMPLE_DEPS) -bubble_effect_example_LDADD = $(EXAMPLE_LDADD) - -cluster_example_SOURCES = $(examples_src_dir)/cluster/cluster-example.cpp -cluster_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -cluster_example_DEPENDENCIES = $(EXAMPLE_DEPS) -cluster_example_LDADD = $(EXAMPLE_LDADD) - -cube_transition_effect_example_SOURCES = $(examples_src_dir)/transition/cube-transition-effect-example.cpp -cube_transition_effect_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -cube_transition_effect_example_DEPENDENCIES = $(EXAMPLE_DEPS) -cube_transition_effect_example_LDADD = $(EXAMPLE_LDADD) - -dissolve_effect_example_SOURCES = $(examples_src_dir)/shader-effect/dissolve-effect-example.cpp -dissolve_effect_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -dissolve_effect_example_DEPENDENCIES = $(EXAMPLE_DEPS) -dissolve_effect_example_LDADD = $(EXAMPLE_LDADD) - -hello_world_example_SOURCES = $(examples_src_dir)/hello-world/hello-world-example.cpp -hello_world_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -hello_world_example_DEPENDENCIES = $(EXAMPLE_DEPS) -hello_world_example_LDADD = $(EXAMPLE_LDADD) - -item_view_example_SOURCES = $(examples_src_dir)/item-view/item-view-example.cpp -item_view_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -item_view_example_DEPENDENCIES = $(EXAMPLE_DEPS) -item_view_example_LDADD = $(EXAMPLE_LDADD) - -magnifier_example_SOURCES = $(examples_src_dir)/magnifier/magnifier-example.cpp -magnifier_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -magnifier_example_DEPENDENCIES = $(EXAMPLE_DEPS) -magnifier_example_LDADD = $(EXAMPLE_LDADD) - -motion_blur_example_SOURCES = $(examples_src_dir)/motion/motion-blur-example.cpp -motion_blur_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -motion_blur_example_DEPENDENCIES = $(EXAMPLE_DEPS) -motion_blur_example_LDADD = $(EXAMPLE_LDADD) - -motion_stretch_example_SOURCES = $(examples_src_dir)/motion/motion-stretch-example.cpp -motion_stretch_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -motion_stretch_example_DEPENDENCIES = $(EXAMPLE_DEPS) -motion_stretch_example_LDADD = $(EXAMPLE_LDADD) - -new_window_example_SOURCES = $(examples_src_dir)/new-window/new-window-example.cpp -new_window_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -new_window_example_DEPENDENCIES = $(EXAMPLE_DEPS) -new_window_example_LDADD = $(EXAMPLE_LDADD) - -page_turn_view_example_SOURCES = $(examples_src_dir)/page-turn-view/page-turn-view-example.cpp -page_turn_view_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -page_turn_view_example_DEPENDENCIES = $(EXAMPLE_DEPS) -page_turn_view_example_LDADD = $(EXAMPLE_LDADD) - -radial_menu_example_SOURCES = $(examples_src_dir)/radial-menu/radial-menu-example.cpp \ - $(examples_src_dir)/radial-menu/radial-sweep-view.cpp \ - $(examples_src_dir)/radial-menu/radial-sweep-view-impl.cpp -radial_menu_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -radial_menu_example_DEPENDENCIES = $(EXAMPLE_DEPS) -radial_menu_example_LDADD = $(EXAMPLE_LDADD) - -refraction_effect_example_SOURCES = $(examples_src_dir)/shader-effect/refraction-effect-example.cpp -refraction_effect_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -refraction_effect_example_DEPENDENCIES = $(EXAMPLE_DEPS) -refraction_effect_example_LDADD = $(EXAMPLE_LDADD) - -scroll_view_example_SOURCES = $(examples_src_dir)/scroll-view/scroll-view-example.cpp -scroll_view_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -scroll_view_example_DEPENDENCIES = $(EXAMPLE_DEPS) -scroll_view_example_LDADD = $(EXAMPLE_LDADD) - -shadow_bone_lighting_example_SOURCES = $(examples_src_dir)/shadows/shadow-bone-lighting-example.cpp -shadow_bone_lighting_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -shadow_bone_lighting_example_DEPENDENCIES = $(EXAMPLE_DEPS) -shadow_bone_lighting_example_LDADD = $(EXAMPLE_LDADD) - -dali_builder_SOURCES = $(examples_src_dir)/builder/dali-builder.cpp -dali_builder_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -dali_builder_DEPENDENCIES = $(EXAMPLE_DEPS) -dali_builder_LDADD = $(EXAMPLE_LDADD) - -builder_example_SOURCES = $(examples_src_dir)/builder/examples.cpp -builder_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -builder_example_DEPENDENCIES = $(EXAMPLE_DEPS) -builder_example_LDADD = $(EXAMPLE_LDADD) - -image_scaling_irregular_grid_example_SOURCES = $(examples_src_dir)/image/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp -image_scaling_irregular_grid_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -image_scaling_irregular_grid_example_DEPENDENCIES = $(EXAMPLE_DEPS) -image_scaling_irregular_grid_example_LDADD = $(EXAMPLE_LDADD) - -buttons_example_SOURCES = $(examples_src_dir)/buttons/buttons-example.cpp -buttons_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -buttons_example_DEPENDENCIES = $(EXAMPLE_DEPS) -buttons_example_LDADD = $(EXAMPLE_LDADD) - -text_view_example_SOURCES = $(examples_src_dir)/text-view/text-view-example.cpp -text_view_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -text_view_example_DEPENDENCIES = $(EXAMPLE_DEPS) -text_view_example_LDADD = $(EXAMPLE_LDADD) - -logging_example_SOURCES = $(examples_src_dir)/logging/logging-example.cpp -logging_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) -logging_example_DEPENDENCIES = $(EXAMPLE_DEPS) -logging_example_LDADD = $(EXAMPLE_LDADD) diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index 8ecf31b..b0376ec 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -63,7 +63,7 @@ const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap const float EFFECT_FLICK_DURATION = 0.5f; ///< Scroll Flick Duration for Effects const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f); -const int NUM_BACKGROUND_IMAGES = 20; +const int NUM_BACKGROUND_IMAGES = 18; const float BACKGROUND_SWIPE_SCALE = 0.025f; const float BACKGROUND_SPREAD_SCALE = 1.5f; const float SCALE_MOD = 1000.0f * Math::PI * 2.0f; @@ -120,7 +120,7 @@ TextStyle GetTableTextStyle() */ ImageActor CreateBackground( std::string imagePath ) { - Image image = Image::New( imagePath ); + Image image = ResourceImage::New( imagePath ); ImageActor background = ImageActor::New( image ); background.SetAnchorPoint( AnchorPoint::CENTER ); @@ -137,90 +137,40 @@ const float IMAGE_BORDER_TOP = IMAGE_BORDER_LEFT; const float IMAGE_BORDER_BOTTOM = IMAGE_BORDER_LEFT; /** - * TableViewVisibilityConstraint + * Constraint to return a position for a bubble based on the scroll value and vertical wrapping. */ -struct TableViewVisibilityConstraint -{ - bool operator()( const bool& current, - const PropertyInput& pagePositionProperty, - const PropertyInput& pageSizeProperty ) - { - // Only the tableview in the current page should be visible. - const Vector3& pagePosition = pagePositionProperty.GetVector3(); - const Vector3& pageSize = pageSizeProperty.GetVector3(); - return fabsf( pagePosition.x ) < pageSize.x; - } -}; - -/** - * Constraint to wrap an actor in y that is moving vertically - */ -Vector3 ShapeMovementConstraint( const Vector3& current, - const PropertyInput& shapeSizeProperty, - const PropertyInput& parentSizeProperty ) -{ - const Vector3& shapeSize = shapeSizeProperty.GetVector3(); - const Vector3& parentSize = parentSizeProperty.GetVector3(); - - Vector3 pos( current ); - if( pos.y + shapeSize.y * 0.5f < -parentSize.y * 0.5f ) - { - pos.y += parentSize.y + shapeSize.y; - } - - return pos; -} - -/** - * Constraint to return a position for the background based on the scroll value - */ -struct AnimScrollConstraint +struct AnimateBubbleConstraint { public: - - AnimScrollConstraint( const Vector3& initialPos, float scale ) - : mInitialPos( initialPos ), - mScale( scale ) - { - - } - - Vector3 operator()( const Vector3& current, const PropertyInput& scrollProperty ) + AnimateBubbleConstraint( const Vector3& initialPos, float scale, float size ) + : mInitialX( initialPos.x ), + mScale( scale ), + mShapeSize( size ) { - float scrollPos = scrollProperty.GetVector3().x; - - return mInitialPos + Vector3( -scrollPos * mScale, 0.0f, 0.0f ); } -private: - Vector3 mInitialPos; - float mScale; -}; - -/** - * Constraint to return a tracked world position added to the constant local position - */ -struct TranslateLocalConstraint -{ -public: - - TranslateLocalConstraint( const Vector3& localPos ) - : mLocalPos( localPos ) + Vector3 operator()( const Vector3& current, const PropertyInput& scrollProperty, const PropertyInput& parentSize ) { - } + Vector3 pos( current ); - Vector3 operator()( const Vector3& current, const PropertyInput& pagePosProperty ) - { - Vector3 worldPos = pagePosProperty.GetVector3(); + // Wrap bubbles verically. + if( pos.y + mShapeSize * 0.5f < -parentSize.GetVector3().y * 0.5f ) + { + pos.y += parentSize.GetVector3().y + mShapeSize; + } - return ( worldPos + mLocalPos ); + // Bubbles X position moves parallax to horizontal + // panning by a scale factor unique to each bubble. + pos.x = mInitialX + ( scrollProperty.GetVector3().x * mScale ); + return pos; } private: - Vector3 mLocalPos; + float mInitialX; + float mScale; + float mShapeSize; }; - bool CompareByTitle( const Example& lhs, const Example& rhs ) { return lhs.title < rhs.title; @@ -308,8 +258,9 @@ void DaliTableView::Initialize( Application& application ) mScrollView.SetAnchorPoint( AnchorPoint::CENTER ); mScrollView.SetParentOrigin( ParentOrigin::CENTER ); - mScrollView.ApplyConstraint( Dali::Constraint::New( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ), - Dali::RelativeToConstraint( SCROLLVIEW_RELATIVE_SIZE ) ) ); + // Note: Currently, changing mScrollView to use SizeMode RELATIVE_TO_PARENT + // will cause scroll ends to appear in the wrong position. + mScrollView.ApplyConstraint( Dali::Constraint::New( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ), Dali::RelativeToConstraint( SCROLLVIEW_RELATIVE_SIZE ) ) ); mScrollView.SetAxisAutoLock( true ); mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete ); mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart ); @@ -406,7 +357,7 @@ void DaliTableView::Populate() page.SetAnchorPoint( AnchorPoint::CENTER ); page.SetParentOrigin( ParentOrigin::CENTER ); - page.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + page.SetSizeMode( SIZE_EQUAL_TO_PARENT ); // add cells to table const float margin = 4.0f; @@ -507,31 +458,24 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit tile.SetAnchorPoint( AnchorPoint::CENTER ); tile.SetParentOrigin( ParentOrigin::CENTER ); - Actor content = Actor::New(); - content.SetAnchorPoint( AnchorPoint::CENTER ); - content.SetParentOrigin( ParentOrigin::CENTER ); - content.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); - tile.Add(content); - // create background image if( addBackground ) { - Image bg = Image::New( TILE_BACKGROUND ); + Image bg = ResourceImage::New( TILE_BACKGROUND ); ImageActor image = ImageActor::New( bg ); image.SetAnchorPoint( AnchorPoint::CENTER ); image.SetParentOrigin( ParentOrigin::CENTER ); // make the image 100% of tile - image.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + image.SetSizeMode( SIZE_EQUAL_TO_PARENT ); // move image back to get text appear in front image.SetZ( -1 ); image.SetStyle( ImageActor::STYLE_NINE_PATCH ); image.SetNinePatchBorder( Vector4( IMAGE_BORDER_LEFT, IMAGE_BORDER_TOP, IMAGE_BORDER_RIGHT, IMAGE_BORDER_BOTTOM ) ); - - content.Add( image ); + tile.Add( image ); // Add stencil ImageActor stencil = NewStencilImage(); - stencil.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + stencil.SetSizeMode( SIZE_EQUAL_TO_PARENT ); image.Add( stencil ); } @@ -548,7 +492,7 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit text.SetSize( 0.9f * parentSize.width, 0.9f * parentSize.height ); text.SetStyleToCurrentText( GetTableTextStyle() ); text.SetSnapshotModeEnabled( false ); - content.Add( text ); + tile.Add( text ); // Set the tile to be keyboard focusable tile.SetKeyboardFocusable(true); @@ -562,7 +506,7 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit ImageActor DaliTableView::NewStencilImage() { - Image alpha = Image::New( TILE_BACKGROUND_ALPHA ); + Image alpha = ResourceImage::New( TILE_BACKGROUND_ALPHA ); ImageActor stencilActor = ImageActor::New( alpha ); stencilActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); @@ -738,61 +682,25 @@ void DaliTableView::OnKeyEvent( const KeyEvent& event ) } } -Actor CreateBackgroundActor( const Vector2& size ) -{ - Actor layer = Actor::New(); - layer.SetAnchorPoint( AnchorPoint::CENTER ); - layer.SetParentOrigin( ParentOrigin::CENTER ); - layer.SetSize( size ); - return layer; -} - -void DaliTableView::SetupBackground( Actor bubbleLayer, Actor backgroundLayer, const Vector2& size ) +void DaliTableView::SetupBackground( Actor bubbleContainer, Actor backgroundLayer, const Vector2& size ) { - // Create distance field shape + // Create distance field shape. BitmapImage distanceField; Size imageSize( 512, 512 ); CreateShapeImage( CIRCLE, imageSize, distanceField ); - // Create layers - Actor backgroundAnimLayer0 = CreateBackgroundActor( size ); - Actor backgroundAnimLayer1 = CreateBackgroundActor( size ); - Actor backgroundAnimLayer2 = CreateBackgroundActor( size ); - - // Add constraints - Constraint animConstraint0 = Constraint::New < Vector3 > ( Actor::POSITION, - Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), - AnimScrollConstraint( backgroundAnimLayer0.GetCurrentPosition(), 0.75f ) ); - backgroundAnimLayer0.ApplyConstraint( animConstraint0 ); - - Constraint animConstraint1 = Constraint::New < Vector3 > ( Actor::POSITION, - Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), - AnimScrollConstraint( backgroundAnimLayer1.GetCurrentPosition(), 0.5f ) ); - backgroundAnimLayer1.ApplyConstraint( animConstraint1 ); - - Constraint animConstraint2 = Constraint::New < Vector3 > ( Actor::POSITION, - Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), - AnimScrollConstraint( backgroundAnimLayer2.GetCurrentPosition(), 0.25f ) ); - backgroundAnimLayer2.ApplyConstraint( animConstraint2 ); + // Create solid background colour. + ImageActor backgroundColourActor = Dali::Toolkit::CreateSolidColorActor( BACKGROUND_COLOR ); + backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER ); + backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER ); + backgroundColourActor.SetSize( size * BACKGROUND_SIZE_SCALE ); + backgroundColourActor.SetZ( BACKGROUND_Z ); + backgroundColourActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION ); + backgroundLayer.Add( backgroundColourActor ); - // Background - ImageActor layer = Dali::Toolkit::CreateSolidColorActor( BACKGROUND_COLOR ); - layer.SetAnchorPoint( AnchorPoint::CENTER ); - layer.SetParentOrigin( ParentOrigin::CENTER ); - layer.SetSize( size * BACKGROUND_SIZE_SCALE ); - layer.SetZ( BACKGROUND_Z ); - layer.SetPositionInheritanceMode( DONT_INHERIT_POSITION ); - backgroundLayer.Add( layer ); - - // Parent the layers - bubbleLayer.Add( backgroundAnimLayer0 ); - bubbleLayer.Add( backgroundAnimLayer1 ); - bubbleLayer.Add( backgroundAnimLayer2 ); - - // Add all the children - AddBackgroundActors( backgroundAnimLayer0, NUM_BACKGROUND_IMAGES / 3, distanceField, size ); - AddBackgroundActors( backgroundAnimLayer1, NUM_BACKGROUND_IMAGES / 3, distanceField, size ); - AddBackgroundActors( backgroundAnimLayer2, NUM_BACKGROUND_IMAGES / 3, distanceField, size ); + // Add bubbles to the bubbleContainer. + // Note: The bubbleContainer is parented externally to this function. + AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField, size ); } void DaliTableView::AddBackgroundActors( Actor layer, int count, BitmapImage distanceField, const Dali::Vector2& size ) @@ -822,11 +730,12 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BitmapImage dis Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) ); dfActor.SetPosition( actorPos ); - Constraint movementConstraint = Constraint::New < Vector3 > ( Actor::POSITION, - LocalSource( Actor::SIZE ), - ParentSource( Actor::SIZE ), - ShapeMovementConstraint ); - dfActor.ApplyConstraint( movementConstraint ); + // Define bubble horizontal parallax and vertical wrapping + Constraint animConstraint = Constraint::New < Vector3 > ( Actor::POSITION, + Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), + Dali::ParentSource( Dali::Actor::SIZE ), + AnimateBubbleConstraint( actorPos, Random::Range( -0.85f, 0.25f ), randSize ) ); + dfActor.ApplyConstraint( animConstraint ); // Kickoff animation Animation animation = Animation::New( Random::Range( 40.0f, 200.0f ) ); @@ -908,7 +817,7 @@ void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char ImageActor DaliTableView::CreateLogo( std::string imagePath ) { - Image image = Image::New( imagePath ); + Image image = ResourceImage::New( imagePath ); ImageActor logo = ImageActor::New( image ); logo.SetAnchorPoint( AnchorPoint::CENTER ); diff --git a/demo/scripts/table-view.json b/demo/scripts/table-view.json index 1be3c9d..85940fa 100644 --- a/demo/scripts/table-view.json +++ b/demo/scripts/table-view.json @@ -25,7 +25,6 @@ "rows": 4, "columns":4, "cell-padding": [10, 5], - "layout-animation-duration": 0.5, "layout-rows": { // set the height of the rows "0": { "policy": "fixed", "value": 40 }, "1": { "policy": "relative", "value": 0.33 }, diff --git a/examples/blocks/blocks-example.cpp b/examples/blocks/blocks-example.cpp index 18ed966..e984286 100644 --- a/examples/blocks/blocks-example.cpp +++ b/examples/blocks/blocks-example.cpp @@ -423,7 +423,7 @@ private: mLevelContainer = Actor::New(); mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER ); mLevelContainer.SetParentOrigin( ParentOrigin::CENTER ); - mLevelContainer.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mLevelContainer.SetSizeMode( SIZE_EQUAL_TO_PARENT ); mContentLayer.Add( mLevelContainer ); mBrickCount = 0; @@ -591,7 +591,7 @@ private: ImageAttributes attr; attr.SetSize( 128, 64 ); attr.SetScalingMode( ImageAttributes::ScaleToFill ); - Image img = Image::New(BRICK_IMAGE_PATH[type], attr); + Image img = ResourceImage::New(BRICK_IMAGE_PATH[type], attr); ImageActor brick = ImageActor::New(img); brick.SetParentOrigin(ParentOrigin::TOP_LEFT); brick.SetAnchorPoint(AnchorPoint::CENTER); @@ -623,7 +623,7 @@ private: */ ImageActor CreateImage(const std::string& filename) { - Image img = Image::New(filename); + Image img = ResourceImage::New(filename); ImageActor actor = ImageActor::New(img); actor.SetParentOrigin(ParentOrigin::TOP_LEFT); actor.SetAnchorPoint(AnchorPoint::CENTER); diff --git a/examples/builder/dali-builder.cpp b/examples/builder/dali-builder.cpp index 9c97fec..9f70d71 100644 --- a/examples/builder/dali-builder.cpp +++ b/examples/builder/dali-builder.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/builder/examples.cpp b/examples/builder/examples.cpp index 0e26bdf..e93a072 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -33,6 +33,7 @@ #include #include #include +#include //#include #include "sys/stat.h" @@ -532,7 +533,7 @@ public: // Create an edit mode button. (left of toolbar) Toolkit::PushButton editButton = Toolkit::PushButton::New(); - editButton.SetBackgroundImage( Image::New( EDIT_IMAGE ) ); + editButton.SetBackgroundImage( ResourceImage::New( EDIT_IMAGE ) ); editButton.ClickedSignal().Connect( this, &ExampleApp::OnToolSelectLayout); editButton.SetLeaveRequired( true ); mToolBar.AddControl( editButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); diff --git a/examples/buttons/buttons-example.cpp b/examples/buttons/buttons-example.cpp index 770a91d..45ef040 100644 --- a/examples/buttons/buttons-example.cpp +++ b/examples/buttons/buttons-example.cpp @@ -142,7 +142,7 @@ class ButtonsController: public ConnectionTracker // Radio 1 { - ImageActor imageActor = ImageActor::New( Image::New( SMALL_IMAGE_1 ) ); + ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_1 ) ); imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); mRadioButtonImage1 = Dali::Toolkit::RadioButton::New( imageActor ); mRadioButtonImage1.SetParentOrigin( ParentOrigin::TOP_LEFT ); @@ -157,7 +157,7 @@ class ButtonsController: public ConnectionTracker { radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING; - ImageActor imageActor = ImageActor::New( Image::New( SMALL_IMAGE_2 ) ); + ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_2 ) ); imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); mRadioButtonImage2 = Dali::Toolkit::RadioButton::New( imageActor ); @@ -172,7 +172,7 @@ class ButtonsController: public ConnectionTracker { radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING; - ImageActor imageActor = ImageActor::New( Image::New( SMALL_IMAGE_3 ) ); + ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_3 ) ); imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); mRadioButtonImage3 = Dali::Toolkit::RadioButton::New( imageActor ); @@ -191,18 +191,18 @@ class ButtonsController: public ConnectionTracker mUpdateButton.SetLabel("Select"); mUpdateButton.SetSize( DP(100), DP(BUTTON_HEIGHT) ); - mUpdateButton.SetSelectedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); - mUpdateButton.SetDisabledImage( Dali::Image::New( PUSHBUTTON_DISABLED_IMAGE ) ); - mUpdateButton.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); + mUpdateButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); + mUpdateButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); + mUpdateButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); mUpdateButton.ClickedSignal().Connect( this, &ButtonsController::OnButtonClicked ); radioButtonsGroup2.Add(mUpdateButton); // ImageActor to display selected image - mBigImage1 = Image::New( BIG_IMAGE_1 ); - mBigImage2 = Image::New( BIG_IMAGE_2 ); - mBigImage3 = Image::New( BIG_IMAGE_3 ); + mBigImage1 = ResourceImage::New( BIG_IMAGE_1 ); + mBigImage2 = ResourceImage::New( BIG_IMAGE_2 ); + mBigImage3 = ResourceImage::New( BIG_IMAGE_3 ); mImage = ImageActor::New( mBigImage1 ); mImage.SetParentOrigin( ParentOrigin::TOP_RIGHT ); @@ -239,7 +239,7 @@ class ButtonsController: public ConnectionTracker alignment.Add( textView ); tableView.AddChild( alignment, Toolkit::TableView::CellPosition( 0, 0 ) ); - ImageActor imageActor = ImageActor::New( Image::New( ENABLED_IMAGE ) ); + ImageActor imageActor = ImageActor::New( ResourceImage::New( ENABLED_IMAGE ) ); imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); tableView.AddChild( imageActor, Toolkit::TableView::CellPosition( 0, 1 ) ); tableView.SetFixedWidth( 1, DP(RADIO_LABEL_THUMBNAIL_SIZE) ); @@ -279,8 +279,8 @@ class ButtonsController: public ConnectionTracker checkBoxBackground.SetSize( DP(430), DP(GROUP3_HEIGHT) ); mContentLayer.Add( checkBoxBackground ); - Dali::Image unselected = Dali::Image::New( CHECKBOX_UNSELECTED_IMAGE ); - Dali::Image selected = Dali::Image::New( CHECKBOX_SELECTED_IMAGE ); + Dali::Image unselected = Dali::ResourceImage::New( CHECKBOX_UNSELECTED_IMAGE ); + Dali::Image selected = Dali::ResourceImage::New( CHECKBOX_SELECTED_IMAGE ); int checkYPos = MARGIN_SIZE; @@ -368,9 +368,9 @@ class ButtonsController: public ConnectionTracker toggleButton.SetLabel( "Unselected" ); toggleButton.SetSize( DP(150), DP(BUTTON_HEIGHT) ); - toggleButton.SetSelectedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); - toggleButton.SetDisabledImage( Dali::Image::New( PUSHBUTTON_DISABLED_IMAGE ) ); - toggleButton.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); + toggleButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); + toggleButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); + toggleButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); toggleButton.StateChangedSignal().Connect( this, &ButtonsController::OnButtonSelected ); diff --git a/examples/cluster/cluster-example.cpp b/examples/cluster/cluster-example.cpp index 91921f8..825ed80 100644 --- a/examples/cluster/cluster-example.cpp +++ b/examples/cluster/cluster-example.cpp @@ -199,33 +199,6 @@ struct CarouselEffectOrientationConstraint }; /** - * RescaleConstraint - * Rescales the inputer scale by the ratio of the height:width of it's parent. - */ -struct RescaleConstraint -{ - /** - * Constructor - * @param[in] value0 Constant multiplication operand (K). - */ - RescaleConstraint() - { - } - - /** - * @param[in] current The object's current property value - * @param[in] property0 The first property to multiplication operand - * @return The object's new property value - */ - Vector3 operator()(const Vector3& current, - const PropertyInput& property0) - { - return current * Vector3( property0.GetVector3().y / property0.GetVector3().x, 1.0f, 1.0f ); - } - -}; - -/** * ShearEffectConstraint * * Constrains ShearEffect's tilt to be a function of scrollview's @@ -493,10 +466,10 @@ public: "" ); // Create a effect toggle button. (right of toolbar) - mLayoutButtonImages[ NO_EFFECT ] = Image::New( LAYOUT_NONE_IMAGE ); - mLayoutButtonImages[ WOBBLE_EFFECT ] = Image::New( LAYOUT_WOBBLE_IMAGE ); - mLayoutButtonImages[ CAROUSEL_EFFECT ] = Image::New( LAYOUT_CAROUSEL_IMAGE ); - mLayoutButtonImages[ SPHERE_EFFECT ] = Image::New( LAYOUT_SPHERE_IMAGE ); + mLayoutButtonImages[ NO_EFFECT ] = ResourceImage::New( LAYOUT_NONE_IMAGE ); + mLayoutButtonImages[ WOBBLE_EFFECT ] = ResourceImage::New( LAYOUT_WOBBLE_IMAGE ); + mLayoutButtonImages[ CAROUSEL_EFFECT ] = ResourceImage::New( LAYOUT_CAROUSEL_IMAGE ); + mLayoutButtonImages[ SPHERE_EFFECT ] = ResourceImage::New( LAYOUT_SPHERE_IMAGE ); mLayoutButton = Toolkit::PushButton::New(); mLayoutButton.ClickedSignal().Connect( this, &ClusterController::OnEffectTouched ); @@ -514,18 +487,14 @@ public: mScrollView.SetAnchorPoint(AnchorPoint::CENTER); mScrollView.SetParentOrigin(ParentOrigin::CENTER); - // Scale ScrollView to fit within parent (mContentLayer) - Constraint constraint = Constraint::New( Actor::SCALE, - LocalSource( Actor::SIZE ), - ParentSource( Actor::SIZE ), - ScaleToFitConstraint() ); - mScrollView.ApplyConstraint(constraint); + // Scale ScrollView to fit parent (mContentLayer) + mScrollView.SetSizeMode( SIZE_EQUAL_TO_PARENT ); // Add the scroll view to the content layer mContentLayer.Add(mScrollView); // Create the image border shared by all the cluster image actors - mClusterBorderImage = Image::New(CLUSTER_BORDER_IMAGE_PATH); + mClusterBorderImage = ResourceImage::New(CLUSTER_BORDER_IMAGE_PATH); AddCluster( PEOPLE, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1) ); AddCluster( TODAY, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle2) ); @@ -556,7 +525,7 @@ public: DALI_ASSERT_ALWAYS(paths); // Add a background image to the cluster - Image bg = Image::New( CLUSTER_BACKGROUND_IMAGE_PATH ); + Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH ); ImageActor image = ImageActor::New(bg); clusterActor.SetBackgroundImage(image); @@ -587,10 +556,9 @@ public: ImageAttributes attribs = ImageAttributes::New(); attribs.SetSize(CLUSTER_IMAGE_THUMBNAIL_WIDTH, CLUSTER_IMAGE_THUMBNAIL_HEIGHT); attribs.SetScalingMode(Dali::ImageAttributes::ShrinkToFit); - attribs.SetPixelFormat( Pixel::RGB888 ); // Add a shadow image child actor - Image shadowImage = Image::New( CLUSTER_SHADOW_IMAGE_PATH, attribs ); + Image shadowImage = ResourceImage::New( CLUSTER_SHADOW_IMAGE_PATH, attribs ); ImageActor shadowActor = ImageActor::New(shadowImage); // Shadow is not exactly located on the center of the image, so it is moved to a little @@ -605,7 +573,7 @@ public: actor.Add( shadowActor ); // Add a picture image actor to actor (with equal size to the parent). - Image image = Image::New( imagePath, attribs ); + Image image = ResourceImage::New( imagePath, attribs ); ImageActor imageActor = ImageActor::New( image ); imageActor.SetParentOrigin( ParentOrigin::CENTER ); imageActor.SetAnchorPoint( AnchorPoint::CENTER ); @@ -649,14 +617,7 @@ public: mScrollView.Add(pageView); pageView.SetParentOrigin(ParentOrigin::CENTER); pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); - pageView.SetSize(stageSize); - - // Resize pageView (which contains a Cluster) - Constraint constraintScale = Constraint::New( Actor::SCALE, - ParentSource( Actor::SCALE ), - RescaleConstraint() ); - constraintScale.SetRemoveAction(Constraint::Discard); - pageView.ApplyConstraint(constraintScale); + pageView.SetSizeMode( SIZE_EQUAL_TO_PARENT ); // Create cluster actors, add them to scroll view, and set the shear effect with the given center point. Cluster cluster = CreateClusterActor(clusterType, style); diff --git a/examples/hello-world/hello-world-example.cpp b/examples/hello-world/hello-world-example.cpp index f018779..d441dcc 100644 --- a/examples/hello-world/hello-world-example.cpp +++ b/examples/hello-world/hello-world-example.cpp @@ -16,6 +16,7 @@ */ #include +#include using namespace Dali; diff --git a/examples/image/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp b/examples/image/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp index 13e4c26..cdc3e6b 100644 --- a/examples/image/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp +++ b/examples/image/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp @@ -45,6 +45,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include "grid-flags.h" @@ -182,7 +183,7 @@ Image CreateImage(const std::string& filename, unsigned int width, unsigned int attributes.SetSize( width, height ); attributes.SetScalingMode( scalingMode ); - Image image = Image::New( filename, attributes ); + Image image = ResourceImage::New( filename, attributes ); return image; } @@ -307,7 +308,7 @@ public: "" ); // Create an image scaling toggle button. (right of toolbar) - Image toggleScalingImage = Image::New( TOGGLE_SCALING_IMAGE ); + Image toggleScalingImage = ResourceImage::New( TOGGLE_SCALING_IMAGE ); Toolkit::PushButton toggleScalingButton = Toolkit::PushButton::New(); toggleScalingButton.SetBackgroundImage( toggleScalingImage ); toggleScalingButton.ClickedSignal().Connect( this, &ImageScalingIrregularGridController::OnToggleScalingTouched ); @@ -416,7 +417,7 @@ public: // coordinates in a frame defined by a parent actor: Actor gridActor = Actor::New(); - gridActor.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + gridActor.SetSizeMode( SIZE_EQUAL_TO_PARENT ); gridActor.SetParentOrigin( ParentOrigin::CENTER ); gridActor.SetAnchorPoint( AnchorPoint::CENTER ); @@ -472,7 +473,7 @@ public: ImageActor imageActor = ImageActor::DownCast( actor ); Image oldImage = imageActor.GetImage(); - Image newImage = CreateImage( oldImage.GetFilename(), imageSize.width + 0.5f, imageSize.height + 0.5f, newMode ); + Image newImage = CreateImage( ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width + 0.5f, imageSize.height + 0.5f, newMode ); imageActor.SetImage( newImage ); mScalingModes[id] = newMode; } @@ -514,7 +515,7 @@ public: const Vector2 imageSize = mSizes[gridImageActor.GetId()]; ImageAttributes::ScalingMode newMode = NextMode( mScalingModes[gridImageActor.GetId()] ); Image oldImage = gridImageActor.GetImage(); - Image newImage = CreateImage( oldImage.GetFilename(), imageSize.width, imageSize.height, newMode ); + Image newImage = CreateImage(ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width, imageSize.height, newMode ); gridImageActor.SetImage( newImage ); mScalingModes[gridImageActor.GetId()] = newMode; diff --git a/examples/item-view/item-view-example.cpp b/examples/item-view/item-view-example.cpp index b006c5f..00da668 100644 --- a/examples/item-view/item-view-example.cpp +++ b/examples/item-view/item-view-example.cpp @@ -164,15 +164,6 @@ const Vector4 DEFAULT_TEXT_STYLE_COLOR(1.0f, 1.0f, 1.0f, 1.0f); const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f ); -struct BorderSizeConstraintFunction -{ - Vector3 operator()(const Vector3& current, - const PropertyInput& parentSize) - { - return parentSize.GetVector3() + ITEM_BORDER_MARGIN_SIZE; - } -}; - static Vector3 DepthLayoutItemSizeFunctionPortrait(unsigned int numberOfColumns, float layoutWidth) { float width = (layoutWidth / static_cast(numberOfColumns + 1)) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT; @@ -251,7 +242,7 @@ public: Vector2 stageSize = Stage::GetCurrent().GetSize(); // Create a border image shared by all the item actors - mBorderImage = Image::New(ITEM_BORDER_IMAGE_PATH); + mBorderImage = ResourceImage::New(ITEM_BORDER_IMAGE_PATH); // Creates a default view with a default tool bar. // The view is added to the stage. @@ -266,14 +257,14 @@ public: // Create an edit mode button. (left of toolbar) Toolkit::PushButton editButton = Toolkit::PushButton::New(); - editButton.SetBackgroundImage( Image::New( EDIT_IMAGE ) ); + editButton.SetBackgroundImage( ResourceImage::New( EDIT_IMAGE ) ); editButton.ClickedSignal().Connect( this, &ItemViewExample::OnModeButtonClicked); editButton.SetLeaveRequired( true ); mToolBar.AddControl( editButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); // Create a layout toggle button. (right of toolbar) mLayoutButton = Toolkit::PushButton::New(); - mLayoutButton.SetBackgroundImage( Image::New( SPIRAL_LAYOUT_IMAGE ) ); + mLayoutButton.SetBackgroundImage( ResourceImage::New( SPIRAL_LAYOUT_IMAGE ) ); mLayoutButton.ClickedSignal().Connect( this, &ItemViewExample::OnLayoutButtonClicked); mLayoutButton.SetLeaveRequired( true ); mToolBar.AddControl( mLayoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -284,8 +275,8 @@ public: mDeleteButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); mDeleteButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); mDeleteButton.SetDrawMode( DrawMode::OVERLAY ); - mDeleteButton.SetBackgroundImage( Image::New( TOOLBAR_IMAGE ) ); - mDeleteButton.SetButtonImage( Image::New( DELETE_IMAGE ) ); + mDeleteButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); + mDeleteButton.SetButtonImage( ResourceImage::New( DELETE_IMAGE ) ); mDeleteButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked); mDeleteButton.SetLeaveRequired( true ); @@ -298,8 +289,8 @@ public: mInsertButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); mInsertButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); mInsertButton.SetDrawMode( DrawMode::OVERLAY ); - mInsertButton.SetBackgroundImage( Image::New( TOOLBAR_IMAGE ) ); - mInsertButton.SetButtonImage( Image::New( INSERT_IMAGE ) ); + mInsertButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); + mInsertButton.SetButtonImage( ResourceImage::New( INSERT_IMAGE ) ); mInsertButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked); mInsertButton.SetLeaveRequired( true ); @@ -312,8 +303,8 @@ public: mReplaceButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); mReplaceButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); mReplaceButton.SetDrawMode( DrawMode::OVERLAY ); - mReplaceButton.SetBackgroundImage( Image::New( TOOLBAR_IMAGE ) ); - mReplaceButton.SetButtonImage( Image::New( REPLACE_IMAGE ) ); + mReplaceButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); + mReplaceButton.SetButtonImage( ResourceImage::New( REPLACE_IMAGE ) ); mReplaceButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked); mReplaceButton.SetLeaveRequired( true ); @@ -844,19 +835,19 @@ public: { case SPIRAL_LAYOUT: { - mLayoutButton.SetBackgroundImage( Image::New( SPIRAL_LAYOUT_IMAGE ) ); + mLayoutButton.SetBackgroundImage( ResourceImage::New( SPIRAL_LAYOUT_IMAGE ) ); break; } case GRID_LAYOUT: { - mLayoutButton.SetBackgroundImage( Image::New( GRID_LAYOUT_IMAGE ) ); + mLayoutButton.SetBackgroundImage( ResourceImage::New( GRID_LAYOUT_IMAGE ) ); break; } case DEPTH_LAYOUT: { - mLayoutButton.SetBackgroundImage( Image::New( DEPTH_LAYOUT_IMAGE ) ); + mLayoutButton.SetBackgroundImage( ResourceImage::New( DEPTH_LAYOUT_IMAGE ) ); break; } @@ -885,7 +876,7 @@ public: // From ItemFactory virtual Actor NewItem(unsigned int itemId) { // Create an image actor for this item - Image image = Image::New( IMAGE_PATHS[itemId % NUM_IMAGES] ); + Image image = ResourceImage::New( IMAGE_PATHS[itemId % NUM_IMAGES] ); Actor actor = ImageActor::New(image); actor.SetPosition( INITIAL_OFFSCREEN_POSITION ); @@ -897,9 +888,8 @@ public: // From ItemFactory borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); borderActor.SetNinePatchBorder( Vector4( ITEM_IMAGE_BORDER_LEFT, ITEM_IMAGE_BORDER_TOP, ITEM_IMAGE_BORDER_RIGHT, ITEM_IMAGE_BORDER_BOTTOM ) ); borderActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); // darken with parent image-actor - - Constraint constraint = Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), BorderSizeConstraintFunction() ); - borderActor.ApplyConstraint(constraint); + borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT ); + borderActor.SetSizeModeFactor( ITEM_BORDER_MARGIN_SIZE ); actor.Add(borderActor); actor.SetKeyboardFocusable( true ); @@ -924,7 +914,7 @@ public: // From ItemFactory } actor.Add( checkbox ); - ImageActor tick = ImageActor::New( Image::New(SELECTED_IMAGE) ); + ImageActor tick = ImageActor::New( ResourceImage::New(SELECTED_IMAGE) ); tick.SetColorMode( USE_OWN_COLOR ); tick.SetName( "Tick" ); tick.SetParentOrigin( ParentOrigin::TOP_RIGHT ); diff --git a/examples/logging/logging-example.cpp b/examples/logging/logging-example.cpp index 34eb7f5..2dc943f 100644 --- a/examples/logging/logging-example.cpp +++ b/examples/logging/logging-example.cpp @@ -286,9 +286,9 @@ class LoggingController: public ConnectionTracker button.SetPosition( buttonXDP, 0 ); button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); - button.SetSelectedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); - button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); - button.SetDisabledImage( Dali::Image::New( PUSHBUTTON_DISABLED_IMAGE ) ); + button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); + button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); + button.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -306,9 +306,9 @@ class LoggingController: public ConnectionTracker button.SetPosition( buttonXDP, 0 ); button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); - button.SetSelectedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); - button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); - button.SetDisabledImage( Dali::Image::New( PUSHBUTTON_DISABLED_IMAGE ) ); + button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); + button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); + button.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -337,9 +337,9 @@ class LoggingController: public ConnectionTracker button.SetPosition( buttonXDP, 0 ); button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); - button.SetSelectedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); - button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); - button.SetDisabledImage( Dali::Image::New( PUSHBUTTON_DISABLED_IMAGE ) ); + button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); + button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); + button.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -357,9 +357,9 @@ class LoggingController: public ConnectionTracker button.SetPosition( buttonXDP, 0 ); button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); - button.SetSelectedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); - button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); - button.SetDisabledImage( Dali::Image::New( PUSHBUTTON_DISABLED_IMAGE ) ); + button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); + button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); + button.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -388,9 +388,9 @@ class LoggingController: public ConnectionTracker button.SetPosition( buttonXDP, 0 ); button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); - button.SetSelectedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); - button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); - button.SetDisabledImage( Dali::Image::New( PUSHBUTTON_DISABLED_IMAGE ) ); + button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); + button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); + button.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -408,9 +408,9 @@ class LoggingController: public ConnectionTracker button.SetPosition( buttonXDP, 0 ); button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); - button.SetSelectedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); - button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); - button.SetDisabledImage( Dali::Image::New( PUSHBUTTON_DISABLED_IMAGE ) ); + button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); + button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); + button.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -520,9 +520,9 @@ class LoggingController: public ConnectionTracker button.SetPosition( buttonXDP, 0 ); button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); - button.SetSelectedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); - button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); - button.SetDisabledImage( Dali::Image::New( PUSHBUTTON_DISABLED_IMAGE ) ); + button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); + button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); + button.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); diff --git a/examples/motion/motion-blur-example.cpp b/examples/motion/motion-blur-example.cpp index 4100f44..98afa1a 100644 --- a/examples/motion/motion-blur-example.cpp +++ b/examples/motion/motion-blur-example.cpp @@ -149,8 +149,8 @@ public: APPLICATION_TITLE ); //Add an effects icon on the right of the title - mIconEffectsOff = Image::New( EFFECTS_OFF_ICON ); - mIconEffectsOn = Image::New( EFFECTS_ON_ICON ); + mIconEffectsOff = ResourceImage::New( EFFECTS_OFF_ICON ); + mIconEffectsOn = ResourceImage::New( EFFECTS_ON_ICON ); mActorEffectsButton = Toolkit::PushButton::New(); mActorEffectsButton.SetBackgroundImage( mIconEffectsOff ); mActorEffectsButton.ClickedSignal().Connect( this, &MotionBlurExampleApp::OnEffectButtonClicked ); @@ -158,7 +158,7 @@ public: // Creates a mode button. // Create a effect toggle button. (right of toolbar) - Image imageLayout = Image::New( LAYOUT_IMAGE ); + Image imageLayout = ResourceImage::New( LAYOUT_IMAGE ); Toolkit::PushButton layoutButton = Toolkit::PushButton::New(); layoutButton.SetBackgroundImage(imageLayout); layoutButton.ClickedSignal().Connect( this, &MotionBlurExampleApp::OnLayoutButtonClicked); @@ -187,7 +187,7 @@ public: // Motion blurred actor // - Image image = Image::New( MOTION_BLUR_ACTOR_IMAGE1 ); + Image image = ResourceImage::New( MOTION_BLUR_ACTOR_IMAGE1 ); mMotionBlurImageActor = ImageActor::New(image); mMotionBlurImageActor.SetParentOrigin( ParentOrigin::CENTER ); mMotionBlurImageActor.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT); @@ -478,7 +478,7 @@ public: mCurrentImage = 0; } - Image blurImage = Image::New( MOTION_BLUR_ACTOR_IMAGES[mCurrentImage] ); + Image blurImage = ResourceImage::New( MOTION_BLUR_ACTOR_IMAGES[mCurrentImage] ); mMotionBlurImageActor.SetImage(blurImage); } diff --git a/examples/motion/motion-stretch-example.cpp b/examples/motion/motion-stretch-example.cpp index db224ae..21e43c2 100644 --- a/examples/motion/motion-stretch-example.cpp +++ b/examples/motion/motion-stretch-example.cpp @@ -136,8 +136,8 @@ public: APPLICATION_TITLE ); //Add an slideshow icon on the right of the title - mIconEffectsOff = Image::New( EFFECTS_OFF_ICON ); - mIconEffectsOn = Image::New( EFFECTS_ON_ICON ); + mIconEffectsOff = ResourceImage::New( EFFECTS_OFF_ICON ); + mIconEffectsOn = ResourceImage::New( EFFECTS_ON_ICON ); mActorEffectsButton = Toolkit::PushButton::New(); mActorEffectsButton.SetBackgroundImage( mIconEffectsOff ); mActorEffectsButton.ClickedSignal().Connect( this, &MotionStretchExampleApp::OnEffectButtonClicked ); @@ -145,7 +145,7 @@ public: // Creates a mode button. // Create a effect toggle button. (right of toolbar) - Image imageLayout = Image::New( LAYOUT_IMAGE ); + Image imageLayout = ResourceImage::New( LAYOUT_IMAGE ); Toolkit::PushButton layoutButton = Toolkit::PushButton::New(); layoutButton.SetBackgroundImage(imageLayout); layoutButton.ClickedSignal().Connect( this, &MotionStretchExampleApp::OnLayoutButtonClicked); @@ -174,7 +174,7 @@ public: // Motion stretched actor // - Image image = Image::New( MOTION_STRETCH_ACTOR_IMAGE1 ); + Image image = ResourceImage::New( MOTION_STRETCH_ACTOR_IMAGE1 ); mMotionStretchImageActor = ImageActor::New(image); mMotionStretchImageActor.SetParentOrigin( ParentOrigin::CENTER ); mMotionStretchImageActor.SetAnchorPoint( AnchorPoint::CENTER ); @@ -390,7 +390,7 @@ public: mCurrentImage = 0; } - Image stretchImage = Image::New( MOTION_STRETCH_ACTOR_IMAGES[mCurrentImage] ); + Image stretchImage = ResourceImage::New( MOTION_STRETCH_ACTOR_IMAGES[mCurrentImage] ); mMotionStretchImageActor.SetImage(stretchImage); } diff --git a/examples/new-window/new-window-example.cpp b/examples/new-window/new-window-example.cpp index ff17e0f..a6f98c0 100644 --- a/examples/new-window/new-window-example.cpp +++ b/examples/new-window/new-window-example.cpp @@ -16,6 +16,8 @@ #include #include "../shared/view.h" +#include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -147,7 +149,7 @@ void NewWindowController::Create( Application& app ) } mLoseContextButton = Toolkit::PushButton::New(); - mLoseContextButton.SetBackgroundImage( Image::New( LOSE_CONTEXT_IMAGE ) ); + mLoseContextButton.SetBackgroundImage( ResourceImage::New( LOSE_CONTEXT_IMAGE ) ); mLoseContextButton.ClickedSignal().Connect( this, &NewWindowController::OnLoseContextButtonClicked ); mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -158,7 +160,7 @@ void NewWindowController::Create( Application& app ) logoLayoutActor.SetScale(0.5f); mContentLayer.Add(logoLayoutActor); - Image image = Image::New(DALI_IMAGE_DIR "dali-logo.png"); + Image image = ResourceImage::New(DALI_IMAGE_DIR "dali-logo.png"); mImageActor = ImageActor::New(image); mImageActor.SetName("dali-logo"); mImageActor.SetParentOrigin(ParentOrigin::CENTER); @@ -194,7 +196,7 @@ bool NewWindowController::OnLoseContextButtonClicked( Toolkit::Button button ) void NewWindowController::CreateMeshActor() { - mEffectImage = Image::New(EFFECT_IMAGE); + mEffectImage = ResourceImage::New(EFFECT_IMAGE); Material baseMaterial = Material::New( "Material1" ); Dali::MeshActor meshActor = MeshActor::New( CreateMesh(true, baseMaterial) ); @@ -220,7 +222,7 @@ void NewWindowController::CreateMeshActor() FrameBufferImage NewWindowController::CreateMirrorImage(const char* imageName) { FrameBufferImage fbo; - Image image = Image::New(imageName); + Image image = ResourceImage::New(imageName); fbo = CreateFrameBufferForImage(imageName, image, ShaderEffect()); return fbo; } @@ -228,8 +230,8 @@ FrameBufferImage NewWindowController::CreateMirrorImage(const char* imageName) ImageActor NewWindowController::CreateBlurredMirrorImage(const char* imageName) { FrameBufferImage fbo; - Image image = Image::New( imageName ); - Vector2 FBOSize = Image::GetImageSize(imageName); + Image image = ResourceImage::New( imageName ); + Vector2 FBOSize = ResourceImage::GetImageSize(imageName); fbo = FrameBufferImage::New( FBOSize.width, FBOSize.height, Pixel::RGBA8888); GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true); gbv.SetBackgroundColor(Color::TRANSPARENT); @@ -247,7 +249,7 @@ ImageActor NewWindowController::CreateBlurredMirrorImage(const char* imageName) FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imageName, Image image, ShaderEffect shaderEffect) { Stage stage = Stage::GetCurrent(); - Vector2 FBOSize = Image::GetImageSize(imageName); + Vector2 FBOSize = ResourceImage::GetImageSize(imageName); FrameBufferImage framebuffer = FrameBufferImage::New(FBOSize.x, FBOSize.y ); @@ -288,10 +290,10 @@ FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imag void NewWindowController::CreateBubbles(Vector2 stageSize) { mEmitter = Toolkit::BubbleEmitter::New( stageSize, - Image::New( DALI_IMAGE_DIR "bubble-ball.png" ), + ResourceImage::New( DALI_IMAGE_DIR "bubble-ball.png" ), 1000, Vector2( 5.0f, 5.0f ) ); - Image background = Image::New(BACKGROUND_IMAGE); + Image background = ResourceImage::New(BACKGROUND_IMAGE); mEmitter.SetBackground( background, mHSVDelta ); Actor bubbleRoot = mEmitter.GetRootActor(); mContentLayer.Add( bubbleRoot ); @@ -376,7 +378,7 @@ void NewWindowController::CreateBlending() blendShader.SetEffectImage( fb2 ); blendShader.SetUniform("alpha", 0.5f); - mBaseImage = Image::New(BASE_IMAGE); + mBaseImage = ResourceImage::New(BASE_IMAGE); mBlendActor = ImageActor::New( mBaseImage ); mBlendActor.SetParentOrigin(ParentOrigin::CENTER); mBlendActor.SetPosition(Vector3(150.0f, 200.0f, 0.0f)); diff --git a/examples/page-turn-view/page-turn-view-example.cpp b/examples/page-turn-view/page-turn-view-example.cpp index e08bf34..fa412ad 100644 --- a/examples/page-turn-view/page-turn-view-example.cpp +++ b/examples/page-turn-view/page-turn-view-example.cpp @@ -15,11 +15,12 @@ * */ +#include +#include #include #include #include -#include -#include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -79,11 +80,11 @@ class PortraitPageFactory : public PageFactory { if( pageId == 0 ) { - return ImageActor::New( Image::New( BOOK_COVER_PORTRAIT ) ); + return ImageActor::New( ResourceImage::New( BOOK_COVER_PORTRAIT ) ); } else { - return ImageActor::New( Image::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ) ); + return ImageActor::New( ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ) ); } } }; @@ -109,14 +110,14 @@ class LandscapePageFactory : public PageFactory ImageActor pageBack; if( pageId == 0 ) { - pageFront = ImageActor::New( Image::New( BOOK_COVER_LANDSCAPE ) ); - pageBack = ImageActor::New( Image::New( BOOK_COVER_BACK_LANDSCAPE ) ); + pageFront = ImageActor::New( ResourceImage::New( BOOK_COVER_LANDSCAPE ) ); + pageBack = ImageActor::New( ResourceImage::New( BOOK_COVER_BACK_LANDSCAPE ) ); } else { unsigned int imageId = (pageId-1)*2; - pageFront = ImageActor::New( Image::New( PAGE_IMAGES_LANDSCAPE[ imageId % NUMBER_OF_LANDSCAPE_IMAGE ] ) ); - pageBack = ImageActor::New( Image::New( PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ] ) ); + pageFront = ImageActor::New( ResourceImage::New( PAGE_IMAGES_LANDSCAPE[ imageId % NUMBER_OF_LANDSCAPE_IMAGE ] ) ); + pageBack = ImageActor::New( ResourceImage::New( PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ] ) ); } pageFront.Add(pageBack); return pageFront; diff --git a/examples/radial-menu/radial-menu-example.cpp b/examples/radial-menu/radial-menu-example.cpp index 50ac16b..bce680f 100644 --- a/examples/radial-menu/radial-menu-example.cpp +++ b/examples/radial-menu/radial-menu-example.cpp @@ -135,8 +135,8 @@ void RadialMenuExample::OnInit(Application& app) TOOLBAR_IMAGE, APPLICATION_TITLE ); - mIconPlay = Image::New( PLAY_ICON ); - mIconStop = Image::New( STOP_ICON ); + mIconPlay = ResourceImage::New( PLAY_ICON ); + mIconStop = ResourceImage::New( STOP_ICON ); mPlayStopButton = Toolkit::PushButton::New(); mPlayStopButton.SetBackgroundImage( mIconStop ); @@ -147,7 +147,7 @@ void RadialMenuExample::OnInit(Application& app) Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_PLAY_PADDING ); - Vector2 imgSize = Image::GetImageSize(TEST_OUTER_RING_FILENAME); + Vector2 imgSize = ResourceImage::GetImageSize(TEST_OUTER_RING_FILENAME); Vector2 stageSize = stage.GetSize(); float minStageDimension = std::min(stageSize.width, stageSize.height); @@ -163,7 +163,7 @@ void RadialMenuExample::OnInit(Application& app) mRadialSweepView3.SetInitialActorAngle(Degree(-110)); mRadialSweepView3.SetFinalActorAngle(Degree(0)); - Image dial = Image::New( TEST_DIAL_FILENAME ); + Image dial = ResourceImage::New( TEST_DIAL_FILENAME ); mDialActor = ImageActor::New( dial ); mDialActor.SetPositionInheritanceMode(USE_PARENT_POSITION); mDialActor.SetScale(scale); @@ -238,13 +238,13 @@ RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName, Degree finalAngle) { // Create the image - Image image = Image::New(imageName); + Image image = ResourceImage::New(imageName); mImageActor = ImageActor::New(image); mImageActor.SetParentOrigin(ParentOrigin::CENTER); mImageActor.SetAnchorPoint(AnchorPoint::CENTER); // Create the stencil - Vector2 imageSize = Image::GetImageSize(imageName); + Vector2 imageSize = ResourceImage::GetImageSize(imageName); float diameter = std::max(imageSize.width, imageSize.height); RadialSweepView radialSweepView = RadialSweepView::New(); radialSweepView.SetDiameter( diameter ); diff --git a/examples/scroll-view/scroll-view-example.cpp b/examples/scroll-view/scroll-view-example.cpp index 32c41c4..8c8e31a 100644 --- a/examples/scroll-view/scroll-view-example.cpp +++ b/examples/scroll-view/scroll-view-example.cpp @@ -194,11 +194,11 @@ public: TOOLBAR_IMAGE, "" ); - mEffectIcon[ DepthEffect ] = Image::New( EFFECT_DEPTH_IMAGE ); - mEffectIcon[ CubeEffect ] = Image::New( EFFECT_INNER_CUBE_IMAGE ); - mEffectIcon[ PageCarouselEffect ] = Image::New( EFFECT_CAROUSEL_IMAGE ); - mEffectIcon[ PageCubeEffect ] = Image::New( EFFECT_CAROUSEL_IMAGE ); - mEffectIcon[ PageSpiralEffect ] = Image::New( EFFECT_CAROUSEL_IMAGE ); + mEffectIcon[ DepthEffect ] = ResourceImage::New( EFFECT_DEPTH_IMAGE ); + mEffectIcon[ CubeEffect ] = ResourceImage::New( EFFECT_INNER_CUBE_IMAGE ); + mEffectIcon[ PageCarouselEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); + mEffectIcon[ PageCubeEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); + mEffectIcon[ PageSpiralEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); // Create a effect change button. (right of toolbar) mEffectChangeButton = Toolkit::PushButton::New(); @@ -298,7 +298,7 @@ private: Actor CreatePage() { Actor page = Actor::New(); - page.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + page.SetSizeMode( SIZE_EQUAL_TO_PARENT ); page.SetParentOrigin( ParentOrigin::CENTER ); page.SetAnchorPoint( AnchorPoint::CENTER ); @@ -450,7 +450,7 @@ private: void ApplyEffectToPage(Actor page) { page.RemoveConstraints(); - page.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + page.SetSizeMode( SIZE_EQUAL_TO_PARENT ); switch( mEffectMode ) { @@ -563,7 +563,7 @@ private: attributes.SetSize(width, height); attributes.SetScalingMode(ImageAttributes::ShrinkToFit); - Image img = Image::New(filename, attributes); + Image img = ResourceImage::New(filename, attributes); ImageActor actor = ImageActor::New(img); actor.SetName( filename ); actor.SetParentOrigin(ParentOrigin::CENTER); diff --git a/examples/shader-effect/bubble-effect-example.cpp b/examples/shader-effect/bubble-effect-example.cpp index 6768ae2..f5b9d64 100644 --- a/examples/shader-effect/bubble-effect-example.cpp +++ b/examples/shader-effect/bubble-effect-example.cpp @@ -94,7 +94,7 @@ private: // Add a button to change background. (right of toolbar) mChangeBackgroundButton = Toolkit::PushButton::New(); - mChangeBackgroundButton.SetBackgroundImage( Image::New( CHANGE_BACKGROUND_ICON ) ); + mChangeBackgroundButton.SetBackgroundImage( ResourceImage::New( CHANGE_BACKGROUND_ICON ) ); mChangeBackgroundButton.ClickedSignal().Connect( this, &BubbleEffectExample::OnChangeIconClicked ); toolBar.AddControl( mChangeBackgroundButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, @@ -102,7 +102,7 @@ private: DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); // Add a button to change bubble shape. ( left of bar ) mChangeBubbleShapeButton = Toolkit::PushButton::New(); - mChangeBubbleShapeButton.SetBackgroundImage( Image::New( CHANGE_BUBBLE_SHAPE_ICON ) ); + mChangeBubbleShapeButton.SetBackgroundImage( ResourceImage::New( CHANGE_BUBBLE_SHAPE_ICON ) ); mChangeBubbleShapeButton.ClickedSignal().Connect( this, &BubbleEffectExample::OnChangeIconClicked ); toolBar.AddControl( mChangeBubbleShapeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, @@ -111,10 +111,10 @@ private: // Create and initialize the BubbleEmitter object mBubbleEmitter = Toolkit::BubbleEmitter::New( stageSize, - Image::New( BUBBLE_SHAPE_IMAGES[mCurrentBubbleShapeImageId] ), + ResourceImage::New( BUBBLE_SHAPE_IMAGES[mCurrentBubbleShapeImageId] ), DEFAULT_NUMBER_OF_BUBBLES, DEFAULT_BUBBLE_SIZE); - mBackgroundImage = Image::New( BACKGROUND_IMAGES[mCurrentBackgroundImageId] ); + mBackgroundImage = ResourceImage::New( BACKGROUND_IMAGES[mCurrentBackgroundImageId] ); mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); // Get the root actor of all bubbles, and add it to stage. @@ -235,7 +235,7 @@ private: { if(button == mChangeBackgroundButton) { - mBackgroundImage = Image::New( BACKGROUND_IMAGES[ ++mCurrentBackgroundImageId % NUM_BACKGROUND_IMAGES ] ); + mBackgroundImage = ResourceImage::New( BACKGROUND_IMAGES[ ++mCurrentBackgroundImageId % NUM_BACKGROUND_IMAGES ] ); mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); @@ -243,7 +243,7 @@ private: } else if( button == mChangeBubbleShapeButton ) { - mBubbleEmitter.SetShapeImage( Image::New( BUBBLE_SHAPE_IMAGES[ ++mCurrentBubbleShapeImageId % NUM_BUBBLE_SHAPE_IMAGES ] ) ); + mBubbleEmitter.SetShapeImage( ResourceImage::New( BUBBLE_SHAPE_IMAGES[ ++mCurrentBubbleShapeImageId % NUM_BUBBLE_SHAPE_IMAGES ] ) ); } return true; } diff --git a/examples/shader-effect/dissolve-effect-example.cpp b/examples/shader-effect/dissolve-effect-example.cpp index 327c08c..6ed3104 100644 --- a/examples/shader-effect/dissolve-effect-example.cpp +++ b/examples/shader-effect/dissolve-effect-example.cpp @@ -139,6 +139,7 @@ private: Toolkit::ToolBar mToolBar; Layer mContent; Toolkit::TextView mTitleActor; + Actor mParent; ImageActor mCurrentImage; ImageActor mNextImage; @@ -192,8 +193,8 @@ void DissolveEffectApp::OnInit( Application& application ) mContent = DemoHelper::CreateView( application, mView,mToolBar, "", TOOLBAR_IMAGE, "" ); // Add an effect-changing button on the right of the tool bar. - mIconHighP = Image::New( EFFECT_HIGHP_IMAGE ); - mIconMediumP = Image::New( EFFECT_MEDIUMP_IMAGE ); + mIconHighP = ResourceImage::New( EFFECT_HIGHP_IMAGE ); + mIconMediumP = ResourceImage::New( EFFECT_MEDIUMP_IMAGE ); mEffectChangeButton = Toolkit::PushButton::New(); mEffectChangeButton.SetBackgroundImage(mIconHighP); mEffectChangeButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnEffectButtonClicked ); @@ -206,8 +207,8 @@ void DissolveEffectApp::OnInit( Application& application ) mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter ); // Add an slide-show button on the right of the title - mIconPlay = Image::New( PLAY_ICON ); - mIconStop = Image::New( STOP_ICON ); + mIconPlay = ResourceImage::New( PLAY_ICON ); + mIconStop = ResourceImage::New( STOP_ICON ); mPlayStopButton = Toolkit::PushButton::New(); mPlayStopButton.SetBackgroundImage( mIconPlay ); mPlayStopButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnSildeshowButtonClicked ); @@ -221,18 +222,24 @@ void DissolveEffectApp::OnInit( Application& application ) mCurrentImageEffect = Toolkit::DissolveEffect::New(mUseHighPrecision); mNextImageEffect = Toolkit::DissolveEffect::New(mUseHighPrecision); - mViewTimer = Timer::New( VIEWINGTIME ); mViewTimer.TickSignal().Connect( this, &DissolveEffectApp::OnTimerTick ); mTimerReady = true; + // Set size to stage size to avoid seeing a black border on transition + mParent = Actor::New(); + mParent.SetSize( Stage::GetCurrent().GetSize() ); + mParent.SetPositionInheritanceMode( USE_PARENT_POSITION ); + mContent.Add( mParent ); + mSizeConstraint= Constraint::New( Actor::SCALE, LocalSource( Actor::SIZE ), ParentSource( Actor::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); // show the first image - mCurrentImage = ImageActor::New( Image::New( IMAGES[mIndex] ) ); + mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) ); mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); mCurrentImage.ApplyConstraint( mSizeConstraint ); - mContent.Add(mCurrentImage); + mParent.Add( mCurrentImage ); + mPanGestureDetector.Attach( mCurrentImage ); } @@ -256,12 +263,12 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES; } - Image image = Image::New( IMAGES[ mIndex ] ); + Image image = ResourceImage::New( IMAGES[ mIndex ] ); mNextImage = ImageActor::New( image ); mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); mNextImage.ApplyConstraint( mSizeConstraint ); mNextImage.SetZ(INITIAL_DEPTH); - mContent.Add(mNextImage); + mParent.Add( mNextImage ); Vector2 size = Vector2( mCurrentImage.GetCurrentSize() ); StartTransition( gesture.position / size, gesture.displacement * Vector2(1.0, size.x/size.y)); } @@ -332,7 +339,7 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button ) if( mSlideshow ) { mPlayStopButton.SetBackgroundImage( mIconStop ); - mPanGestureDetector.Detach( mContent ); + mPanGestureDetector.Detach( mParent ); mViewTimer.Start(); mTimerReady = false; } @@ -340,7 +347,7 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button ) { mPlayStopButton.SetBackgroundImage( mIconPlay ); mTimerReady = true; - mPanGestureDetector.Attach( mContent ); + mPanGestureDetector.Attach( mParent ); } return true; } @@ -349,7 +356,7 @@ void DissolveEffectApp::OnTransitionCompleted( Animation& source ) { mCurrentImage.RemoveShaderEffect(); mNextImage.RemoveShaderEffect(); - mContent.Remove(mCurrentImage); + mParent.Remove( mCurrentImage ); mPanGestureDetector.Detach( mCurrentImage ); mCurrentImage = mNextImage; mPanGestureDetector.Attach( mCurrentImage ); @@ -368,13 +375,13 @@ bool DissolveEffectApp::OnTimerTick() if(mSlideshow) { mIndex = (mIndex + 1)%NUM_IMAGES; - Image image = Image::New( IMAGES[ mIndex ] ); + Image image = ResourceImage::New( IMAGES[ mIndex ] ); mNextImage = ImageActor::New( image ); mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); mNextImage.ApplyConstraint( mSizeConstraint ); mNextImage.SetZ(INITIAL_DEPTH); - mContent.Add(mNextImage); - switch(mCentralLineIndex%4) + mParent.Add( mNextImage ); + switch( mCentralLineIndex%4 ) { case 0: { diff --git a/examples/shader-effect/refraction-effect-example.cpp b/examples/shader-effect/refraction-effect-example.cpp index f1325cc..0b3914e 100644 --- a/examples/shader-effect/refraction-effect-example.cpp +++ b/examples/shader-effect/refraction-effect-example.cpp @@ -318,7 +318,7 @@ private: // Add a button to change background. (right of toolbar) mChangeTextureButton = Toolkit::PushButton::New(); - mChangeTextureButton.SetBackgroundImage( Image::New( CHANGE_TEXTURE_ICON ) ); + mChangeTextureButton.SetBackgroundImage( ResourceImage::New( CHANGE_TEXTURE_ICON ) ); mChangeTextureButton.ClickedSignal().Connect( this, &RefractionEffectExample::OnChangeTexture ); toolBar.AddControl( mChangeTextureButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, @@ -326,7 +326,7 @@ private: DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); // Add a button to change mesh pattern. ( left of bar ) mChangeMeshButton = Toolkit::PushButton::New(); - mChangeMeshButton.SetBackgroundImage( Image::New( CHANGE_MESH_ICON ) ); + mChangeMeshButton.SetBackgroundImage( ResourceImage::New( CHANGE_MESH_ICON ) ); mChangeMeshButton.ClickedSignal().Connect( this, &RefractionEffectExample::OnChangeMesh ); toolBar.AddControl( mChangeMeshButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, @@ -338,7 +338,7 @@ private: mNoEffect = NoEffect::New(); // used in the other situations, basic render shader // Create the mesh from the obj file and add to stage mMaterial = Material::New( "Material" ) ; - mMaterial.SetDiffuseTexture(Image::New(TEXTURE_IMAGES[mCurrentTextureId])); + mMaterial.SetDiffuseTexture(ResourceImage::New(TEXTURE_IMAGES[mCurrentTextureId])); CreateSurface( MESH_FILES[mCurrentMeshId] ); // Connect the callback to the touch signal on the mesh actor @@ -371,7 +371,7 @@ private: bool OnChangeTexture( Toolkit::Button button ) { mCurrentTextureId = ( mCurrentTextureId + 1 ) % NUM_TEXTURE_IMAGES; - mMaterial.SetDiffuseTexture(Image::New(TEXTURE_IMAGES[mCurrentTextureId])); + mMaterial.SetDiffuseTexture(ResourceImage::New(TEXTURE_IMAGES[mCurrentTextureId])); return true; } diff --git a/examples/shadows/shadow-bone-lighting-example.cpp b/examples/shadows/shadow-bone-lighting-example.cpp index 1246be2..fbacd82 100644 --- a/examples/shadows/shadow-bone-lighting-example.cpp +++ b/examples/shadows/shadow-bone-lighting-example.cpp @@ -20,6 +20,7 @@ #include #include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -28,9 +29,6 @@ using namespace DemoHelper; namespace { -const char* gModelFile = DALI_MODEL_DIR "AlbumCute.dae"; -const char* gBinaryModelFile = DALI_MODEL_DIR "AlbumCute.dali-bin"; - const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" ); const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); @@ -41,6 +39,10 @@ const char* APPLICATION_TITLE_ROTATE_SCENE( "Lighting: Rotate Scene" ); const char* CHANGE_EFFECT_IMAGE( DALI_IMAGE_DIR "icon-change.png" ); const char* RESET_ICON( DALI_IMAGE_DIR "icon-reset.png" ); +const char* SCENE_IMAGE_1( DALI_IMAGE_DIR "gallery-small-10.jpg"); +const char* SCENE_IMAGE_2( DALI_IMAGE_DIR "gallery-small-42.jpg"); +const char* SCENE_IMAGE_3( DALI_IMAGE_DIR "gallery-small-48.jpg"); + const Quaternion JAUNTY_ROTATION(Math::PI/5.0f, Math::PI/5.0f, 0.0f); // Euler angles const float MIN_PINCH_SCALE( 0.3f ); const float MAX_PINCH_SCALE( 2.05f ); @@ -56,7 +58,7 @@ const Vector2 DEFAULT_STAGE_SIZE( 480.0f, 800.0f ); } /** - * This example shows a fixed point light onto an animating model + * This example shows a fixed point light onto an animating set of images * casting a shadow onto a wall. The whole scene can be rotated. */ @@ -118,6 +120,21 @@ public: } }; + struct RotationConstraint + { + RotationConstraint(float sign) + : mSign(sign) + { + } + + Quaternion operator()( const Quaternion& current, const PropertyInput& property ) + { + Degree angle(property.GetFloat()); + return Quaternion( Radian(angle) * mSign, Vector3::YAXIS ); + } + + float mSign; + }; /** * This method gets called once the main loop of application is up and running @@ -128,11 +145,9 @@ public: Stage::GetCurrent().KeyEventSignal().Connect(this, &TestApp::OnKeyEvent); - mModel = Model::New(gBinaryModelFile); // trigger model load - mModel.LoadingFinishedSignal().Connect(this, &TestApp::BinaryModelLoaded); - CreateToolbarAndView(app); CreateShadowViewAndLights(); + CreateScene(); } void CreateToolbarAndView(Application& app) @@ -148,7 +163,7 @@ public: "" ); // Add an effect-changing button on the right of the tool bar. - Image imageChangeEffect = Image::New( CHANGE_EFFECT_IMAGE ); + Image imageChangeEffect = ResourceImage::New( CHANGE_EFFECT_IMAGE ); Toolkit::PushButton effectChangeButton = Toolkit::PushButton::New(); effectChangeButton.SetBackgroundImage(imageChangeEffect); effectChangeButton.ClickedSignal().Connect( this, &TestApp::OnEffectButtonClicked ); @@ -164,7 +179,7 @@ public: mTitleActor.SetStyleToCurrentText( DemoHelper::GetDefaultTextStyle() ); //Add a reset button - Image resetImage = Image::New( RESET_ICON ); + Image resetImage = ResourceImage::New( RESET_ICON ); Toolkit::PushButton resetButton = Toolkit::PushButton::New(); resetButton.SetBackgroundImage( resetImage ); resetButton.ClickedSignal().Connect( this, &TestApp::OnResetPressed ); @@ -190,42 +205,7 @@ public: mTapGestureDetector.DetectedSignal().Connect(this, &TestApp::OnTap); } - /** - * This method gets called once the model is loaded by the resource manager - */ - void BinaryModelLoaded(Model model) - { - if( model.GetLoadingState() == ResourceLoadingSucceeded ) - { - std::cout << "Succeeded loading binary model" << std::endl; - - ModelReady(); - } - else - { - std::cout << "Failed loading binary model" << std::endl; - - mModel = Model::New(gModelFile); - mModel.LoadingFinishedSignal().Connect(this, &TestApp::ModelLoaded); - } - } - - void ModelLoaded(Model model) - { - if( model.GetLoadingState() == ResourceLoadingSucceeded ) - { - std::cout << "Succeeded loading collada model" << std::endl; - - model.Save(gBinaryModelFile); - ModelReady(); - } - else - { - std::cout << "Failed loading collada model" << std::endl; - mApp.Quit(); - } - } void CreateShadowViewAndLights() { @@ -233,11 +213,11 @@ public: mShadowView.SetName("Container"); mShadowView.SetParentOrigin(ParentOrigin::CENTER); mShadowView.SetAnchorPoint(AnchorPoint::CENTER); - mShadowView.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mShadowView.SetSizeMode( SIZE_EQUAL_TO_PARENT ); mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f); mContents.Add(mShadowView); - Image brickWall = Image::New(DALI_IMAGE_DIR "brick-wall.jpg"); + Image brickWall = ResourceImage::New(DALI_IMAGE_DIR "brick-wall.jpg"); mShadowPlaneBg = ImageActor::New(brickWall); mShadowPlaneBg.SetParentOrigin(ParentOrigin::CENTER); mShadowPlaneBg.SetAnchorPoint(AnchorPoint::CENTER); @@ -255,7 +235,7 @@ public: mLightAnchor.SetRotation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); // Work out a scaling factor as the initial light position was calculated for desktop - // Need to scale light position as model size is based on stage size (i.e. much bigger on device) + // Need to scale light position as scene actor size is based on stage size (i.e. much bigger on device) Vector2 stageSize( Stage::GetCurrent().GetSize() ); float scaleFactor = stageSize.x / DEFAULT_STAGE_SIZE.x; @@ -281,44 +261,51 @@ public: mShadowView.SetPointLight(mCastingLight); } - void ModelReady() + void CreateScene() { - mModelActor = ModelActorFactory::BuildActorTree(mModel, ""); // Gets root actor + mSceneActor = Actor::New(); + mSceneActor.SetParentOrigin(ParentOrigin::CENTER); - if (mModelActor) - { - Vector2 stageSize(Stage::GetCurrent().GetSize()); + // Create and add images to the scene actor: + mImageActor1 = ImageActor::New( ResourceImage::New(SCENE_IMAGE_1) ); + mImageActor2 = ImageActor::New( ResourceImage::New(SCENE_IMAGE_2) ); + mImageActor3 = ImageActor::New( ResourceImage::New(SCENE_IMAGE_3) ); - mModelActor.SetSize(250.0f, 250.0f); - mModelActor.SetPosition(0.0f, 0.0f, 130.0f); - //Create a Key light - Light keylight = Light::New("KeyLight"); - keylight.SetFallOff(Vector2(10000.0f, 10000.0f)); - //keylight.SetSpecularColor(Vector3::ZERO); - mKeyLightActor = LightActor::New(); - mKeyLightActor.SetParentOrigin(ParentOrigin::CENTER); - mKeyLightActor.SetName(keylight.GetName()); + mImageActor2.SetParentOrigin(ParentOrigin::CENTER); - //Add all the actors to the stage - mCastingLight.Add(mKeyLightActor); - mKeyLightActor.SetLight(keylight); + mImageActor1.SetParentOrigin(ParentOrigin::CENTER_LEFT); + mImageActor1.SetAnchorPoint(AnchorPoint::CENTER_RIGHT); - mShadowView.Add(mModelActor); + mImageActor3.SetParentOrigin(ParentOrigin::CENTER_RIGHT); + mImageActor3.SetAnchorPoint(AnchorPoint::CENTER_LEFT); + mSceneActor.Add(mImageActor2); + mImageActor2.Add(mImageActor1); + mImageActor2.Add(mImageActor3); - if (mModel.NumberOfAnimations()) - { - mModelAnimation = ModelActorFactory::BuildAnimation(mModel, mModelActor, 0); - mModelAnimation.SetDuration(4.0f); - mModelAnimation.SetLooping(true); - mModelAnimation.Play(); - } + Property::Index angleIndex = mImageActor2.RegisterProperty("angle", Property::Value(30.0f)); + Source angleSrc( mImageActor2, angleIndex ); + mImageActor1.ApplyConstraint(Constraint::New( Actor::ROTATION, angleSrc, + RotationConstraint(-1.0f))); + mImageActor3.ApplyConstraint(Constraint::New( Actor::ROTATION, angleSrc, + RotationConstraint(+1.0f))); - //StartAnimation(); - } + mSceneAnimation = Animation::New(2.5f); + + // Want to animate angle from 30 => -30 and back again smoothly. + + mSceneAnimation.AnimateTo( Property( mImageActor2, angleIndex ), Property::Value(-30.0f), AlphaFunctions::Sin ); + + mSceneAnimation.SetLooping(true); + mSceneAnimation.Play(); + + mSceneActor.SetSize(250.0f, 250.0f); + mSceneActor.SetPosition(0.0f, 0.0f, 130.0f); + mShadowView.Add(mSceneActor); } + Quaternion CalculateWorldRotation(Radian longitude, Radian axisTilt ) { Quaternion q(longitude, Vector3::YAXIS); @@ -328,17 +315,18 @@ public: void OnTap(Dali::Actor actor, const TapGesture& gesture) { - if( ! mPaused ) - { - //mAnimation.Pause(); - mModelAnimation.Pause(); - mPaused = true; - } - else + if( mSceneAnimation ) { - //mAnimation.Play(); - mModelAnimation.Play(); - mPaused = false; + if( ! mPaused ) + { + mSceneAnimation.Pause(); + mPaused = true; + } + else + { + mSceneAnimation.Play(); + mPaused = false; + } } } @@ -380,7 +368,7 @@ public: mObjectLongitudinal += gesture.displacement.x/4.0f; mObjectAxisTilt -= gesture.displacement.y/6.0f; mObjectAxisTilt = Clamp(mObjectAxisTilt, -90.0f, 90.0f); - mModelActor.SetRotation(CalculateWorldRotation(Radian(mObjectLongitudinal), Radian(mObjectAxisTilt))); + mSceneActor.SetRotation(CalculateWorldRotation(Radian(mObjectLongitudinal), Radian(mObjectAxisTilt))); break; } } @@ -409,13 +397,9 @@ public: void Terminate(Application& app) { - if( mModelActor ) - { - Stage::GetCurrent().Remove(mModelActor); - } - if( mKeyLightActor ) + if( mSceneActor ) { - Stage::GetCurrent().Remove(mKeyLightActor); + Stage::GetCurrent().Remove(mSceneActor); } if( mView ) { @@ -472,6 +456,7 @@ public: // Reset translation mTranslation = Vector3::ZERO; mContents.SetPosition(mTranslation); + // Align scene so that light anchor orientation is Z Axis mAxisTilt = -mLightAxisTilt; mLongitudinal = -mLightLongitudinal; @@ -484,18 +469,18 @@ private: Application& mApp; Toolkit::View mView; Layer mContents; - Model mModel; - Actor mModelActor; - LightActor mKeyLightActor; + Actor mSceneActor; Animation mAnimation; - Animation mModelAnimation; + Animation mSceneAnimation; bool mPaused; Toolkit::ShadowView mShadowView; ImageActor mShadowPlaneBg; ImageActor mShadowPlane; Actor mCastingLight; Actor mLightAnchor; - + ImageActor mImageActor1; + ImageActor mImageActor2; + ImageActor mImageActor3; PanGestureDetector mPanGestureDetector; PinchGestureDetector mPinchGestureDetector; TapGestureDetector mTapGestureDetector; @@ -509,6 +494,9 @@ private: float mPinchScale; float mScaleAtPinchStart; + Property::Index mAngle1Index; + Property::Index mAngle3Index; + Toolkit::TextView mTitleActor; enum PanState diff --git a/examples/shared/view.h b/examples/shared/view.h index ab9f20c..13c8da9 100644 --- a/examples/shared/view.h +++ b/examples/shared/view.h @@ -93,14 +93,14 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, toolBarLayer.RaiseToTop(); // Tool bar - Dali::Image image = Dali::Image::New( toolbarImagePath ); + Dali::Image image = Dali::ResourceImage::New( toolbarImagePath ); Dali::ImageActor toolBarBackground = Dali::ImageActor::New( image ); toolBar = Dali::Toolkit::ToolBar::New(); toolBar.SetBackground( toolBarBackground ); toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); - toolBar.ApplyConstraint( Dali::Constraint::New( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ), Dali::EqualToConstraint() ) ); toolBar.SetSize( 0.0f, style.mToolBarHeight ); + toolBar.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT ); toolBarBackground.SetSortModifier(1.0f); // Add the tool bar to the too bar layer. @@ -145,7 +145,7 @@ Dali::Layer CreateView( Dali::Application& application, // Set background image. if ( ! backgroundImagePath.empty() ) { - Dali::Image backgroundImage = Dali::Image::New( backgroundImagePath ); + Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath ); Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage ); view.SetBackground( backgroundImageActor ); } @@ -166,7 +166,7 @@ Dali::Layer CreateView( Dali::Application& application, Dali::Layer contentLayer = Dali::Layer::New(); contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER ); contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER ); - contentLayer.ApplyConstraint( Dali::Constraint::New( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ), Dali::EqualToConstraint() ) ); + contentLayer.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT ); view.AddContentLayer( contentLayer ); contentLayer.LowerBelow( toolBarLayer ); diff --git a/examples/transition/cube-transition-effect-example.cpp b/examples/transition/cube-transition-effect-example.cpp index bd0d0a7..f75e541 100644 --- a/examples/transition/cube-transition-effect-example.cpp +++ b/examples/transition/cube-transition-effect-example.cpp @@ -120,7 +120,7 @@ private: * Start the transition * @param[in] image The image content of the imageActor for transition */ - void OnImageLoaded(Image image); + void OnImageLoaded(ResourceImage image); /** * Main key event handler */ @@ -209,9 +209,9 @@ void CubeTransitionApp::OnInit( Application& application ) mContent = DemoHelper::CreateView( application, mView, mToolBar, "", TOOLBAR_IMAGE, "" ); // Add an effect-changing button on the right of the tool bar. - mImageWave = Image::New( EFFECT_WAVE_IMAGE ); - mImageCross = Image::New( EFFECT_CROSS_IMAGE ); - mImageFold = Image::New( EFFECT_FOLD_IMAGE ); + mImageWave = ResourceImage::New( EFFECT_WAVE_IMAGE ); + mImageCross = ResourceImage::New( EFFECT_CROSS_IMAGE ); + mImageFold = ResourceImage::New( EFFECT_FOLD_IMAGE ); mEffectChangeButton = Toolkit::PushButton::New(); mEffectChangeButton.SetBackgroundImage(mImageWave); mEffectChangeButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked ); @@ -222,8 +222,8 @@ void CubeTransitionApp::OnInit( Application& application ) mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter ); //Add an slideshow icon on the right of the title - mIconSlideshowStart = Image::New( SLIDE_SHOW_START_ICON ); - mIconSlideshowStop = Image::New( SLIDE_SHOW_STOP_ICON ); + mIconSlideshowStart = ResourceImage::New( SLIDE_SHOW_START_ICON ); + mIconSlideshowStop = ResourceImage::New( SLIDE_SHOW_STOP_ICON ); mSlideshowButton = Toolkit::PushButton::New(); mSlideshowButton.SetBackgroundImage( mIconSlideshowStart ); mSlideshowButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnSildeshowButtonClicked ); @@ -266,7 +266,7 @@ void CubeTransitionApp::OnInit( Application& application ) // show the first image mImageConstraint = Constraint::New( Actor::SCALE, LocalSource( Actor::SIZE ), ParentSource( Actor::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); - mCurrentImage = ImageActor::New( Image::New( IMAGES[mIndex] ) ); + mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) ); mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION ); mCurrentImage.ApplyConstraint( mImageConstraint ); mParent.Add( mCurrentImage ); @@ -308,23 +308,24 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture ) void CubeTransitionApp::GoToNextImage() { - Image image = Image::New( IMAGES[ mIndex ] ); + ResourceImage image = ResourceImage::New( IMAGES[ mIndex ] ); mNextImage = ImageActor::New( image ); mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); mNextImage.ApplyConstraint( mImageConstraint ); mCurrentEffect.SetTargetImage(mNextImage); - mIsImageLoading = true; if( image.GetLoadingState() == ResourceLoadingSucceeded ) { - OnImageLoaded( image ); + mIsImageLoading = false; + OnImageLoaded( image ); } else { + mIsImageLoading = true; image.LoadingFinishedSignal().Connect( this, &CubeTransitionApp::OnImageLoaded ); } } -void CubeTransitionApp::OnImageLoaded(Image image) +void CubeTransitionApp::OnImageLoaded(ResourceImage image) { mIsImageLoading = false; mCurrentEffect.StartTransition( mPanPosition, mPanDisplacement ); diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index ac5e455..b2a65fd 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 1.0.30 +Version: 1.0.31 Release: 1 Group: System/Libraries License: Apache-2.0 @@ -14,6 +14,7 @@ Requires(postun): /sbin/ldconfig Requires: dali Requires: dali-adaptor Requires: dali-toolkit +BuildRequires: cmake BuildRequires: boost-devel BuildRequires: pkgconfig BuildRequires: pkgconfig(capi-appfw-application) @@ -47,13 +48,10 @@ CXXFLAGS+=" -Wall -g -O2" LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -fPIC" %ifarch %{arm} -EXTRA_CONFIGURE_OPTIONS=" --host=arm" CXXFLAGS+=" -D_ARCH_ARM_" %endif -libtoolize --force -cd %{_builddir}/%{name}-%{version}/build/tizen && autoreconf --install -cd %{_builddir}/%{name}-%{version}/build/tizen && CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS DALI_APP_DIR=%{dali_app_ro_dir} ./configure --prefix=$PREFIX $EXTRA_CONFIGURE_OPTIONS +cd %{_builddir}/%{name}-%{version}/build/tizen && cmake -DDALI_APP_DIR=%{dali_app_ro_dir} . make %{?jobs:-j%jobs} @@ -65,9 +63,6 @@ rm -rf %{buildroot} cd build/tizen %make_install DALI_APP_DIR=%{dali_app_ro_dir} -mkdir -p %{buildroot}/%{dali_app_exe_dir} -mv %{buildroot}/%{_bindir}/* %{buildroot}/%{dali_app_exe_dir} - mkdir -p %{buildroot}%{dali_xml_file_dir} cp -f %{_builddir}/%{name}-%{version}/%{name}.xml %{buildroot}%{dali_xml_file_dir}