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:

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