Opened 6 years ago

Last modified 3 years ago

#9486 infoneeded_new defect

Blit() fails for wxScreenDC and wxClientDC on Mac

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

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 (7)

comment:1 Changed 6 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.

comment:2 Changed 6 years ago by Utensil

Thank you :D

comment:3 follow-up: Changed 5 years ago by csomor

  • Resolution set to fixed
  • Status changed from accepted to closed

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

comment:4 in reply to: ↑ 3 Changed 5 years ago by bluecabbie

  • Resolution fixed deleted
  • Status changed from closed to reopened

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.

comment:5 Changed 5 years ago by csomor

  • Resolution set to fixed
  • Status changed from reopened to closed

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

comment:6 Changed 3 years ago by jedimark

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 2.8.7 to 2.8.12

It appears this problem has raised it's ugly head again..

wx2.8.12 Mac Unicode build. OS X 10.6.7

Only appears to be blitting part of the target area.. top part is black.

I unfortunately don't have access to a Mac to fully confirm details other than what I stated here.

comment:7 Changed 3 years ago by csomor

  • Status changed from reopened to infoneeded_new

I need a code sample to reproduce, otherwise I won't be able to fix whatever the reason might be ...

Note: See TracTickets for help on using tickets.