realbasic-plugins
[Top] [All Lists]

Re: Masked picture returned by plugin is broken on Win32

To: "REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>" <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: Masked picture returned by plugin is broken on Win32
From: William Yu <william at realsoftware dot com>
Date: Fri, 02 Jul 2004 15:33:31 -0500
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
List-help: <mailto:realbasic-plugins-request@lists.realsoftware.com?subject=help>
List-id: REALbasic Plugins <realbasic-plugins.lists.realsoftware.com>
List-post: <mailto:realbasic-plugins@lists.realsoftware.com>
On 7/2/04 2:54 PM, "Frank C" <lists at si-co dot com> wrote:

> Where "rgbPic" and "maskPic" are two 32bit REALpicture's created with
> REALBuildPictureFromBuffer. Like I said, the mask is properly drawn
> into rgbPic's mask property so this apparently works, but rgbPic
> doesn't blit masked when drawn in RB. A similar approach using
> REALSelectGraphics works fine on Mac OS.

Maybe I'm not understanding what you're trying to accomplish, but here's
something that works for me (as far as you've explained your problem, it
seems to me this is what you're trying to do):

REALpicture GetPicWithMask( REALcontrolInstance instance, long width, long
height, REALpicture rgbPic, REALpicture maskPic )
{
    #if TARGET_WIN32
        REALpicture pic = REALNewPicture( width, height, 32 );

        Rect bounds;
        bounds.left = 0;
        bounds.top = 0;
        bounds.right = width;
        bounds.bottom = height;
        REALgraphics graphics = REALGetPictureGraphics( pic );
        HDC theDC = REALGraphicsDC( graphics );
        REALDrawPicturePrimitive( theDC, rgbPic, &bounds, 0 );
        REALUnlockObject((REALobject)graphics);

        REALpicture mask = REALGetPictureMask( pic, true );

        graphics = REALGetPictureGraphics( mask );
        theDC = REALGraphicsDC( graphics );
        REALDrawPicturePrimitive( theDC, maskPic, &bounds, 0 );
        REALUnlockObject((REALobject)graphics);

        REALUnlockObject( (REALobject)mask );

        return pic;
    #endif

    return nil;
}


Regards,
William Yu
william at realsoftware dot com

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>