NAME
Color::Similarity - common interface to different Color::Similarity::* modules
SYNOPSIS
use Color::Similarity;
my $package = ...; # for example Color::Similarity::HCL
my $s = Color::Similarity->new( $package );
my $d1 = $s->distance( [ $r1, $g1, $b1 ], [ $r2, $g2, $b2 ] );
METHODS
new
my $s = Color::Similarity->new( $package );
Constructs a new Color::Similarity
object wrapping the given $package
. The module will not try to load the package, so the caller must have done it already.
distance_rgb
my $d = $s->distance_rgb( [ $r1, $g1, $b1 ], [ $r2, $g2, $b2 ] );
Converts the RGB triplets to the appropriate representation (usually a different colorspace) and computes their distance.
convert_rgb
my $c = $s->convert_rgb( $r, $g, $b );
Converts the given RGB triplet to a representation suitable for passing it to distance
.
distance
my $d = $s->distance( $c1, $c2 );
Computes the distance between two colors already in an appropriate representation (either using convert_rgb
or by alternate means).
SEE ALSO
Color::Similarity::Lab, Color::Similarity::RGB, Color::Similarity::HCL
AUTHOR
Mattia Barbon, <mbarbon@cpan.org>
COPYRIGHT
Copyright (C) 2007, Mattia Barbon
This program is free software; you can redistribute it or modify it under the same terms as Perl itself.