本文整理汇总了C++中IDirectFBSurface::Dump方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBSurface::Dump方法的具体用法?C++ IDirectFBSurface::Dump怎么用?C++ IDirectFBSurface::Dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFBSurface
的用法示例。
在下文中一共展示了IDirectFBSurface::Dump方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DirectFBInit
int
main( int argc, char *argv[] )
{
DFBResult ret;
DFBSurfaceDescription desc;
IDirectFB *dfb;
IDirectFBSurface *surface;
IWater *water;
D_INFO( "Tests/Water: Starting up...\n" );
/* Initialize DirectFB including command line parsing. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
DirectFBError( "DirectFBInit() failed", ret );
return -1;
}
/* Parse the command line. */
if (!parse_command_line( argc, argv ))
return -2;
/* Create the super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
DirectFBError( "DirectFBCreate() failed", ret );
return -3;
}
/* Fill surface description, flipping primary. */
desc.flags = DSDESC_CAPS;
desc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
/* Set width or height? */
if (m_width > 0) {
desc.flags |= DSDESC_WIDTH;
desc.width = m_width;
}
if (m_height > 0) {
desc.flags |= DSDESC_HEIGHT;
desc.height = m_height;
}
/* Set pixel format? */
if (m_format != DSPF_UNKNOWN) {
desc.flags |= DSDESC_PIXELFORMAT;
desc.pixelformat = m_format;
}
dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
/* Create a primary surface. */
ret = dfb->CreateSurface( dfb, &desc, &surface );
if (ret) {
D_DERROR( ret, "IDirectFB::CreateSurface() failed!\n" );
dfb->Release( dfb );
return -4;
}
/* Get the extended rendering interface. */
ret = dfb->GetInterface( dfb, "IWater", NULL, dfb, (void**) &water );
if (ret) {
DirectFBError( "IDirectFB::GetInterface( 'IWater' ) failed", ret );
surface->Release( surface );
dfb->Release( dfb );
return -5;
}
D_INFO( "Tests/Water: Got render interface, running tests...\n" );
RunTest( Test_Simple, water, surface );
RunTest( Test_RenderElement, water, surface );
RunTest( Test_RenderElements, water, surface );
RunTest( Test_RenderShape, water, surface );
RunTest( Test_RenderShapes, water, surface );
D_INFO( "Tests/Water: Dumping surface...\n" );
unlink( "dfbrender.pgm" );
unlink( "dfbrender.ppm" );
surface->Dump( surface, "dfbrender", NULL );
D_INFO( "Tests/Water: Shutting down...\n" );
/* Release the render interface. */
water->Release( water );
/* Release the surface. */
surface->Release( surface );
/* Release the super interface. */
dfb->Release( dfb );
//.........这里部分代码省略.........
示例2: show_usage
int
main( int argc, char *argv[] )
{
int i;
DFBResult ret;
DFBSurfaceDescription desc;
IDirectFB *dfb;
IDirectFBImageProvider *provider = NULL;
IDirectFBSurface *source = NULL;
IDirectFBSurface *dest = NULL;
const char *url = NULL;
/* Parse arguments. */
for (i=1; i<argc; i++) {
if (!strcmp( argv[i], "-h" ))
return show_usage( argv[0] );
else if (!url)
url = argv[i];
else
return show_usage( argv[0] );
}
/* Check if we got an URL. */
if (!url)
return show_usage( argv[0] );
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: DirectFBInit() failed!\n" );
return ret;
}
/* Create super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: DirectFBCreate() failed!\n" );
return ret;
}
/* Create an image provider for the image to be loaded. */
ret = dfb->CreateImageProvider( dfb, url, &provider );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: IDirectFB::CreateImageProvider( '%s' ) failed!\n", url );
goto out;
}
/* Get the surface description. */
ret = provider->GetSurfaceDescription( provider, &desc );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: IDirectFBImageProvider::GetSurfaceDescription() failed!\n" );
goto out;
}
desc.pixelformat = DSPF_LUT8;
D_INFO( "DFBTest/Scale: Source is %dx%d using %s\n",
desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
/* Create a surface for the image. */
ret = dfb->CreateSurface( dfb, &desc, &source );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: IDirectFB::CreateSurface() failed!\n" );
goto out;
}
ret = provider->RenderTo( provider, source, NULL );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: IDirectFBImageProvider::RenderTo() failed!\n" );
goto out;
}
desc.width = desc.width * 3 / 4;
desc.height = desc.height * 3 / 4;
if (DFB_PIXELFORMAT_IS_INDEXED( desc.pixelformat ))
desc.pixelformat = DSPF_ARGB;
D_INFO( "DFBTest/Scale: Destination is %dx%d using %s\n",
desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
/* Create a surface for the image. */
ret = dfb->CreateSurface( dfb, &desc, &dest );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: IDirectFB::CreateSurface() failed!\n" );
goto out;
}
dest->SetBlittingFlags( dest, DSBLIT_SRC_PREMULTIPLY );
dest->StretchBlit( dest, source, NULL, NULL );
dest->Dump( dest, "dfbtest_scale", NULL );
out:
if (dest)
dest->Release( dest );
if (source)
source->Release( source );
//.........这里部分代码省略.........