Hi all,

            I have set the Blitting Flag for the Source (i.e. secondary) ,
still the functionality of 

DSBLIT_SRC_COLORKEY is not working fine,  

 

Problem: 

When we blit the primary and secondary  surface, the primary surface 

Can copy pixel informations from the secondary surface that are not matching
the 

Source color key.    

 

Will the below program work for the above problem?

 

As you have suggested I have set the Source Color key for the source (i.e.
secondary) , still 

While blitting the source color key is also copied. 

 

Thanks and Regards,

Dharma

 

#include <directfb.h>

#include <time.h>

#include <stdio.h>

#include <stdlib.h>

#include <unistd.h>

#include <string.h>

 

static IDirectFB            *dfb     = NULL;

static IDirectFBSurface     *primary = NULL;

static IDirectFBSurface     *secondary = NULL;

static DFBRectangle rect;

 

int

main( int argc, char *argv[] )

{

 

     DFBResult             ret;

     DFBSurfaceDescription desc;

 

     /* Initialize DirectFB including command line parsing. */

     ret = DirectFBInit( &argc, &argv );

     if (ret) {

          DirectFBError( "DirectFBInit() failed", ret );

     }

 

     /* Create the super interface. */

     ret = DirectFBCreate( &dfb );

     if (ret) {

          DirectFBError( "DirectFBCreate() failed", ret );

     }     

     desc.flags       = DSDESC_CAPS;

     desc.caps        = DSCAPS_PRIMARY | DSCAPS_DOUBLE;     

     /* Create the primary surface. */

     ret = dfb->CreateSurface( dfb, &desc, &primary );

     if (ret) {

          DirectFBError( "IDirectFB::CreateSurface() failed", ret );


     }       

 

     rect.x = 0;     rect.y = 0;      rect.w = 50;      rect.h = 50;     

     ret = primary->GetSubSurface(primary,&rect,&secondary);     

      if (ret) {

          DirectFBError( "IDirectFB::CreateSurface() failed", ret );


     }     

    

     primary->Clear( primary, 0xFF, 0x00, 0xFF, 0xFF );       

     secondary->SetColor(secondary,0xFF,0x00,0x00,0xFF);   

     secondary->FillRectangle(secondary,0,0,50,50);   

    ret = secondary->SetBlittingFlags(secondary,DSBLIT_SRC_COLORKEY); 

     ret = secondary->SetSrcColorKey(secondary,0xFF,0x00,0x00);  

     secondary->Flip( secondary, NULL, 0 );      

                

     rect.x = 0;    rect.y = 0;    rect.w = 50;      rect.h = 50;     

      

    primary->Blit(primary,secondary,&rect,50,100);     

    primary->Flip( primary, NULL, 0 );

     sleep(100);

      

      /* Release the primary surface. */

     if (primary)

          primary->Release( primary );

     /* Release the super interface. */

     if (dfb)

          dfb->Release( dfb );

}

 

-----Original Message-----
From: Claudio Ciccani [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 29, 2007 7:13 PM
To: [EMAIL PROTECTED]
Cc: [email protected]; [EMAIL PROTECTED]
Subject: Re: [directfb-users] Blitting problem

 

Dharma wrote:

> Hi all,

> 

>               I have doubt in DSBLIT_SRC_COLORKEY. I have two surface

> called as primary and secondary surface. While Blitting (copying the

> 

> Secondary surface into primary), I need to copy pixel that doesn't match

> the source color key.

> 

> I have done like the below.

> 

> *ret = primary->SetBlittingFlags(primary,DSBLIT_SRC_COLORKEY); *

> 

> *ret = primary->SetSrcColorKey(primary,0xFF,0x00,0x00);      *

> 

> *primary->Blit(primary,secondary,&rect,50,100);*

> 

> * *

> 

> is any thing wrong with the code?  

> 

 

secondary->SetSrcColorKey(secondary,0xFF,0x00,0x00);

 

SrcColorkey applies to the source.

 

 

-- 

Regards,

     Claudio Ciccani

 

[EMAIL PROTECTED]

http://directfb.org

http://sf.net/projects/php-directfb

_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to