本文整理汇总了C++中IDirectFB::CreateImageProvider方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFB::CreateImageProvider方法的具体用法?C++ IDirectFB::CreateImageProvider怎么用?C++ IDirectFB::CreateImageProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFB
的用法示例。
在下文中一共展示了IDirectFB::CreateImageProvider方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
DFBImageProvider::DFBImageProvider(const char* mrl) {
IDirectFB* dfb = NULL;
decoder = NULL;
if (mrl != NULL) {
dfb = (IDirectFB*)(LocalDeviceManager::getInstance()->getGfxRoot());
DFBCHECK(dfb->CreateImageProvider(dfb, mrl, &decoder));
}
}
示例2: main
int main( int argc, char *argv[] )
{
IDirectFB *dfb;
IDirectFBDisplayLayer *layer;
IDirectFBSurface *bgsurface;
IDirectFBImageProvider *provider;
IDirectFBWindow *window1;
IDirectFBWindow *window2;
IDirectFBSurface *window_surface1;
IDirectFBSurface *window_surface2;
IDirectFBEventBuffer *buffer;
DFBDisplayLayerConfig layer_config;
#if ((DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23))
DFBCardCapabilities caps;
#else
DFBGraphicsDeviceDescription caps;
#endif
IDirectFBWindow* upper;
DFBWindowID id1;
IDirectFBFont *font;
int fontheight;
int err;
int quit = 0;
DFBCHECK(DirectFBInit( &argc, &argv ));
DFBCHECK(DirectFBCreate( &dfb ));
#if ((DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23))
dfb->GetCardCapabilities( dfb, &caps );
#else
dfb->GetDeviceDescription( dfb, &caps );
#endif
dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );
if (!((caps.blitting_flags & DSBLIT_BLEND_ALPHACHANNEL) &&
(caps.blitting_flags & DSBLIT_BLEND_COLORALPHA )))
{
layer_config.flags = DLCONF_BUFFERMODE;
layer_config.buffermode = DLBM_BACKSYSTEM;
layer->SetConfiguration( layer, &layer_config );
}
layer->GetConfiguration( layer, &layer_config );
layer->EnableCursor ( layer, 1 );
{
DFBFontDescription desc;
desc.flags = DFDESC_HEIGHT;
desc.height = layer_config.width/50;
DFBCHECK(dfb->CreateFont( dfb, PACKAGE_DATA_DIR"/grunge.ttf", &desc, &font ));
font->GetHeight( font, &fontheight );
}
{
DFBSurfaceDescription desc;
DFBCHECK(dfb->CreateImageProvider( dfb,
PACKAGE_DATA_DIR"/bg.png",
&provider ));
desc.flags = DSDESC_WIDTH | DSDESC_HEIGHT;
desc.width = layer_config.width;
desc.height = layer_config.height;
DFBCHECK(dfb->CreateSurface( dfb, &desc, &bgsurface ) );
provider->RenderTo( provider, bgsurface, NULL );
provider->Release( provider );
DFBCHECK(bgsurface->SetFont( bgsurface, font ));
bgsurface->SetColor( bgsurface, 0xCF, 0xCF, 0xFF, 0xFF );
bgsurface->DrawString( bgsurface,
"Move the mouse over a window to activate it.",
-1, 10, 0, DSTF_LEFT | DSTF_TOP );
bgsurface->SetColor( bgsurface, 0xFF, 0xCF, 0xFF, 0xFF );
bgsurface->DrawString( bgsurface,
"You can drag them around, too, if you want.",
-1, 10 , 40, DSTF_LEFT | DSTF_TOP );
bgsurface->SetColor( bgsurface, 0xCF, 0xCF, 0xFF, 0xFF );
bgsurface->DrawString( bgsurface,
"The one with funky stuff happening and things flying around is an evas.",
-1, 10, 80, DSTF_LEFT | DSTF_TOP );
//.........这里部分代码省略.........
示例3: main
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 );
//.........这里部分代码省略.........
示例4: main
//------------------------------------------------------------------------------
// Unit Test main
//------------------------------------------------------------------------------
int main (int argc, char **argv)
{
int i, j;
DFBResult rle_build_databuffer_err;
// File name to load logo image from
char *filename = NULL;
// Basic directfb elements
IDirectFB *dfb = NULL;
IDirectFBSurface *primary = NULL;
int screen_width = 0;
int screen_height = 0;
// The image is to be loaded into a surface that we can blit from.
IDirectFBSurface *logo = NULL;
// Loading an image is done with an Image Provider.
IDirectFBImageProvider *provider = NULL;
// An Image provider instance can also be created from a directfb buffer
IDirectFBDataBuffer *databuffer = NULL;
// Surface description
DFBSurfaceDescription surface_dsc;
// Initialize directfb first
DFBCHECK (DirectFBInit (&argc, &argv));
DFBCHECK (DirectFBCreate (&dfb));
DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
// Create primary surface
surface_dsc.flags = DSDESC_CAPS;
surface_dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
DFBCHECK (dfb->CreateSurface( dfb, &surface_dsc, &primary ));
DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
if (argc==1)
{
argv[1] = "./data/directfb.rle";
argc++;
}
DISPLAY_INFO ("Rendering %d files\n",argc-1);
for (j=1; j<argc; j++)
{
//
// --- WE CREATE OUR IMAGE PROVIDER INSTANCE HERE
//
filename = argv[j];
DISPLAY_INFO ("Rendering : %s\n",filename);
// We create a directfb data buffer holding RLE image contents that we
// pick up from a file (could get the RLE contents from memory as well).
// "rle_build_databuffer" details the process of dealing with a memory
// RLE packet as a matter of fact.
rle_build_databuffer_err = rle_build_databuffer (dfb, filename, &databuffer);
if (rle_build_databuffer_err == DFB_OK) {
// We want to create an Image Provider tied to a directfb data buffer.
// DirectFB will find (or not) an Image Provider for the data type
// depending on Image Providers probe method (sniffing data headers)
DFBCHECK (databuffer->CreateImageProvider (databuffer, &provider));
}
else {
# ifdef USE_PACKET_BUILDER_ONLY
DFBFAIL(rle_build_databuffer_err);
# else
// We could also create an Image Provider by passing a filename.
// DirectFB will find (or not) an Image Provider matching the file type.
DFBCHECK (dfb->CreateImageProvider (dfb, filename, &provider));
# endif
}
// Get a surface description from the provider. It will contain the width,
// height, bits per pixel and the flag for an alphachannel if the image
// has one. If the image has no alphachannel the bits per pixel is set to
// the bits per pixel of the primary layer to use simple blitting without
// pixel format conversion.
DFBCHECK (provider->GetSurfaceDescription (provider, &surface_dsc));
// Create a surface based on the description of the provider.
DFBCHECK (dfb->CreateSurface( dfb, &surface_dsc, &logo ));
// Let the provider render to our surface. Image providers are supposed
// to support every destination pixel format and size. If the size
// differs the image will be scaled (bilinear). The last parameter allows
// to specify an optional destination rectangle. We use NULL here so that
// our image covers the whole logo surface.
DFBCHECK (provider->RenderTo (provider, logo, NULL));
// Note: RLE Image Provider allows for direct non-scaled LUT-8 surface
// rendering without any attached colormap.
//.........这里部分代码省略.........
示例5: main
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;
DFBSurfacePixelFormat source_format = DSPF_UNKNOWN;
DFBSurfacePixelFormat dest_format = DSPF_UNKNOWN;
bool dest_resize = false;
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/Blit: DirectFBInit() failed!\n" );
return ret;
}
/* Parse arguments. */
for (i=1; i<argc; i++) {
const char *arg = argv[i];
if (strcmp( arg, "-h" ) == 0 || strcmp (arg, "--help") == 0)
return print_usage( argv[0] );
else if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
fprintf (stderr, "dfbtest_blit version %s\n", DIRECTFB_VERSION);
return false;
}
else if (strcmp (arg, "-s") == 0 || strcmp (arg, "--source") == 0) {
if (++i == argc) {
print_usage (argv[0]);
return false;
}
if (!parse_format( argv[i], &source_format ))
return false;
}
else if (strcmp (arg, "-d") == 0 || strcmp (arg, "--dest") == 0) {
if (++i == argc) {
print_usage (argv[0]);
return false;
}
if (!parse_format( argv[i], &dest_format ))
return false;
}
else if (strcmp (arg, "-r") == 0 || strcmp (arg, "--resize") == 0)
dest_resize = true;
else if (!url)
url = arg;
else
return print_usage( argv[0] );
}
/* Check if we got an URL. */
if (!url)
return print_usage( argv[0] );
/* Create super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Blit: 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/Blit: IDirectFB::CreateImageProvider( '%s' ) failed!\n", url );
goto out;
}
/* Get the surface description. */
ret = provider->GetSurfaceDescription( provider, &desc );
if (ret) {
D_DERROR( ret, "DFBTest/Blit: IDirectFBImageProvider::GetSurfaceDescription() failed!\n" );
goto out;
}
if (source_format != DSPF_UNKNOWN)
desc.pixelformat = source_format;
D_INFO( "DFBTest/Blit: 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/Blit: IDirectFB::CreateSurface() failed!\n" );
goto out;
}
ret = provider->RenderTo( provider, source, NULL );
if (ret) {
D_DERROR( ret, "DFBTest/Blit: IDirectFBImageProvider::RenderTo() failed!\n" );
goto out;
//.........这里部分代码省略.........
示例6: main
int
main( int argc, char *argv[] )
{
int i;
DFBResult ret;
DFBSurfaceDescription desc;
IDirectFB *dfb;
IDirectFBImageProvider *provider = NULL;
IDirectFBSurface *source = NULL;
IDirectFBSurface *dest = NULL;
IDirectFBSurface *dest2 = NULL;
const char *url = NULL;
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: DirectFBInit() failed!\n" );
return ret;
}
/* 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] );
/* 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_NV21;
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;
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;
}
DFBRectangle srect = {
10, 10, 200, 200
};
DFBRectangle drect = {
10, 10, 300, 300
};
DFBRegion clip = {
40, 40, 199, 199
};
dest->Clear( dest, 0xff, 0xff, 0xff, 0xff );
//.........这里部分代码省略.........