// Internal headers are allowed here
#include <dali/internal/imaging/common/pixel-manipulation.h>
+#include <dali/devel-api/adaptor-framework/image-loading.h>
using namespace Dali;
using namespace Dali::Internal::Adaptor;
+
+namespace
+{
+
+// resolution: 96*96, pixel format: LA88
+const char* TEST_IMAGE_LA88 = TEST_IMAGE_DIR "/circle1-LA88.png";
+
+} // namespace
+
void utc_dali_internal_pixel_data_startup()
{
test_return_value = TET_UNDEF;
END_TEST;
}
+int UtcDaliPixelManipulationLA88(void)
+{
+ tet_infoline("Testing Dali::Internal::AdaptorManipulation Read/WriteChannel - LA88 format");
+
+ Devel::PixelBuffer pixelBuffer = Dali::LoadImageFromFile(TEST_IMAGE_LA88);
+ DALI_TEST_CHECK(pixelBuffer);
+
+ unsigned int width = pixelBuffer.GetWidth();
+ unsigned int height = pixelBuffer.GetHeight();
+ DALI_TEST_EQUALS(width, 96u, TEST_LOCATION);
+ DALI_TEST_EQUALS(height, 96u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBuffer.GetPixelFormat(), Pixel::LA88, TEST_LOCATION);
+
+ unsigned char* pixel = pixelBuffer.GetBuffer();
+ unsigned int value;
+
+ value = Dali::Internal::Adaptor::ReadChannel(&pixel[0], Dali::Pixel::LA88, Dali::Internal::Adaptor::LUMINANCE);
+ DALI_TEST_EQUALS(value, 0x0, TEST_LOCATION);
+ value = Dali::Internal::Adaptor::ReadChannel(&pixel[0], Dali::Pixel::LA88, Dali::Internal::Adaptor::ALPHA);
+ DALI_TEST_EQUALS(value, 0x0, TEST_LOCATION);
+
+ // Get center pixel
+ unsigned int stride = width * Pixel::GetBytesPerPixel(Dali::Pixel::LA88);
+ unsigned int center = height / 2 * stride + width / 2 * Pixel::GetBytesPerPixel(Dali::Pixel::LA88);
+ value = Dali::Internal::Adaptor::ReadChannel(&pixel[center], Dali::Pixel::LA88, Dali::Internal::Adaptor::LUMINANCE);
+ DALI_TEST_EQUALS(value, 0x0, TEST_LOCATION);
+ value = Dali::Internal::Adaptor::ReadChannel(&pixel[center], Dali::Pixel::LA88, Dali::Internal::Adaptor::ALPHA);
+ DALI_TEST_EQUALS(value, 0xFF, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliPixelManipulation03N(void)
{
tet_infoline("Testing Dali::Internal::AdaptorManipulation Read/WriteChannel");
constexpr Channel ALPHA_CHANNEL_ONLY[] = {ALPHA};
constexpr Channel LUMINANCE_CHANNEL_ONLY[] = {LUMINANCE};
-constexpr Channel LUMINANCE_ALPHA_CHANNELS[] = {ALPHA, LUMINANCE};
+constexpr Channel LUMINANCE_ALPHA_CHANNELS[] = {LUMINANCE, ALPHA};
constexpr Channel RGB_CHANNELS[] = {RED, GREEN, BLUE};
constexpr Channel BGR_CHANNELS[] = {BLUE, GREEN, RED};
constexpr Channel RGBA_CHANNELS[] = {RED, GREEN, BLUE, ALPHA};