Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Fascinating, a totally parochial attitude. -- Spock, "Metamorphosis", stardate 3219.8


devel / comp.lang.tcl / Translucent overlay of photo

SubjectAuthor
* Translucent overlay of photoClaude Rubinson
+- Re: Translucent overlay of photoRich
+- Re: Translucent overlay of photoEmiliano
`- Re: Translucent overlay of photoRalf Fassel

1
Translucent overlay of photo

<uv1elg$3lsrg$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13251&group=comp.lang.tcl#13251

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: cjr...@grundrisse.org (Claude Rubinson)
Newsgroups: comp.lang.tcl
Subject: Translucent overlay of photo
Date: Mon, 8 Apr 2024 13:56:48 -0500
Organization: A noiseless patient Spider
Lines: 5
Message-ID: <uv1elg$3lsrg$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 08 Apr 2024 18:56:48 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="c52403b4f1905711fb7373b225bc5611";
logging-data="3863408"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18wr/ui9nmhUfyvferapSYGOEjt6bxfNso="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:NAOqTFPz2Y9Frtp8MuBKTCicDic=
Content-Language: en-US
 by: Claude Rubinson - Mon, 8 Apr 2024 18:56 UTC

I have a Tk app that has a series of photos arranged in a grid. Each
photo is embedded in its own canvas. I'd like to indicate that a photo
has been selected by the user by highlighting it with a translucent
overlay. Is this possible? My initial investigation indicates that Tk
doesn't (yet) support alpha blending?

Re: Translucent overlay of photo

<uv1fg6$3m4j2$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13252&group=comp.lang.tcl#13252

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Translucent overlay of photo
Date: Mon, 8 Apr 2024 19:11:03 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <uv1fg6$3m4j2$1@dont-email.me>
References: <uv1elg$3lsrg$1@dont-email.me>
Injection-Date: Mon, 08 Apr 2024 19:11:03 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="86121a6074976ba33ebd98cad4b36a65";
logging-data="3871330"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1804NwuDzooJBEU7p8Evjnu"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Cancel-Lock: sha1:B6p69c9JdXz1wkX4adwcvYqBjRk=
 by: Rich - Mon, 8 Apr 2024 19:11 UTC

Claude Rubinson <cjr@grundrisse.org> wrote:
> I have a Tk app that has a series of photos arranged in a grid. Each
> photo is embedded in its own canvas. I'd like to indicate that a photo
> has been selected by the user by highlighting it with a translucent
> overlay. Is this possible? My initial investigation indicates that Tk
> doesn't (yet) support alpha blending?

One 'workaround' if Tk does not support alpha blending is to have
present in the app two versions of the photo, one without and a second
with the overlay present. Then for a "selected" photo you swap the
"without" and "with" versions (remembering to "unswap" the last
selected one as well).

Of course this only works if the overlay is completely static.

Re: Translucent overlay of photo

<20240408190115.b9889d1b9a083c6668ee69b3@gmail.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13253&group=comp.lang.tcl#13253

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: emil.gav...@gmail.com (Emiliano)
Newsgroups: comp.lang.tcl
Subject: Re: Translucent overlay of photo
Date: Mon, 8 Apr 2024 19:01:15 -0300
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <20240408190115.b9889d1b9a083c6668ee69b3@gmail.com>
References: <uv1elg$3lsrg$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 08 Apr 2024 22:01:21 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="8ded5837b9f708f6232d0c9178f1f5a8";
logging-data="3953261"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+T6IiW8zunZcYThxI+f78mEbmwoBAMt8U="
Cancel-Lock: sha1:vuyt8Sa4iy+/I/DesRZ/GkEjeW0=
X-Newsreader: Sylpheed 3.5.1 (GTK+ 2.24.32; i686-pc-linux-gnu)
X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; i686-pc-linux-gnu)
In-Reply-To: <uv1elg$3lsrg$1@dont-email.me>
 by: Emiliano - Mon, 8 Apr 2024 22:01 UTC

On Mon, 8 Apr 2024 13:56:48 -0500
Claude Rubinson <cjr@grundrisse.org> wrote:

> I have a Tk app that has a series of photos arranged in a grid. Each
> photo is embedded in its own canvas. I'd like to indicate that a photo
> has been selected by the user by highlighting it with a translucent
> overlay. Is this possible? My initial investigation indicates that Tk
> doesn't (yet) support alpha blending?

This works for me on 8.6.8 on X11 (color blue4 and alpha 0.4 are examples)

package require Tk
# load image from tk demo or choose any other
set img1 [image create photo -file [file join $env(HOME) \
src/tk/library/demos/images/ouster.png]]
set w [image width $img1]
set h [image height $img1]
set tmp [image create photo -width $w -height $h]
$tmp put blue4 -to 0 0 $w $h
set img2 [image create photo -data [$tmp data -format png] \
-format {png -alpha 0.4}]
pack [canvas .c -width [expr {20+$w}] -height [expr {20+$h}]]
.c create image 10 10 -image $img1 -anchor nw
.c create image 10 10 -image $img2 -anchor nw -tags sel

With 8.7/9.0 (still in beta) you can avoid the data round trip using
directly

set img2 [image create photo -width $w -height $h
$img2 put blue4@0.4 -to 0 0 $w $h

and avoid the tmp image altogether.
After this, the selection effect can be obtained with

.c itemconfigure sel -state {hidden|normal}

Hope this helps

--
Emiliano

Re: Translucent overlay of photo

<ygabk6j3pc0.fsf@panther.akutech-local.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13254&group=comp.lang.tcl#13254

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralf...@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: Translucent overlay of photo
Date: Tue, 09 Apr 2024 10:36:15 +0200
Lines: 27
Message-ID: <ygabk6j3pc0.fsf@panther.akutech-local.de>
References: <uv1elg$3lsrg$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net HsCq00IUtsfF1Km3HZ6BWQMEeKTS4Rc/YKUHyQ5J3XV/IHcJM=
Cancel-Lock: sha1:D2pu5VNOF7MeA/eNFZruHIOQvMU= sha1:0XlvWIfw5O/JKXGl8ToUTjsHpB8= sha256:Q2Cb6MLAQ3zsouEcLCBn9a92TKKTb6Y/cnCk82M61eM=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
 by: Ralf Fassel - Tue, 9 Apr 2024 08:36 UTC

* Claude Rubinson <cjr@grundrisse.org>
| I have a Tk app that has a series of photos arranged in a grid. Each
| photo is embedded in its own canvas. I'd like to indicate that a
| photo has been selected by the user by highlighting it with a translucent
| overlay. Is this possible? My initial investigation indicates that
| Tk doesn't (yet) support alpha blending?

A different approach might be to add a border around each canvas and
highlight that to indicate the selected one:

grid [canvas .c1 -highlightthickness 3 -highlightcolor blue -borderwidth 2 -relief ridge] -row 0 -column 0 -sticky ewnw
grid [canvas .c2 -highlightthickness 3 -highlightcolor blue -borderwidth 2 -relief ridge] -row 0 -column 1 -sticky ewnw
grid [canvas .c3 -highlightthickness 3 -highlightcolor blue -borderwidth 2 -relief ridge] -row 1 -column 0 -sticky ewnw
grid [canvas .c4 -highlightthickness 3 -highlightcolor blue -borderwidth 2 -relief ridge] -row 1 -column 1 -sticky ewnw

bind .c1 <Button-1> {focus %W}
bind .c2 <Button-1> {focus %W}
bind .c3 <Button-1> {focus %W}
bind .c4 <Button-1> {focus %W}

grid rowconfigure . 0 -weight 1
grid rowconfigure . 1 -weight 1
grid columnconfigure . 0 -weight 1
grid columnconfigure . 1 -weight 1

HTH
R'

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor