Creating an empty (as in transparent) bitmap.

Ragnar Ouchterlony wrote:

The problem here is that the background won't be transparent in the
resulting bitmap. I have tried using "useMask" with both True and False
values, but nothing helps.

How do I make the new bitmap just like a concatenation of a number of
copies of the original bitmap?

You also need to set the mask of the resulting bitmap. One way to do that is to fill the bitmap with a certain colour before you start drawing the stars on it, and then set a mask using that colour after you are done. For example:

  ...
  image.SetBackground(wxBrush("MAGENTA"))
  image.Clear()
  ...

  bmp.SetMaskColour("MAGENTA")

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin

I notice that the bitmaps in images.py in the demo have a magenta
background. Is the magenta masked applied somewhere like in the
wxImageList Add method and if I supply bitmaps with magenta
backgrounds there will be treated similarly?

Nigel

···

On Thu, 02 Oct 2003 09:24:29 -0700 Robin Dunn <robin@alldunn.com> wrote:

Ragnar Ouchterlony wrote:
>
> The problem here is that the background won't be transparent in the
> resulting bitmap. I have tried using "useMask" with both True and False
> values, but nothing helps.
>
> How do I make the new bitmap just like a concatenation of a number of
> copies of the original bitmap?

You also need to set the mask of the resulting bitmap. One way to do
that is to fill the bitmap with a certain colour before you start
drawing the stars on it, and then set a mask using that colour after you
are done. For example:

        ...
        image.SetBackground(wxBrush("MAGENTA"))
        image.Clear()
        ...

        bmp.SetMaskColour("MAGENTA")
        
--
Nigel W. Moriarty
Building 4R0230
Physical Biosciences Division
Lawrence Berkeley National Laboratory
Berkeley, CA 94720-8235
Phone : 510-486-5709
Fax : 510-486-5909
Email : NWMoriarty@LBL.gov
Web : CCI.LBL.gov

Nigel Moriarty wrote:

Robin

I notice that the bitmaps in images.py in the demo have a magenta
background. Is the magenta masked applied somewhere like in the
wxImageList Add method and if I supply bitmaps with magenta
backgrounds there will be treated similarly?

No, there is nothing special about magenta that I know of. Many of the images in the demo already have a transparent/alpha setting that gets turned into a mask when loaded. Others have a mask that is created by colour when the images are encoded into images.py, see encode_bitmaps.py.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!