diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index 2f68697..ce0a4eb 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -42,14 +42,16 @@ SET(DALI_EXAMPLE_BIN \\"${BINDIR}/\\") SET(DALI_LOCALE_DIR \\"${LOCALE_DIR}\\") SET(DALI_LANG \\"${LANG}\\") -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_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") +FILE(GLOB LOCAL_IMAGES_KTX RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.ktx") +FILE(GLOB LOCAL_IMAGES_ASTC RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.astc") -SET(LOCAL_IMAGES_LIST ${LOCAL_IMAGES_PNG};${LOCAL_IMAGES_JPG};${LOCAL_IMAGES_GIF};${LOCAL_IMAGES_BMP};${LOCAL_IMAGES_ICO};${LOCAL_IMAGES_WBMP}) +SET(LOCAL_IMAGES_LIST ${LOCAL_IMAGES_PNG};${LOCAL_IMAGES_JPG};${LOCAL_IMAGES_GIF};${LOCAL_IMAGES_BMP};${LOCAL_IMAGES_ICO};${LOCAL_IMAGES_WBMP};${LOCAL_IMAGES_KTX};${LOCAL_IMAGES_ASTC}) FOREACH(flag ${LOCAL_IMAGES_LIST}) INSTALL(FILES ${LOCAL_IMAGES_DIR}/${flag} DESTINATION ${IMAGES_DIR}) ENDFOREACH(flag) diff --git a/examples/compressed-texture-formats/compressed-texture-formats-example.cpp b/examples/compressed-texture-formats/compressed-texture-formats-example.cpp new file mode 100644 index 0000000..967a01a --- /dev/null +++ b/examples/compressed-texture-formats/compressed-texture-formats-example.cpp @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +using namespace Dali; +using Dali::Toolkit::TextLabel; + +const char* IMAGE_FILENAME_ETC = DALI_IMAGE_DIR "tx-etc1.ktx"; +const char* IMAGE_FILENAME_ASTC_LINEAR = DALI_IMAGE_DIR "tx-astc-4x4-linear.ktx"; +const char* IMAGE_FILENAME_ASTC_LINEAR_NATIVE = DALI_IMAGE_DIR "tx-astc-4x4-linear-native.astc"; + +/** + * @brief This example shows 3 images, each of a different compressed texture type. + * If built and run on a OpenGL ES 3.1 compatable target, then all 3 images will display. + * Otherwise, the top image will display and the other 2 will appear as black squares. + */ +class CompressedTextureFormatsController : public ConnectionTracker +{ +public: + + CompressedTextureFormatsController( Application& application ) + : mApplication( application ) + { + // Connect to the Application's Init signal + mApplication.InitSignal().Connect( this, &CompressedTextureFormatsController::Create ); + } + + ~CompressedTextureFormatsController() + { + // Nothing to do here; + } + + // The Init signal is received once (only) during the Application lifetime + void Create( Application& application ) + { + // Get a handle to the stage + Stage stage = Stage::GetCurrent(); + stage.SetBackgroundColor( Color::WHITE ); + + // Setup a TableView to hold a grid of images and labels. + Toolkit::TableView table = Toolkit::TableView::New( 3u, 2u ); + table.SetAnchorPoint( AnchorPoint::CENTER ); + table.SetParentOrigin( ParentOrigin::CENTER ); + table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + table.SetRelativeWidth( 0u, 0.5f ); + table.SetRelativeWidth( 1u, 0.5f ); + table.SetRelativeHeight( 0u, 1.0f / 3.0f ); + table.SetRelativeHeight( 1u, 1.0f / 3.0f ); + table.SetRelativeHeight( 2u, 1.0f / 3.0f ); + + + // Add text labels. + TextLabel textLabel = TextLabel::New( "ETC1 (KTX):" ); + textLabel.SetAnchorPoint( AnchorPoint::CENTER ); + textLabel.SetParentOrigin( ParentOrigin::CENTER ); + textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + textLabel.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true ); + table.AddChild( textLabel, Toolkit::TableView::CellPosition( 0u, 0u ) ); + table.SetCellAlignment( Toolkit::TableView::CellPosition( 0u, 0u ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); + + textLabel = TextLabel::New( "ASTC (KTX) 4x4 linear:" ); + textLabel.SetAnchorPoint( AnchorPoint::CENTER ); + textLabel.SetParentOrigin( ParentOrigin::CENTER ); + textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + textLabel.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true ); + table.AddChild( textLabel, Toolkit::TableView::CellPosition( 1u, 0u ) ); + table.SetCellAlignment( Toolkit::TableView::CellPosition( 1u, 0u ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); + + textLabel = TextLabel::New( "ASTC (Native) 4x4 linear:" ); + textLabel.SetAnchorPoint( AnchorPoint::CENTER ); + textLabel.SetParentOrigin( ParentOrigin::CENTER ); + textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + textLabel.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true ); + table.AddChild( textLabel, Toolkit::TableView::CellPosition( 2u, 0u ) ); + table.SetCellAlignment( Toolkit::TableView::CellPosition( 2u, 0u ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); + + // Add images. + Toolkit::ImageView imageView = Toolkit::ImageView::New( ResourceImage::New( IMAGE_FILENAME_ETC ) ); + imageView.SetAnchorPoint( AnchorPoint::CENTER ); + imageView.SetParentOrigin( ParentOrigin::CENTER ); + table.AddChild( imageView, Toolkit::TableView::CellPosition( 0u, 1u ) ); + + imageView = Toolkit::ImageView::New( ResourceImage::New( IMAGE_FILENAME_ASTC_LINEAR ) ); + imageView.SetAnchorPoint( AnchorPoint::CENTER ); + imageView.SetParentOrigin( ParentOrigin::CENTER ); + table.AddChild( imageView, Toolkit::TableView::CellPosition( 1u, 1u ) ); + + imageView = Toolkit::ImageView::New( ResourceImage::New( IMAGE_FILENAME_ASTC_LINEAR_NATIVE ) ); + imageView.SetAnchorPoint( AnchorPoint::CENTER ); + imageView.SetParentOrigin( ParentOrigin::CENTER ); + table.AddChild( imageView, Toolkit::TableView::CellPosition( 2u, 1u ) ); + + stage.Add( table ); + + // Respond to a click anywhere on the stage + stage.GetRootLayer().TouchedSignal().Connect( this, &CompressedTextureFormatsController::OnTouch ); + } + + bool OnTouch( Actor actor, const TouchEvent& touch ) + { + // quit the application + mApplication.Quit(); + return true; + } + +private: + Application& mApplication; +}; + +void RunTest( Application& application ) +{ + CompressedTextureFormatsController test( application ); + + application.MainLoop(); +} + +// Entry point for Linux & Tizen applications +// +int main( int argc, char **argv ) +{ + Application application = Application::New( &argc, &argv ); + + RunTest( application ); + + return 0; +} diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index 504863e..2747c25 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.1.16 +Version: 1.1.17 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/resources/images/tx-astc-4x4-linear-native.astc b/resources/images/tx-astc-4x4-linear-native.astc new file mode 100644 index 0000000..235e6b6 --- /dev/null +++ b/resources/images/tx-astc-4x4-linear-native.astc diff --git a/resources/images/tx-astc-4x4-linear.ktx b/resources/images/tx-astc-4x4-linear.ktx new file mode 100644 index 0000000..85379e7 --- /dev/null +++ b/resources/images/tx-astc-4x4-linear.ktx diff --git a/resources/images/tx-astc-4x4-srgb.ktx b/resources/images/tx-astc-4x4-srgb.ktx new file mode 100644 index 0000000..607a622 --- /dev/null +++ b/resources/images/tx-astc-4x4-srgb.ktx diff --git a/resources/images/tx-etc1.ktx b/resources/images/tx-etc1.ktx new file mode 100644 index 0000000..68f1081 --- /dev/null +++ b/resources/images/tx-etc1.ktx