App-PLab
view release on metacpan or search on metacpan
lib/App/PLab/ImageApp.pm view on Meta::CPAN
}
$self-> SUPER::translate( $trx, $try);
}
sub clipRect
{
unless ( $#_) {
my @a = $_[0]-> SUPER::clipRect;
if ( $_[0]-> {override}) {
$a[$_] -= $_[0]-> {override}->[$_] for 0,1;
$a[$_+2] -= $_[0]-> {override}->[$_] for 0,1;
}
return @a;
}
my ( $self, $trx, $try, $tax, $tay) = @_;
if ( $self-> {override}) {
$trx += $self-> {override}-> [0];
$try += $self-> {override}-> [1];
$tax += $self-> {override}-> [0];
$tay += $self-> {override}-> [1];
}
$self-> SUPER::clipRect( $trx, $try, $tax, $tay);
}
package App::PLab::MagnifyingGlassWidget;
use vars qw(@ISA);
@ISA = qw(Prima::Widget);
sub profile_default
{
my $def = $_[ 0]-> SUPER::profile_default;
my %prf = (
width => 154,
height => 102,
syncPaint => 0,
);
@$def{keys %prf} = values %prf;
return $def;
}
sub on_create
{
$_[0]-> {canvas} = App::PLab::TrDeviceBitmap-> create(
width => 76,
height => 50,
backColor => $_[0]-> owner-> backColor,
);
}
sub on_paint
{
$_[1]-> rectangle( 0, 0, 153, 101);
$_[1]-> stretch_image( 1, 1, 152, 100, $_[0]-> {canvas});
}
package App::PLab::TrImageViewer;
use vars qw(@ISA);
@ISA = qw(Prima::ImageViewer);
sub invalidate_rect
{
my ( $self, @r) = @_;
my $w = $self-> owner;
$w-> ivm_repaint( $self) if $w-> {magnify};
$self-> SUPER::invalidate_rect( @r);
}
sub end_paint
{
my $self = $_[0];
$self-> SUPER::end_paint;
my $w = $self-> owner;
$w-> ivm_repaint( $self) if $w-> {magnify};
}
sub capture
{
return $_[0]-> SUPER::capture unless $#_;
my ( $self, $capFlag, @rest) = @_;
$self-> owner-> iv_cancelmagnify( $self)
if !$capFlag && $self-> owner-> {magnify};
$self-> SUPER::capture( $capFlag, @rest);
}
sub screen2point
{
return map { int } shift-> SUPER::screen2point( @_);
}
sub point2screen
{
return map { int } shift-> SUPER::point2screen( @_);
}
package App::PLab::ImageAppWindow;
use vars qw(@ISA %dlgProfile $ico $pointClickTolerance);
@ISA = qw(Prima::Window);
$pointClickTolerance = 8;
%dlgProfile = (
centered => 1,
visible => 0,
designScale => [7, 16],
);
$ico = Prima::Icon-> create;
$ico-> combine(
Prima::Image-> create(
width => 32,
height => 32,
type => im::Mono,
palette => [0,0,0,255,255,255],
data => pack( 'C*' ,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,15,244,0,0,3,194,0,0,15,250,
0,0,31,253,0,0,63,253,0,0,127,254,128,0,127,254,128,0,231,255,64,0,215,255,64,1,182,219,64,1,
86,219,64,0,142,219,64,0,13,183,0,0,29,182,0,0,59,180,0,0,55,104,0,0,11,96,0,0,0,128,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
),
),
Prima::Image-> create(
width => 32,
height => 32,
type => im::Mono,
palette => [0,0,0,255,255,255],
data => pack( 'C*',
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
( run in 0.663 second using v1.01-cache-2.11-cpan-39bf76dae61 )