I need some help with some MemoryDC code

Hi all,

I’m trying to create a multilayer drawing system and I’m having some difficulties with the output.

The main problem is that colors are wrong (should have been matte red and matte green). It seams that they are somehow semi-transparent.

I don’t know what am I doing wrong.

Any idea is welcomed.

Thank you in advance.
Peter
P.S.
Trellis is very easy to install using easy_install :slight_smile:

multilayer.py (2.97 KB)

test.png

···


There is NO FATE, we are the creators.

Hello,

Looks how you describe it should on my machine (osx 10.4.11, wxpython2.8.7.1). So I couldn't really try anything, but I know that the way that alpha behaves in the memory dc is different between (windows/gtk) and mac. If the base bitmap you are drawing on is completely transparent try with an opaque one and see if it behaves differently.

multilayer.png

Thanks Cody,

Further development:
I’ve tried saving each individual layer to a PNG bitmap and what I discovered was even weirder.
In IrfanView the pngs look ok but when I load them in Adobe Photoshop it shows them empty.

Any ideas?

Peter
P.S.
wxpython 2.8.7.1 on an XP SP2 system with python 2.5.1

···

On Jan 17, 2008 12:17 PM, Cody Precord < codyprecord@gmail.com> wrote:

Hello,

Looks how you describe it should on my machine (osx 10.4.11,
wxpython2.8.7.1). So I couldn’t really try anything, but I know that
the way that alpha behaves in the memory dc is different between
(windows/gtk) and mac. If the base bitmap you are drawing on is

completely transparent try with an opaque one and see if it behaves
differently.

Regards,

Cody

On Jan 17, 2008, at 3:49 AM, Peter Damoc wrote:

Hi all,

I’m trying to create a multilayer drawing system and I’m having

some difficulties with the output.

The main problem is that colors are wrong (should have been matte
red and matte green). It seams that they are somehow semi-transparent.
I don’t know what am I doing wrong.

Any idea is welcomed.

Thank you in advance.
Peter
P.S.
Trellis is very easy to install using easy_install :slight_smile:

There is NO FATE, we are the creators.<
multilayer.py><test.png>

To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail: wxPython-users-
help@lists.wxwidgets.org


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org


There is NO FATE, we are the creators.

Problem solved (kinda)

I switched to a GCDC in the drawing code and now everything works as expected.

Peter

···

On Jan 17, 2008 12:49 PM, Peter Damoc < pdamoc@gmail.com> wrote:

Thanks Cody,

Further development:
I’ve tried saving each individual layer to a PNG bitmap and what I discovered was even weirder.
In IrfanView the pngs look ok but when I load them in Adobe Photoshop it shows them empty.

Any ideas?

Peter
P.S.
wxpython 2.8.7.1 on an XP SP2 system with python 2.5.1

On Jan 17, 2008 12:17 PM, Cody Precord < > > codyprecord@gmail.com> wrote:

Hello,

Looks how you describe it should on my machine (osx 10.4.11,
wxpython2.8.7.1). So I couldn’t really try anything, but I know that
the way that alpha behaves in the memory dc is different between
(windows/gtk) and mac. If the base bitmap you are drawing on is

completely transparent try with an opaque one and see if it behaves
differently.

Regards,

Cody

On Jan 17, 2008, at 3:49 AM, Peter Damoc wrote:

Hi all,

I’m trying to create a multilayer drawing system and I’m having

some difficulties with the output.

The main problem is that colors are wrong (should have been matte
red and matte green). It seams that they are somehow semi-transparent.
I don’t know what am I doing wrong.

Any idea is welcomed.

Thank you in advance.
Peter
P.S.
Trellis is very easy to install using easy_install :slight_smile:

There is NO FATE, we are the creators.<
multilayer.py><test.png>

To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail: wxPython-users-
help@lists.wxwidgets.org


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:

wxPython-users-help@lists.wxwidgets.org


There is NO FATE, we are the creators.


There is NO FATE, we are the creators.

Peter Damoc wrote:

I switched to a GCDC in the drawing code and now everything works as expected.

That's probably the way to go if you're working with an alpha channel. However, if you want to try DC again, you might try specifying the alpha channel when you create your Pens and Brushes.

By the way -- did you check out FloatCanvas? I'd much rather have you contributing to that than re-inventing it....

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Christopher Barker wrote:

Peter Damoc wrote:

I switched to a GCDC in the drawing code and now everything works as expected.

That's probably the way to go if you're working with an alpha channel. However, if you want to try DC again, you might try specifying the alpha channel when you create your Pens and Brushes.

That will work on OSX, but just because the wx.DC is essentially the same as wx.GCDC there. On Windows and GTK the alpha will be ignored in normal DCs.

···

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

Hi Chris,

I tried specifying the alpha channel in Pen and Brushes… I had no luck.

I’ve looked at FloatCanvas but it has a different target than what I’m trying to get.
I don’t plan to go that complex. Just a simple composite infrastructure.

Peter.

···

On Jan 17, 2008 8:09 PM, Christopher Barker Chris.Barker@noaa.gov wrote:

Peter Damoc wrote:

I switched to a GCDC in the drawing code and now everything works as
expected.

That’s probably the way to go if you’re working with an alpha channel.

However, if you want to try DC again, you might try specifying the alpha
channel when you create your Pens and Brushes.

By the way – did you check out FloatCanvas? I’d much rather have you
contributing to that than re-inventing it…

-Chris


Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax

Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org


There is NO FATE, we are the creators.

Peter Damoc wrote:

I tried specifying the alpha channel in Pen and Brushes.... I had no luck.

I think Robin answered that -- it only works right with DCs on OS-X

I've looked at FloatCanvas but it has a different target than what I'm trying to get.
I don't plan to go that complex. Just a simple composite infrastructure.

Well, if you don't need to zoom or pan, then you may be right, but it's really pretty easy to use -- the complex stuff has been written for you, that's the point!

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov