*grin*

In my exploration of wxPerl, I came up with the following , it has extra "fluff", but you can clean it to suit you

package ScreenShot; use Wx qw[ :everything ]; use Wx::Colour qw[ :everything ]; use Wx::Event qw[ :everything ]; use Wx::App; use base qw[Wx::App]; sub OnInit { my( $self )=@_; if(1){ # my $w = new Wx::Frame(undef,-1,"crap",[-1,-1,],[-1,-1],wxTRAN +SPARENT_WINDOW ); my $w = new Wx::Frame(undef,-1,"crap",[-1,-1,],[-1,-1],wxTRANS +PARENT_WINDOW ); # my $w = new Wx::Frame(undef,-1,"crap",[-1,-1,],[-1,-1],wxSTAY +_ON_TOP); # my $w = new Wx::Frame(undef,-1,"crap",[-1,-1,],[-1,-1],wxNO_B +ORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION ) +; # my $w = new Wx::Frame(undef,-1,"crap",[-1,-1,],[-1,-1],wxSTAY +_ON_TOP|wxDEFAULT_FRAME_STYLE|wxNO_BORDER); EVT_PAINT( $w, sub { my($s,$e)=@_; my $dc = Wx::PaintDC->new($s); # must create, to stop crap $self->PaintThisBitch; return 0; }); $w->Show(1); $w->CaptureMouse(); $w->Clear(); $w->Refresh; } EVT_MOTION( $self, sub {warn"@_"}); return 1; } sub TakeScreenshot { my($self, $file ) = @_; $file ||= 'test.bmp'; my $screen = Wx::ScreenDC->new(); my( $x, $y) = $screen->GetSizeWH(); my $bitmap = Wx::Bitmap->new($x,$y,-1); my $memory = Wx::MemoryDC->new(); $memory->SelectObject( $bitmap ); $memory->Blit(0,0,$x,$y, $screen, 0, 0); $bitmap->SaveFile( $file , wxBITMAP_TYPE_BMP ) ; } sub PaintThisBitch { my $screen = Wx::ScreenDC->new(); $screen->SetBackgroundMode( wxTRANSPARENT ); $screen->SetFont(Wx::Font->new( 40, wxDECORATIVE, wxNORMAL, wxBOLD +, 0 )); for(1..255){ my $c = $_; $screen->SetTextForeground( Wx::Colour->newRGB(0,0,$c) +); $screen->DrawRotatedText("wxPerl",410 ,400 ,$_); $screen->DrawRotatedText("wxPerl and PodMaster",410 ,5 +00 ,0); $screen->DrawRotatedText("are messing up your screen", +410 ,550 ,0); select undef, undef, undef, 0.0001; } for(1..255){ my $c = $_; $screen->SetTextForeground( Wx::Colour->newRGB(0,$c,0) +); $screen->DrawRotatedText("wxPerl",410 ,400 ,$_); $screen->DrawRotatedText("wxPerl and PodMaster",410 ,5 +00 ,0); $screen->DrawRotatedText("are messing up your screen", +410 ,550 ,0); select undef, undef, undef, 0.0001; } for(1..255){ my $c = $_; $screen->SetTextForeground( Wx::Colour->newRGB($c,0,0) +); $screen->DrawRotatedText("wxPerl",410 ,400 ,$_); $screen->DrawRotatedText("wxPerl and PodMaster",410 ,5 +00 ,0); $screen->DrawRotatedText("are messing up your screen", +410 ,550 ,0); select undef, undef, undef, 0.0001; } return 0; } package main; my $i = ScreenShot->new; $i->TakeScreenshot('testor.bmp'); $i->PaintThisBitch; $i->MainLoop; __END__ wxScreenDC context = wxClientDC( self ) memory = wxMemoryDC( ) x,y = self.GetClientSizeTuple() bitmap = wxEmptyBitmap( x,y, -1 ) memory.SelectObject( bitmap ) memory.Blit( 0,0,x,y, context, 0,0) memory.SelectObject( wxNullBitmap) bitmap.SaveFile( "test.bmp", wxBITMAP_TYPE_BMP )


MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
** The Third rule of perl club is a statement of fact: pod is sexy.


In reply to Re: capture what's on the screen by PodMaster
in thread capture what's on the screen by pg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.