Tk Source Code

View Ticket
Login
Ticket UUID: 829925
Title: image put errors on {} color
Type: Bug Version: obsolete: 8.4.4
Submitter: hobbs Created on: 2003-10-25 00:58:31
Subsystem: 41. Photo Images Assigned To: dkf
Priority: 7 High Severity: Minor
Status: Closed Last Modified: 2017-10-07 14:50:27
Resolution: Fixed Closed By: fvogel
    Closed on: 2017-10-07 14:50:27
Description:
image put dies when passed "" as a color, although this 
can be used in various other places in Tk to mean 
an "empty" color or transparent color.  image put should 
do the same, so you can pass in large color arrays that 
don't specifically have to set a color for all pixels.
User Comments: fvogel added on 2017-09-16 15:20:48:

In core-8-6-branch, the following code does not "die" (crash or error out) as reported by the OP:

package require Tk
set teapotPhotoFile "C:/Users/francois/Documents/Development/tcltk-fossil/tk/tests/teapot.ppm"
image create photo p1 -file $teapotPhotoFile
pack [button .b -image p1]
p1 put "" -to 0 0 30 30
So this looks fixed in core-8-6-branch.

In trunk however, where TIP #166 got implemented, the above code crashes because it triggers a runtime error: 'colCount' is used without being initialized. I have just fixed this in [b36f05fa] and merged to trunk. Therefore in trunk also this ticket looks fixed.

Can we close it then? Donal, can you confirm please?


beric added on 2003-11-21 15:11:39:
Logged In: YES 
user_id=493507

Thank you Donal.

dkf added on 2003-11-21 02:27:03:
Logged In: YES 
user_id=79902

I'm going to do this in TIP#166 http://purl.org/tcl/tip/166
as I want more complete control than just "{} ==
transparent" anyway.

dkf added on 2003-10-31 03:52:40:
Logged In: YES 
user_id=79902

Wrong answer.  Make the empty string work and make @xx throw
an error instead.  Which is as far as I could see myself
going without a TIP (since arguably the empty string is
already interpreted in Tk as transparent and alpha support
is currently abysmal.)

beric added on 2003-10-30 22:56:01:
Logged In: YES 
user_id=493507

You're right, I missed that.
So, let "" raise an error and @xx deal with alpha ;)

dkf added on 2003-10-30 22:06:19:
Logged In: YES 
user_id=79902

It's *extremely* difficult to get both @0 and "" supported
at the same time with different behaviour as you suggest. 
The problem is that setting a pixel to be transparent
requires one kind of compositing rule (set) and ignoring a
pixel requires another (overlay).

beric added on 2003-10-30 21:47:48:
Logged In: YES 
user_id=493507

Donal,

Could you look at the last part of FR 557090 before TIP'ing, 
dealing with "xcolor@alpha" syntax ?
Then, setting transparent pixel could be done with @0, and "" 
could denote a "do nothing" behaviour.

dkf added on 2003-10-29 21:49:46:
Logged In: YES 
user_id=79902

I've been thinking about this a bit more, and I feel that
the empty string ought to represent a transparent pixel, and
not a pixel that should be ignored when writing into the
image.  The idea is that you are putting a blank into the image.

OTOH, I might do a TIP for all this anyway so that I can add
a syntax for specifying non-trivial transparency at the same
time.

hobbs added on 2003-10-29 05:25:59:
Logged In: YES 
user_id=72656

1. It requires a TIP if you view it as not a bug.
2. This may justify it more as TIP-worthy.

dkf added on 2003-10-25 08:27:52:

File Added - 65374: putblank.patch

Logged In: YES 
user_id=79902

Q1: Does this require a TIP to fix?
Q2: Should the empty string indicate that a pixel is to be
ignored or that a pixel is to be made transparent?

Attachments: