Ticket #9486 (closed defect: fixed)

Opened 2 years ago

Last modified 15 months ago

Blit() fails for wxScreenDC and wxClientDC on Mac

Reported by: Utensil Owned by: kollivier
Priority: normal Milestone:
Component: wxOSX-Carbon Version: 2.8.7
Keywords: wxDC Blit Cc: gcc
Blocked By: Patch: no
Blocking:

Description

This bug's description is mentioned in the forum first time in

MacOS X: blitting from window gives greyscale image
 http://wxforum.shadonet.com/viewtopic.php?t=18156

And there was some technical discussion in
 http://wxforum.shadonet.com/viewtopic.php?t=18468. Because this thread is long and was mainly discussing something else, so I paste the related part here:

=======================================================
Auria:
A concern I have towards such a tool, is that on wxMac, Blitting screen captures with DCs is totally broken (screen DC just doesn't work, client DC gives grey and pale results), so unless it was fixed in trunk such tool will probably not work on all platforms anyway.

tierra:
Stefan has mentioned that there is no longer a common screen buffer under Quartz, so yes, this couldn't be done with a wxScreenDC on Mac with wxMAC_USE_CORE_GRAPHICS = 1.

I can't find any bug reports or mailing list discussions in regards to wxClientDC on Mac OS X returning greyscaled results. In fact, the only place I see any mention of this is in one of your own posts. If I run into this, I'm sure I can either come up with something, or we can fallback to wxMAC_USE_CORE_GRAPHICS = 0 for this utility. We are looking for screenshots of controls, not device contexts, so I don't think it will matter with this off on Mac OS X.

Auria:
Actually, in the very link you provided, the same problem is reported by another user, the OP And I actually met this problem when helping the wxSmith developer port his tool to the mac, with code that ran fine on both windows and linux, so I'm somewhat puzzled. Anyway I don't know that area of wx very much therefore I did not want to submit bug reports. Anyway we can get it done somehow or just another way, that's the important.

=======================================================

This bug is confirmed under Mac OS X against wx2.8.7. And it can be easily reproduced by the code snippet posted by upCase in post "How do I take a screenshot?" http://wxforum.shadonet.com/viewtopic.php?t=82&postdays=0&postorder=asc&start=30

Can anyone test and confirm it against trunk and/or Lepard? If you need a minimal prewritten test code, I'll attach it later.

Change History

  Changed 2 years ago by kollivier

  • owner set to kollivier
  • status changed from new to accepted

I've confirmed both problems, although they have separate causes. wxClientDC/wxWindowDC issues were caused by incorrect handling of alpha channels, which has been fixed in 2.8 branch in SVN and should be in 2.8.8.

wxScreenDC::GetAsBitmap() not working is actually a result of wxScreenDC not actually being a DC of the screen itself on Mac. So we basically need to write a GetAsBitmap() implementation there. I'm working on this at the moment.

  Changed 2 years ago by Utensil

Thank you :D

follow-up: ↓ 4   Changed 15 months ago by csomor

  • status changed from accepted to closed
  • resolution set to fixed

Kevin has added the code to blit from a wxScreenDC many months ago, the snippet above works for carbon, so I'm closing this ticket

in reply to: ↑ 3   Changed 15 months ago by bluecabbie

  • status changed from closed to reopened
  • resolution deleted

Replying to csomor:

Kevin has added the code to blit from a wxScreenDC many months ago, the snippet above works for carbon, so I'm closing this ticket

I am still seeing this problem.

Running MacOSX 10.5.7

Darwin cyclops.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386

--(2)> wx-config --version-full
2.8.4.0

Debug: ../src/common/dcgraph.cpp(775): assert "wxAssertFailure" failed in DoBlit(): Cannot Blit. Unable to get contents of DC as bitmap.

I am a bit new to wxWidgets, so let me know if I am reporting this in an incorrect way.

  Changed 15 months ago by csomor

  • status changed from reopened to closed
  • resolution set to fixed

you are using an outdated version, as you are stating your wx-config --version-full reports 2.8.4.0 (released somewhen in 07) and for this fix to exist it should be something along 2.8.8 or more, so you are using the version that came with Leopard and not a newer one

Note: See TracTickets for help on using tickets.