realbasic-games
[Top] [All Lists]

Re: Flipping a picture

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Flipping a picture
From: Phil M <phil at mobleybros dot com>
Date: Mon, 27 Jun 2005 20:54:36 +0200
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <263AFD9E-BFBF-49F1-BF85-D5706AD19441 at gmail dot com> <a0620072dbee5d8d25316 at [10 dot 10 dot 13 dot 4]> <4CE76E7F-9F4A-43E0-85B4-8E5150676A5F at gmail dot com> <94c62357e5b111bb81dd1dd53e4e91dd at mobleybros dot com> <A1C992E4-1FBA-45BF-891D-A5F9447C7484 at gmail dot com>
On Jun 27, 2005, at 8:05 PM, Joel Reymont wrote:

For some reason the dest.Graphics.DrawPicture below does not copy the mask. I get my picture drawn on a white background. If, on the other hand, I add an extra DrawPicture for the mask then my shadows are of non-black color. What's going on here?

You are correct, but this code would only execute if the Depth is less than 16 (like 8). In which case there is no Mask; or at least I have not seen a case where an 8-bit image has a Mask. But just in case, here is the modified code to include the mask:

  If source.Depth < 16 Then
    // have to fix the picture so that there is an RGBSurface
    // so temporarily use dest to hold the new source
    dest = NewPicture(source.Width, source.Height, 32)
    If Not (source.Mask Is Nil) Then
      dest.Mask.Graphics.DrawPicture(source.Mask, 0, 0)
      source.Mask.Graphics.ForeColor = &c000000
      source.Mask.Graphics.FillRect(0, 0, source.Width, source.Height)
      dest.Graphics.DrawPicture(source, 0, 0)
      source.Mask.Graphics.DrawPicture(dest.Mask, 0, 0)
    Else
      dest.Graphics.DrawPicture(source, 0, 0)
    End If
    source = dest
  End If

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

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

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