Thread Jeden Pixel färben ??? (20 answers)
Opened by Matze at 2005-11-24 22:53

Matze
 2005-11-29 16:56
#45065 #45065
User since
2005-08-29
222 Artikel
BenutzerIn
[Homepage] [default_avatar]
@jemand: x und y Position des Maus-Cursors.

Ich habs jetzt mit put gemacht.
Und es geht auch recht schnell.

Ein Test Script:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/perl -w
#
# pf.pl
#

use strict;
use Tk;

my %all;
$all{mw} = MainWindow -> new();
$all{mw} -> bind("<Key-q>","exit");

$all{canvas} = $all{mw} ->
Canvas (-background => "#000000",
           -highlightthickness => 0,
           -relief => "flat",
           -bd => 0)->
   pack(-fill => "both",
          -expand => 1);

my ($screenx,$screeny) =
($all{mw} -> screenwidth(),
$all{mw} -> screenheight());

$all{photo} = $all{mw} ->
Photo (-width => $screenx,
         -height => $screeny);

$all{canvas} ->
createImage (0,0,
                  -image => $all{photo},
                  -anchor => "nw");

$all{mw} -> FullScreen(1);
$all{mw} -> geometry  ("${screenx}x$screeny");

for (0..$screenx) {

 my $y = $_;
 $y = $screeny / 2 if $y >= $screeny / 2;

 point($_,$y);

 for (0..10000) {}
 $all{mw} -> update;
}
for (0..$screenx) {

 my $y = $_;
 $y = $screeny / 2 if $y >= $screeny / 2;

 my $x = $screenx - $_;

 point($x,$y);

 for (0..10000) {}
 $all{mw} -> update;
}

MainLoop;

sub point {
 my ($x,$y,$color);

 if ($#_ >= 0) {
   $x = shift;
   if ($#_ >= 0) {
     $y = shift;
     if ($#_ >= 0) {
       $color = shift;
     }
     else {
       $color = "#ff0000";
     }
   }
   else {
     $y = 0;
     $color = "#ff0000";
   }
 }
 else {
   $x = 0;
   $y = 0;
   $color = "#ff0000";
 }

 $all{photo} ->
 put ("$color",
       -to => $x,$y);
}


Ich denke es ist diesmal besser formatiert.

MfG. Matze
Mit freundlichen Grüßen: Matze

View full thread Jeden Pixel färben ???