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
#!/usr/bin/perl -w use Wx qw[:allclasses]; use strict; Apfel->new->MainLoop; package Apfel; use base qw(Wx::App); use Wx::Event qw (EVT_BUTTON); sub OnInit { my $frame = Wx::Frame->new( undef, -1, "Apfelmaennchen", [-1,-1], [1000,1000]); my $Button = Wx::Button->new($frame,-1,"Malen",[450,850],[100,50]); my $panel = Wx::Panel->new( $frame, -1, [0,0],[1000,8000]); my $dc = $frame->{dc} = Wx::MemoryDC->new(); my $bmp = $frame->{bmp} = Wx::Bitmap->new( 800, 800 ); $dc->SelectObject( $bmp ); my $maltafel = $frame->{tafel} = Wx::StaticBitmap->new( $panel, -1, $bmp, [100,1]); $dc->Clear(); $dc->SelectObject( $bmp ); EVT_BUTTON($frame,$Button, \&malen); $frame->Show(1); sub malen { my $pinsel = Wx::Pen->new(Wx::Colour->new('red'),5,&Wx::wxSOLID); $dc->SetPen($pinsel); # $dc->DrawLine(200,200,300,300); for my $i (1..800){ for my $j (1..800){ $dc->DrawPoint($i,$j); } } $frame->{tafel}->SetBitmap( $frame->{bmp} ); $frame->{dc}->SelectObject( $frame->{bmp} ); $frame->{tafel}->Refresh(); } }
1 2 3 4 5 6 7 8 9 10 11 12
my ($width,$height)=(800,800); my $data=''; for(1..$width) { for(1..$height) { @color=(255,0,0); # (Rot,Gün,Blau) $data.=pack('C3',@color); } } my $bmp = Wx::Bitmap->new($width,$height); $bmp->CopyFromBuffer($data, wxBitmapBufferFormat_RGB,-1);
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
#!/usr/bin/perl use strict; use warnings; use Wx qw[:allclasses]; test->new->MainLoop; package test; use base qw(Wx::App); use Wx::Event qw (EVT_BUTTON); sub OnInit { my $frame = Wx::Frame->new( undef, -1, "Apfelmaennchen", [-1,-1], [1000,1000]); my $button_render = Wx::Button->new($frame,-1,"Malen",[0,0],[1000,50]); my $panel = Wx::Panel->new($frame, -1, [0,55],[1000,800]); $frame->{tafel} = Wx::StaticBitmap->new( $panel, -1, Wx::Bitmap->new( 0, 0, -1), [100,1]); my $button_exit = Wx::Button->new($frame,-1,"EXIT",[0,950],[1000,50]); my $dc = $frame->{dc} = Wx::MemoryDC->new(); $dc->Clear(); EVT_BUTTON($frame,$button_render, sub{ malen($frame); }); EVT_BUTTON($frame,$button_exit, sub{ $frame->Close }); $frame->Show(1); } sub malen { my $frame=shift; my ($width,$height)=(800,800); my $data=''; for(1..$width) { for(1..$height) { $data.=pack('C3',255,0,0); } } my $bmp=data_to_pixmap($data,$width,$height); $frame->{tafel}->SetBitmap( $bmp ); $frame->{dc}->SelectObject( $bmp ); $frame->{tafel}->Refresh(); } sub data_to_pixmap { my ($data,$width,$height)=@_; my $wximg=Wx::Image->new( $width, $height, $data ); return Wx::Bitmap->new($wximg); }
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
#!/usr/bin/perl -w use Wx qw[:allclasses]; use strict; Apfel->new->MainLoop; package Apfel; use base qw(Wx::App); use Wx::Event qw (EVT_BUTTON); sub OnInit { my $frame = Wx::Frame->new( undef, -1, "Apfelmaennchen", [-1,-1], [1000,1000]); my $Button = Wx::Button->new($frame,-1,"Malen",[450,850],[100,50]); my $panel = Wx::Panel->new( $frame, -1, [0,0],[1000,800]); my $dc = $frame->{dc} = Wx::MemoryDC->new(); $frame->{tafel} = Wx::StaticBitmap->new( $panel, -1, Wx::Bitmap->new( 0, 0, -1), [100,1]); $dc->Clear(); EVT_BUTTON($frame,$Button, \&malen($frame)); $frame->Show(1); } sub malen { my $frame = shift; my $n = 50; my @punkt; my $data; my ($width,$height) = (800,800); for my $i (1..$width){ my $y = $i/200 - 2; for my $j (1..$height){ my $x = $j/200 - 2; ${$punkt[$i]}[$j] = &iterieren($x,$y,$n); if (${$punkt[$i]}[$j] < 51) { $data .= pack('C3',0,5*${$punkt[$i]}[$j],5*${$punkt[$i]}[$j]); } else {$data .= pack('C3',0,255,255);} } } my $bmp=data_to_pixmap($data,$width,$height); $frame->{tafel}->SetBitmap( $bmp ); $frame->{dc}->SelectObject( $bmp ); $frame->{tafel}->Refresh(); } sub data_to_pixmap { my ($data,$width,$height)=@_; my $wximg=Wx::Image->new( $width, $height, $data ); return Wx::Bitmap->new($wximg); } sub iterieren { my $x1 = $_[0]; my $xN = 0; my $y1 = $_[1]; my $yN = 0; my $count = 0; for my $i (1..$_[2]){ my $xNplus = $xN**2 - $yN**2 + $x1; my $yNplus = 2 * $xN * $yN + $y1; my $a = sqrt($xNplus**2 + $yNplus**2); $xN = $xNplus; $yN = $yNplus; if ($a > 2){$count = $i;last;} } return $count; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14
sub iterieren { my $x1 = $_[0]; my $xN = 0; my $y1 = $_[1]; my $yN = 0; my $count = 0; for my $i (1..$_[2]){ my $xNplus = $xN**2 - $yN**2 + $x1; my $yNplus = 2 * $xN * $yN + $y1; my $rec = $xNplus**2 + $yNplus**2; $xN = $xNplus; $yN = $yNplus; if ($rec > 4){$count = $i;last;} } return $count; }
1 2 3
$data .= ${$punkt[$i]}[$j] < 51 ? pack('C3',0,5*${$punkt[$i]}[$j],5*${$punkt[$i]}[$j]) : pack('C3',0,255,255) ;
2010-11-17T18:58:10 MampfgnomKann mir bitte jemand verraten wie ich im FTP Dateien online stellen kann, die jder anschauen kann?
2010-11-17T18:58:10 MampfgnomEdit: Okay, habe gerade einen Link mit meinen FTP Zugangsdaten online gestellt^^ Kann mir bitte jemand verraten wie ich im FTP Dateien online stellen kann, die jder anschauen kann?
2010-11-17T19:12:25 MampfgnomBianca warst du so schnell mi tkopieren oder warum kannst du den Link anklicken, habe ich doch rausgenommen. Das Reset ist zum rauszoomen gedacht. Bin zur Zeit noch unzufrieden mit meinen Farbverläufen, habe nur 255 Farben drinne.