| 1 | package Image::Caa::DitherOrdered8; | ||
| 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, 0x08, 0x88, 0x28, 0xa8, | |
| 19 | 0xc0, 0x40, 0xe0, 0x60, 0xc8, 0x48, 0xe8, 0x68, | ||
| 20 | 0x30, 0xb0, 0x10, 0x90, 0x38, 0xb8, 0x18, 0x98, | ||
| 21 | 0xf0, 0x70, 0xd0, 0x50, 0xf8, 0x78, 0xd8, 0x58, | ||
| 22 | 0x0c, 0x8c, 0x2c, 0xac, 0x04, 0x84, 0x24, 0xa4, | ||
| 23 | 0xcc, 0x4c, 0xec, 0x6c, 0xc4, 0x44, 0xe4, 0x64, | ||
| 24 | 0x3c, 0xbc, 0x1c, 0x9c, 0x34, 0xb4, 0x14, 0x94, | ||
| 25 | 0xfc, 0x7c, 0xdc, 0x5c, 0xf4, 0x74, 0xd4, 0x54, | ||
| 26 | ]; | ||
| 27 | |||
| 28 | 2 | my $skip = ($line % 8) * 8; | |
| 29 | 2 | shift @{$self->{table}} for 1..$skip; | |
| 30 | |||
| 31 | 2 | $self->{index} = 0; | |
| 32 | } | ||
| 33 | |||
| 34 | 16 | ▶ | sub get { |
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 35 | 16 | my ($self) = @_; | |
| 36 | |||
| 37 | 16 | return $self->{table}->[$self->{index}]; | |
| 38 | } | ||
| 39 | |||
| 40 | 4 | ▶ | sub increment { |
|
Subroutine
increment: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 41 | 4 | my ($self) = @_; | |
| 42 | |||
| 43 | 4 | $self->{index} = ($self->{index} + 1) % 8; | |
| 44 | } | ||
| 45 | |||
| 46 | 2 | 1; | |