Zinc can do it. You can put "holes" into objects, and see thru them. What is "on top" is set by a "priority" number. It might help you out later. You can export the zinc canvas to a graphic format, like jpg, with Tk::WinPhoto.
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Zinc; my $motion_flag = 0; my $delay = 50; #adjust for speed of your computer my $mw = MainWindow->new; $mw->geometry("700x600"); $mw->resizable(0,0); my $zinc = $mw->Zinc(-width => 700, -height => 565, -backcolor => 'grey', -borderwidth => 3, -relief => 'sunken', )->pack; # Then we create a gray filled rectangle, in which we will display exp +lain text. $zinc->add('rectangle', 1 , [200, 400, 490, 490], -linewidth => 2, -filled => 1, -fillcolor => 'SkyBlue', ); my $text = $zinc->add('text', 1, -position => [350, 445], -anchor => 'center', -priority => 2 ); #a circle is bounded by a square box, specify 2 diagonal points my $arc1 = $zinc->add('arc', 1, [5,5,65,65], -fillcolor => "yellow", - +filled => 1); #an ellipse is bounded by a rectangle, specify 2 diagonal points my $arc2 = $zinc->add('arc', 1, [70, 5, 95, 65], -fillcolor => "green" +, -filled => 1, -linewidth => 0); #notice you cannot make a see-thru hole in an arc #contour only works for curve items #an ellipse is bounded by a rectangle, specify 2 diagonal points my $arc3 = $zinc->add('arc', 1, [110, 10, 300, 150], -fillcolor => "or +ange", -filled => 1); my $arc3a = $zinc->add('arc', 1, [150, 30, 260, 150], -filled => 1, #-visible => 0 ); $zinc->contour($arc3, 'add', 1, $arc3a); # will not produce a see-thru + because # $arc3 is an arc # #now a see thru-hole can be formed in the curve $arc3b my $arc3b = $zinc->add('curve', 1,[ [360, 10], [650,25], [600,200], [3 +50,250], [400,100] ], -filled => 1, -fillcolor => "green", -closed => 1, -priority => 2); my $arc3c = $zinc->add('arc', 1, [475,40 , 600, 200], -visible => 0); $zinc->contour($arc3b, 'add', 1, $arc3c); # will produce a see-thru b +ecause $arc3b # is a curve my $arc4 = $zinc->add('arc', 1, [300, 75, 400, 175], -fillcolor => "white", -filled => 1, -priority => 1); my $arc5 = $zinc->add('arc', 1, [100,250, 300, 400], -fillcolor => "blue", -filled => 1, -visible => 1, -extent => 90, -startangle => 270, #starts at "North" -pieslice => 1, -priority => 2); # sets it on top layer # Display comment &comment("Hit Enter to begin."); #set key binding $mw->Tk::bind('<Return>', \&start); my $closebutton = $mw->Button(-text => 'Exit', -command => sub{Tk::exi +t(0)}) ->pack; MainLoop; sub start { &comment("Hit Esc to stop."); $motion_flag = 1; $mw->Tk::bind('<Return>', sub{}); &startaction; } sub stopaction{ &comment("Hit Enter to begin"); $motion_flag = 0; $mw->Tk::bind('<Return>', \&start); } sub startaction { $mw->Tk::bind('<Escape>', \&stopaction); $mw->Tk::bind('<Up>', sub{$delay = ($delay -1) unless $delay <= 1 +}); $mw->Tk::bind('<Down>', sub{$delay = ($delay + 1)unless $delay >= +1000} ); $zinc->rotate($arc4,.15,350,281); if($motion_flag == 1){ $zinc->after($delay, sub {startaction()})} else {return} } # Just display comment sub comment { my $string = shift; $zinc->itemconfigure($text, -text => $string); }
In reply to Re: GD (or something better?) and image transparency
by zentara
in thread GD (or something better?) and image transparency
by japhy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |