| Color-Similarity documentation | view source | Contained in the Color-Similarity distribution. |
Color::Similarity - common interface to different Color::Similarity::* modules
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 ] );
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.
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.
my $c = $s->convert_rgb( $r, $g, $b );
Converts the given RGB triplet to a representation suitable for
passing it to 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).
Mattia Barbon, <mbarbon@cpan.org>
Copyright (C) 2007, Mattia Barbon
This program is free software; you can redistribute it or modify it under the same terms as Perl itself.
| Color-Similarity documentation | view source | Contained in the Color-Similarity distribution. |