File: TiedMatrixRow.pm

package info (click to toggle)
libsdl-perl 2.548-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,972 kB
  • sloc: perl: 13,985; ansic: 583; makefile: 35
file content (42 lines) | stat: -rw-r--r-- 631 bytes parent folder | download | duplicates (4)
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
package SDLx::Surface::TiedMatrixRow;
use strict;
use warnings;
use base 'Tie::Array';

our $VERSION = 2.548;

sub new {
	my $class  = shift;
	my $matrix = shift;
	my $y      = shift;

	my $self = {
		matrix => $matrix,
		y      => $y,
	};

	return bless $self, $class;
}

sub TIEARRAY {
	return SDLx::Surface::TiedMatrixRow->new( $_[1], $_[2] );
}

sub FETCH {
	my ( $self, $x ) = @_;
	$self->{matrix}->get_pixel( $x, $self->{y} );
}

sub FETCHSIZE {

	my ( $self, $x ) = @_;
	return $self->{matrix}->surface->w;

}

sub STORE {
	my ( $self, $x, $new_value ) = @_;
	$self->{matrix}->set_pixel( $x, $self->{y}, $new_value );
}

1;