| 1 | package Image::Caa::DitherOrdered4; | ||
| 2 | |||
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 7 | 2 | my ($class, $args) = @_; | |
| 8 | |||
| 9 | 2 | my $self = bless {}, $class; | |
| 10 | |||
| 11 | 2 | return $self; | |
| 12 | } | ||
| 13 | |||
| 14 | 2 | ▶ | sub init { |
|
Subroutine
init: called CC=2 SCAR=6.9
Pod
undocumented
| |||
| 15 | 2 | my ($self, $line) = @_; | |
| 16 | |||
| 17 | $self->{table} = [ | ||
| 18 | 2 | 0x00, 0x80, 0x20, 0xa0, | |
| 19 | 0xc0, 0x40, 0xe0, 0x60, | ||
| 20 | 0x30, 0xb0, 0x10, 0x90, | ||
| 21 | 0xf0, 0x70, 0xd0, 0x50 | ||
| 22 | ]; | ||
| 23 | |||
| 24 | 2 | my $skip = ($line % 4) * 4; | |
| 25 | 2 | shift @{$self->{table}} for 1..$skip; | |
| 26 | |||
| 27 | 2 | $self->{index} = 0; | |
| 28 | } | ||
| 29 | |||
| 30 | 16 | ▶ | sub get { |
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 31 | 16 | my ($self) = @_; | |
| 32 | |||
| 33 | 16 | return $self->{table}->[$self->{index}]; | |
| 34 | } | ||
| 35 | |||
| 36 | 4 | ▶ | sub increment { |
|
Subroutine
increment: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 37 | 4 | my ($self) = @_; | |
| 38 | |||
| 39 | 4 | $self->{index} = ($self->{index} + 1) % 4; | |
| 40 | } | ||
| 41 | |||
| 42 | 2 | 1; | |