I am working on a Perl/Tk application and I need to draw ribbons from one side of a canvas to the other. To make it easier for users to follow the ribbons, I would like the areas where they intersect to be darker and/or blend the ribbon colors.
I believe that this can be done with GD by using the alpha channels to add transparency. Unfortunately, I haven't been able to find anything on the subject for Perl/Tk, either in "Mastering Perl/Tk" or by googling.
Is there a simple way to add transparency or otherwise color the overlapping region of canvas items (without having to work out where the overlapping regions are myself)?
Here is sample code with overlapping canvas items that do not have the overlapping portions of the items colored.
#!/usr/bin/perl -w use strict; use Tk; my $MW = MainWindow->new(); my $canvas = $MW->Canvas( -background => 'white', ); $canvas->createPolygon( ( 10, 20 ), ( 20, 10 ), ( 250, 240 ), ( 240, 250 ), -fill => 'pink', ); $canvas->createPolygon( ( 250, 20 ), ( 240, 10 ), ( 10, 240 ), ( 20, 250 ), -fill => 'pink', ); $canvas->pack(); MainLoop();
In reply to Coloring Intesecting Canvas Items in Perl/Tk by mwz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |