/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
tet_infoline("UtcDaliPixelHasAlpha");
- TestPixelEnumSize( 54 );
+ TestPixelEnumSize( 56 );
DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::INVALID ) == false ); // For completeness
DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR ) == true );
DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR ) == true );
+ DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB16F ) == false );
+ DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB32F ) == false );
+
END_TEST;
}
tet_infoline("UtcDaliPixelGetBytesPerPixel");
+ // Be sure that the number of cases tested below is correct:
+ TestPixelEnumSize( 56 );
+
DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::INVALID ) == 0 ); // For completeness
DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::L8 ) == 1 );
DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR ) == 0 );
DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR ) == 0 );
+ DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB16F ) == 12 );
+ DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB32F ) == 24 );
+
END_TEST;
}
int bitMask = 0;
// Be sure that the number of cases tested below is correct:
- TestPixelEnumSize( 54 );
+ TestPixelEnumSize( 56 );
Pixel::GetAlphaOffsetAndMask( Pixel::INVALID, byteOffset, bitMask ); // For completeness
DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, byteOffset, bitMask );
DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
+ Pixel::GetAlphaOffsetAndMask( Pixel::RGB16F, byteOffset, bitMask );
+ DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
+ Pixel::GetAlphaOffsetAndMask( Pixel::RGB32F, byteOffset, bitMask );
+ DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
+
END_TEST;
}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
#include <dali/public-api/dali-core.h>
#include <dali/devel-api/images/pixel-data-devel.h>
-#include <dali/devel-api/images/pixel-devel.h>
#include <dali-test-suite-utils.h>
#include <test-native-image.h>
int UtcDaliTextureUpload07(void)
{
- DevelPixel::Format FLOATING_POINT_PIXEL_FORMATS[] =
+ Pixel::Format FLOATING_POINT_PIXEL_FORMATS[] =
{
- DevelPixel::RGB16F,
- DevelPixel::RGB32F,
+ Pixel::RGB16F,
+ Pixel::RGB32F,
};
- const unsigned int NUMBER_OF_FLOATING_POINT_PIXEL_FORMATS = sizeof( FLOATING_POINT_PIXEL_FORMATS ) / sizeof( DevelPixel::Format );
+ const unsigned int NUMBER_OF_FLOATING_POINT_PIXEL_FORMATS = sizeof( FLOATING_POINT_PIXEL_FORMATS ) / sizeof( Pixel::Format );
for( unsigned int index = 0; index < NUMBER_OF_FLOATING_POINT_PIXEL_FORMATS; ++index )
{
unsigned int width(64);
unsigned int height(64);
tet_infoline( "Creating a floating point texture" );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, static_cast<Pixel::Format>( FLOATING_POINT_PIXEL_FORMATS[index] ), width, height );
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, FLOATING_POINT_PIXEL_FORMATS[index], width, height );
application.GetGlAbstraction().EnableTextureCallTrace(true);
tet_infoline( "Creating a RGB pixel buffer and adding that to the texture to ensure it is handled correctly" );
unsigned int bufferSize( width * height * 3 );
unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelData = DevelPixelData::New( buffer, bufferSize, width, height, FLOATING_POINT_PIXEL_FORMATS[index], PixelData::FREE );
+ PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, FLOATING_POINT_PIXEL_FORMATS[index], PixelData::FREE );
texture.Upload( pixelData );
application.SendNotification();
application.Render();
${CMAKE_CURRENT_SOURCE_DIR}/images/nine-patch-image.h
${CMAKE_CURRENT_SOURCE_DIR}/images/texture-set-image.h
${CMAKE_CURRENT_SOURCE_DIR}/images/pixel-data-devel.h
- ${CMAKE_CURRENT_SOURCE_DIR}/images/pixel-devel.h
${CMAKE_CURRENT_SOURCE_DIR}/object/csharp-type-info.h
${CMAKE_CURRENT_SOURCE_DIR}/object/csharp-type-registry.h
$(devel_api_src_dir)/images/native-image-interface-extension.h \
$(devel_api_src_dir)/images/nine-patch-image.h \
$(devel_api_src_dir)/images/texture-set-image.h \
- $(devel_api_src_dir)/images/pixel-data-devel.h \
- $(devel_api_src_dir)/images/pixel-devel.h
+ $(devel_api_src_dir)/images/pixel-data-devel.h
devel_api_core_object_header_files = \
$(devel_api_src_dir)/object/csharp-type-info.h \
namespace DevelPixelData
{
-PixelData New( unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
- DevelPixel::Format pixelFormat,
- PixelData::ReleaseFunction releaseFunction )
-{
- IntrusivePtr<Internal::PixelData> internal = Internal::PixelData::New( buffer, bufferSize, width, height, static_cast<Pixel::Format>( pixelFormat ), releaseFunction );
- return PixelData( internal.Get() );
-}
-
PixelDataBuffer ReleasePixelDataBuffer( PixelData& pixelData )
{
Internal::PixelData& pixelDataImpl = GetImplementation( pixelData );
#include <dali/public-api/images/pixel-data.h>
// INTERNAL INCLUDES
-#include <dali/devel-api/images/pixel-devel.h>
+#include <dali/public-api/images/pixel.h>
namespace Dali
{
{
/**
- * @brief Creates a PixelData object, using development pixel formats
- *
- * @param[in] buffer The raw pixel data
- * @param[in] bufferSize The size of the buffer in bytes
- * @param[in] width Buffer width in pixels
- * @param[in] height Buffer height in pixels
- * @param[in] pixelFormat The pixel format
- * @param[in] releaseFunction The function used to release the memory
- * @return A handle to the PixelData
- */
-DALI_IMPORT_API PixelData New( unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
- DevelPixel::Format pixelFormat,
- PixelData::ReleaseFunction releaseFunction );
-
-/**
* Struct to keep the buffer pointer and the allocation method.
*
* @note Need to find a better solution - one library should not
+++ /dev/null
-#ifndef DALI_PIXEL_DEVEL_H
-#define DALI_PIXEL_DEVEL_H
-
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/images/pixel.h>
-
-namespace Dali
-{
-
-namespace DevelPixel
-{
-
-enum Format
-{
- INVALID = Dali::Pixel::INVALID,
- A8 = Dali::Pixel::A8,
- L8 = Dali::Pixel::L8,
- LA88 = Dali::Pixel::LA88,
- RGB565 = Dali::Pixel::RGB565,
- BGR565 = Dali::Pixel::BGR565,
- RGBA4444 = Dali::Pixel::RGBA4444,
- BGRA4444 = Dali::Pixel::BGRA4444,
- RGBA5551 = Dali::Pixel::RGBA5551,
- BGRA5551 = Dali::Pixel::BGRA5551,
- RGB888 = Dali::Pixel::RGB888,
- RGB8888 = Dali::Pixel::RGB8888,
- BGR8888 = Dali::Pixel::BGR8888,
- RGBA8888 = Dali::Pixel::RGBA8888,
- BGRA8888 = Dali::Pixel::BGRA8888,
- COMPRESSED_R11_EAC = Dali::Pixel::COMPRESSED_R11_EAC,
- COMPRESSED_SIGNED_R11_EAC = Dali::Pixel::COMPRESSED_SIGNED_R11_EAC,
- COMPRESSED_RG11_EAC = Dali::Pixel::COMPRESSED_RG11_EAC,
- COMPRESSED_SIGNED_RG11_EAC = Dali::Pixel::COMPRESSED_SIGNED_RG11_EAC,
- COMPRESSED_RGB8_ETC2 = Dali::Pixel::COMPRESSED_RGB8_ETC2,
- COMPRESSED_SRGB8_ETC2 = Dali::Pixel::COMPRESSED_SRGB8_ETC2,
- COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = Dali::Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
- COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = Dali::Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
- COMPRESSED_RGBA8_ETC2_EAC = Dali::Pixel::COMPRESSED_RGBA8_ETC2_EAC,
- COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
- COMPRESSED_RGB8_ETC1 = Dali::Pixel::COMPRESSED_RGB8_ETC1,
- COMPRESSED_RGB_PVRTC_4BPPV1 = Dali::Pixel::COMPRESSED_RGB_PVRTC_4BPPV1,
- COMPRESSED_RGBA_ASTC_4x4_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR,
- COMPRESSED_RGBA_ASTC_5x4_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR,
- COMPRESSED_RGBA_ASTC_5x5_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR,
- COMPRESSED_RGBA_ASTC_6x5_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR,
- COMPRESSED_RGBA_ASTC_6x6_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR,
- COMPRESSED_RGBA_ASTC_8x5_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR,
- COMPRESSED_RGBA_ASTC_8x6_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR,
- COMPRESSED_RGBA_ASTC_8x8_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR,
- COMPRESSED_RGBA_ASTC_10x5_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR,
- COMPRESSED_RGBA_ASTC_10x6_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR,
- COMPRESSED_RGBA_ASTC_10x8_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR,
- COMPRESSED_RGBA_ASTC_10x10_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR,
- COMPRESSED_RGBA_ASTC_12x10_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR,
- COMPRESSED_RGBA_ASTC_12x12_KHR = Dali::Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
- COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
-
- /**
- * @brief Color depth 48-bit, 16-16-16 half floating point.
- */
- RGB16F = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR + 1,
-
- /**
- * @brief Color depth 96-bit, 32-32-32 floating point.
- */
- RGB32F = Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR + 2,
-
-};
-
-} // namespace DevelPixel
-
-} // namespace Dali
-
-#endif // DALI_PIXEL_DEVEL_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
break;
}
+ // GLES 3.0 floating point formats.
+ case RGB16F:
+ {
+ DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n" );
+ pixelDataType = GL_HALF_FLOAT;
+ internalFormat= GL_RGB;
+ break;
+ }
+ case RGB32F:
+ {
+ DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n" );
+ pixelDataType = GL_FLOAT;
+ internalFormat= GL_RGB;
+ break;
+ }
+
case INVALID:
{
DALI_LOG_ERROR( "Invalid pixel format for bitmap\n" );
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
bitMask=0;
break;
}
+
+ case Dali::Pixel::RGB16F:
+ case Dali::Pixel::RGB32F:
+ {
+ DALI_LOG_ERROR("Pixel format not compatible.\n");
+ byteOffset=0;
+ bitMask=0;
+ break;
+ }
}
}
#include <math.h> //floor, log2
// INTERNAL INCLUDES
-#include <dali/devel-api/images/pixel-devel.h>
#include <dali/devel-api/images/native-image-interface-extension.h>
namespace Dali
* @param[out] glInternalFormat The gl internal format.
* @param[out] pixelDataType The data type of the pixel data.
*/
-void PixelFormatToGl( DevelPixel::Format pixelFormat, GLenum& glFormat, GLint& glInternalFormat, GLenum& pixelDataType )
+void PixelFormatToGl( Pixel::Format pixelFormat, GLenum& glFormat, GLint& glInternalFormat, GLenum& pixelDataType )
{
// Compressed textures have no pixelDataType, so init to an invalid value:
pixelDataType = -1;
}
// GLES 3.0 floating point formats.
- case DevelPixel::RGB16F:
+ case Pixel::RGB16F:
{
glFormat = GL_RGB;
pixelDataType = GL_HALF_FLOAT;
break;
}
- case DevelPixel::RGB32F:
+ case Pixel::RGB32F:
{
glFormat = GL_RGB;
pixelDataType = GL_FLOAT;
switch( pixelFormat )
{
- case DevelPixel::RGB16F:
- case DevelPixel::RGB32F: // FALL THROUGH
+ case Pixel::RGB16F:
+ case Pixel::RGB32F: // FALL THROUGH
{
glInternalFormat = GL_R11F_G11F_B10F;
break;
case Pixel::BGR8888:
case Pixel::RGBA8888:
case Pixel::BGRA8888:
+ case Pixel::RGB16F:
+ case Pixel::RGB32F:
case Pixel::INVALID:
{
return false;
mHasAlpha( HasAlpha( format ) ),
mIsCompressed( IsCompressedFormat( format ) )
{
- PixelFormatToGl( static_cast<DevelPixel::Format>( format ),
+ PixelFormatToGl( format,
mGlFormat,
mGlInternalFormat,
mPixelDataType );
GLenum glFormat;
GLint glInternalFormat;
GLenum pixelDataElementType;
- PixelFormatToGl( static_cast<DevelPixel::Format>( pixelData->GetPixelFormat() ), glFormat, glInternalFormat, pixelDataElementType );
+ PixelFormatToGl( pixelData->GetPixelFormat(), glFormat, glInternalFormat, pixelDataElementType );
//Get the maximum mipmap level to set GL_TEXTURE_MAX_LEVEL parameter in GLES3x because is not
//necessary to upload all the mipmap levels
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
case COMPRESSED_SRGB8_ETC2:
case COMPRESSED_RGB8_ETC1:
case COMPRESSED_RGB_PVRTC_4BPPV1:
+ case RGB16F:
+ case RGB32F:
case INVALID:
{
return false;
return 4;
}
+ case RGB16F:
+ {
+ return 12;
+ }
+
+ case RGB32F:
+ {
+ return 24;
+ }
+
case COMPRESSED_R11_EAC:
case COMPRESSED_SIGNED_R11_EAC:
case COMPRESSED_RG11_EAC:
case COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
case COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
case COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
+ case RGB16F:
+ case RGB32F:
case INVALID:
{
DALI_LOG_ERROR("Pixel formats for compressed images are not compatible with simple masking-out of per-pixel alpha.\n");
#define __DALI_PIXEL_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 12x10 block-size. @SINCE_1_1.17
COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 12x12 block-size. @SINCE_1_1.17
+ // GLES 3.0 floating point formats.
+ RGB16F, ///< Color depth 48-bit, 16-16-16 half floating point. @SINCE_1_2.60
+ RGB32F, ///< Color depth 96-bit, 32-32-32 floating point. @SINCE_1_2.60
+
///! Update LAST_VALID_PIXEL_FORMAT below if you add an enum value here.
};
*
* Sync it to the last value above.
*/
-const Format LAST_VALID_PIXEL_FORMAT = COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;
+const Format LAST_VALID_PIXEL_FORMAT = RGB32F;
/**
* @brief Whether specified pixel format contains an alpha value.