catch wrote:
> Hi,
> 
> I want to blit an ARGB subsurface to primary surface,
> 
> And the result I want is just copy the subsurface to primary surface,
> both color and alpha values.

If the subsurface belongs to the primary surface then you don't need to
copy the contents. A subsurfaces shares the same memory of the parent
surface, therefore, if you draw something on the subsurface, you are
effectively drawing on the primary surface.

> 
> For example, the ARGB of primary is ( a, r, g, b ), and that of sub is (
> a2, r2, g2, b2 )
> 
> After primary->blit( primary, sub ), the ARGB of primary will change to
> ( a2, r2, g2 ,b2 )
> 
> But I can 't achieve this result, there may be something wrong with the
> flags
> 
> Here is my code:
> 
>  
> 
> primary->SetPorterDuff( primary,  DSPD_SRC );
> 
> primary->SetBlittingFlags( primary, DSBLIT_BLEND_ALPHACHANNEL );
> 
> primary->SetDrawingFlags( primary, DSDRAW_BLEND );
> 
> primary->SetColor( primary, 0, 0, 255, 128 );
> 
> primary->FillRectangle( primary, 0, 0, width, height );
> 
> primary->Flip( primary, NULL, DSFLIP_WAITFORSYNC );
> 
> sub ->SetBlittingFlags(sub, DSBLIT_BLEND_ALPHACHANNEL );

If you simply want to copy the contents, set blittingflags to DSBLIT_NOFX.

> 
> sub->SetDrawingFlags( sub, DSDRAW_BLEND );
> 
> sub->SetColor(sub, 0, 0, 255, 128 );
> 
> sub->FillRectangle( sub, 0, 0, width, height );
> 
> sub->SetColor(sub, 255, 255, 255, 255 );
> 
> sub->DrawString(sub, buf, -1, 0, 0, DSTF_LEFT | DSTF_TOP );
> 
> sub->Flip( sub, NULL, DSFLIP_WAITFORSYNC );
> 
> primary->Blit( primary, sub, NULL, 0, 0 );
> 
>  
> 
> but after blit, the alpha values become 255, the rgb values is right
> 
> what 's wrong with the code?
> 
> Thanks!
> 

-- 
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