Texture CubeTransitionApp::LoadStageFillingTexture( const char* filepath ) { ImageDimensions dimensions( Stage::GetCurrent().GetSize().x, Stage::GetCurrent().GetSize().y ); BitmapLoader loader = BitmapLoader::New( filepath, dimensions, FittingMode::SCALE_TO_FILL ); loader.Load(); PixelData pixelData = loader.GetPixelData(); Texture texture = Texture::New( TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() ); texture.Upload( pixelData ); return texture; }
int UtcDaliPixelData01(void) { TestApplication application; unsigned int width = 10u; unsigned int height = 10u; unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::RGB888 ); unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) ); PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE ); DALI_TEST_CHECK( pixelData ); DALI_TEST_CHECK( pixelData.GetWidth() == width ); DALI_TEST_CHECK( pixelData.GetHeight() == height ); DALI_TEST_CHECK( pixelData.GetPixelFormat() == Pixel::RGB888 ); END_TEST; }
int UtcDaliPixelData02(void) { TestApplication application; unsigned int width = 10u; unsigned int height = 10u; unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::L8 ); unsigned char* buffer = new unsigned char [ bufferSize ]; buffer[0] = 'a'; PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY ); DALI_TEST_CHECK( pixelData); DALI_TEST_CHECK( pixelData.GetWidth() == width ); DALI_TEST_CHECK( pixelData.GetHeight() == height ); DALI_TEST_CHECK( pixelData.GetPixelFormat() == Pixel::L8 ); END_TEST; }