On 6/1/07, Claudio Ciccani <[EMAIL PROTECTED]> wrote:

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.


sorry, I mean that I want to use a surface as buffer to draw string
and after drawing the contents, blit it to primary surface...
the buffer surface is not the subsurface of 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.


thanks, but I tried that flag,
the alpha values were not copied from the surface and still set to 255??
is there still anything wrong?



> 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