From: Wojciech K. <woj...@ko...> - 2013-11-29 09:23:06
|
Hi, I have recently noticed it myself and done some investigation on the issue. Here is some summary: - happens on OS X 10.9 only - does not happen on 10.8 and below (also, transparency works fine on all other systems and all other OS X versions, so I suspect this is a change in OS X 10.9 that broke it) - happens with latest Tcl/Tk from fossil, latest ActiveTcl - happens with both tkpng and Img - I can also confirm it only happens with Cocoa, not Carbon So this is definitely an issue with Tk. As I am not a Cocoa/Tk expert, that is as far as I went. For the affected code I simply created PNG images with 0%/100% transparency and use transparent images for other OSes for now, at least until this is resolved. 2013/11/29 Linus Nyberg <li...@fa...>: > Hi all, > > I’m trying to move our application over from Carbon based Tcl/Tk (8.5.4) to > any of the Cocoa versions (8.5.13 or 8.6.1) in order to get Retina text, 64 > bit support, future proof, etc. > One show stopper problem I’m having is that tk “images” don’t seem to render > partial transparency (where pixels are 1-99% transparent). > Here’s a screenshot of the result I get, where I show a “label -image”, a > “label -bitmap” and “canvas image” with the same transparent png image. Only > the bitmap label works, the others are wrong: > https://dl.dropboxusercontent.com/u/12145205/alphatest_fail.png > > Does anyone have any tips on how to get this working? It works fine on the > old Carbon based Tk, using the tkpng extension. It also works fine on 8.6.1 > on *Windows*. > I wish it was as easy as just using “-bitmap” based labels all the time, but > we at least really need images to work in canvas as well (bitmap does not > work there as far as I know). > > Here are replication steps: > - Download and install ActiveTcl 8.6.1 > - Go to http://www.w3.org/Graphics/PNG/inline-alpha.html and drag the test > png image to your Desktop > - Save the code below to a file (for example “alphatest.tcl on your > desktop). > - Open Wish.app for Tcl 8.6.1 and “Source…” alphatest.tcl > - Happens: The image based label and image in canvas are wrong, but the > bitmap based label works. > > # alphatest.tcl > #----------------- > set png_path "~/Desktop/alphatest.png" > > wm geometry . 400x900 > > ::tk::mac::iconBitmap test_png 380 287 -imageFile $png_path > image create photo test_png -format png -width 380 -height 287 -file > $png_path > > # LABEL BASED ON "image" - does not handle partial transparency well > #----------------------- > set l .image_label > label $l -image test_png > place $l -x 10 -y 10 -anchor nw > > # LABEL BASED ON "bitmap" - works > #----------------------- > set l2 .bitmap_label > label $l2 -bitmap test_png > place $l2 -x 10 -y 300 -anchor nw > > # IMAGE IN CANVAS (BASED ON "image") - does not handle partial transparency > well > #----------------------------------- > set c .c > canvas $c -width 500 -height 310 -bg white > place $c -x 10 -y 600 -anchor nw > $c create image 10 10 -image test_png -anchor nw > > > ------------------------------------------------------------------------------ > Rapidly troubleshoot problems before they affect your business. Most IT > organizations don't have a clear picture of how application performance > affects their revenue. With AppDynamics, you get 100% visibility into your > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics > Pro! > http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk > _______________________________________________ > Tcl-mac mailing list > tc...@li... > https://lists.sourceforge.net/lists/listinfo/tcl-mac > |