本文整理汇总了C++中ImageAttributes::GetCrop方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageAttributes::GetCrop方法的具体用法?C++ ImageAttributes::GetCrop怎么用?C++ ImageAttributes::GetCrop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageAttributes
的用法示例。
在下文中一共展示了ImageAttributes::GetCrop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UtcDaliScriptingNewImage
//.........这里部分代码省略.........
Image image = NewImage( map );
DALI_TEST_EQUALS( image.GetWidth(), 10.0f, TEST_LOCATION );
DALI_TEST_EQUALS( image.GetHeight(), 20.0f, TEST_LOCATION );
}
// int width and height
map.erase( map.end() - 2, map.end() );
map.push_back( Property::StringValuePair( "width", 50 ) );
map.push_back( Property::StringValuePair( "height", 70 ) );
{
Image image = NewImage( map );
DALI_TEST_EQUALS( image.GetWidth(), 50u, TEST_LOCATION );
DALI_TEST_EQUALS( image.GetHeight(), 70u, TEST_LOCATION );
}
//map.erase( map.end() - 2, map.end() );
// pixel-format
map.push_back( Property::StringValuePair( "pixel-format", "" ) );
{
const StringEnum values[] =
{
{ "A8", Pixel::A8 },
{ "L8", Pixel::L8 },
{ "LA88", Pixel::LA88 },
{ "RGB565", Pixel::RGB565 },
{ "BGR565", Pixel::BGR565 },
{ "RGBA4444", Pixel::RGBA4444 },
{ "BGRA4444", Pixel::BGRA4444 },
{ "RGBA5551", Pixel::RGBA5551 },
{ "BGRA5551", Pixel::BGRA5551 },
{ "RGB888", Pixel::RGB888 },
{ "RGB8888", Pixel::RGB8888 },
{ "BGR8888", Pixel::BGR8888 },
{ "RGBA8888", Pixel::RGBA8888 },
{ "BGRA8888", Pixel::BGRA8888 },
{ "COMPRESSED_R11_EAC", Pixel::COMPRESSED_R11_EAC },
{ "COMPRESSED_SIGNED_R11_EAC", Pixel::COMPRESSED_SIGNED_R11_EAC },
{ "COMPRESSED_RG11_EAC", Pixel::COMPRESSED_RG11_EAC },
{ "COMPRESSED_SIGNED_RG11_EAC", Pixel::COMPRESSED_SIGNED_RG11_EAC },
{ "COMPRESSED_RGB8_ETC2", Pixel::COMPRESSED_RGB8_ETC2 },
{ "COMPRESSED_SRGB8_ETC2", Pixel::COMPRESSED_SRGB8_ETC2 },
{ "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 },
{ "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 },
{ "COMPRESSED_RGBA8_ETC2_EAC", Pixel::COMPRESSED_RGBA8_ETC2_EAC },
{ "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC },
{ "COMPRESSED_RGB8_ETC1", Pixel::COMPRESSED_RGB8_ETC1 },
{ "COMPRESSED_RGB_PVRTC_4BPPV1", Pixel::COMPRESSED_RGB_PVRTC_4BPPV1 },
{ "A8", Pixel::A8 }, // Checked already but reset so that BitmapImage works
};
TestEnumStrings< Pixel::Format, ImageAttributes >( map, values, ( sizeof( values ) / sizeof ( values[0] ) ), &ImageAttributes::GetPixelFormat, &NewImageAttributes );
}
// scaling-mode
map.push_back( Property::StringValuePair( "scaling-mode", "" ) );
{
const StringEnum values[] =
{
{ "SHRINK_TO_FIT", ImageAttributes::ShrinkToFit },
{ "SCALE_TO_FILL", ImageAttributes::ScaleToFill },
{ "FIT_WIDTH", ImageAttributes::FitWidth },
{ "FIT_HEIGHT", ImageAttributes::FitHeight },
};
TestEnumStrings< ImageAttributes::ScalingMode, ImageAttributes >( map, values, ( sizeof( values ) / sizeof ( values[0] ) ), &ImageAttributes::GetScalingMode, &NewImageAttributes );
}
// crop
map.push_back( Property::StringValuePair( "crop", Vector4( 50, 60, 70, 80 ) ) );
{
Image image = NewImage( map );
ImageAttributes attributes = image.GetAttributes();
Rect<float> crop = attributes.GetCrop();
DALI_TEST_EQUALS( crop.x, 50, TEST_LOCATION );
DALI_TEST_EQUALS( crop.y, 60, TEST_LOCATION );
DALI_TEST_EQUALS( crop.width, 70, TEST_LOCATION );
DALI_TEST_EQUALS( crop.height, 80, TEST_LOCATION );
}
// type FrameBufferImage
map.push_back( Property::StringValuePair( "type", "FrameBufferImage" ) );
{
Image image = NewImage( map );
DALI_TEST_CHECK( FrameBufferImage::DownCast( image ) );
}
// type BitMapImage
(map.end() - 1)->second = "BitmapImage";
{
Image image = NewImage( map );
DALI_TEST_CHECK( BitmapImage::DownCast( image ) );
}
// type Image
(map.end() - 1)->second = "Image";
{
Image image = NewImage( map );
DALI_TEST_CHECK( Image::DownCast( image ) );
DALI_TEST_CHECK( !FrameBufferImage::DownCast( image ) );
DALI_TEST_CHECK( !BitmapImage::DownCast( image ) );
}
END_TEST;
}