The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Color::Model::Munsell - Color model of Munsell color system

SYNOPSIS

Chromatic color;

    $mun = Color::Model::Munsell->new("9R 5.5/14");
    $mun = Color::Model::Munsell->new("7PB", 4, 10);
    print "$mum is chromatic color" if !$mun->isneutral;

Neutral grays;

    $mun = Color::Model::Munsell->new("N 4.5");
    $mun = Color::Model::Munsell->new("N", 9);
    print "$mum is neutral color" if $mun->isneutral;

CONSTRUCTORS

new()

    # with Munsell color specifying
    $m = Color::Model::Munsell->new("9R 5.5/14");
    $m = Color::Model::Munsell->new("N 4.5");

    # with parapeters
    $m = Color::Model::Munsell->new("7PB", 4, 10);
    $m = Color::Model::Munsell->new("N", 9);

If number part of hue is 0, it becomes 10.0 of previous hue color on the circle.

Value(as Lightness) or chroma has thier range; 0 <= value <= 10.0 # if 0 or 10, it will be regraded as black or white 0 <= chroma # if 0, it will be gray

and these number will be rounded up to the tenth's place with sprintf().

If constructor returns undef, it means some error occurs. When this case, Check $Color::Model::Munsell::ERROR that have a reason of an error.

Munsell()

Munsell() is defalut exporting subroutine which calls new().

    $m = Munsell("9R 5.5/14");

CONSTANTS

There are some constants which makes black or white object. Use tag ":vertexes" or ":all".

PUREWHITE()

return an object of "N 10.0"

PUREBLACK();

return an object of "N 0.0"

REALWHITE();

return an object of "N 9.5"

REALBLACK();

return an object of "N 1.0"

METHODS

Object Color::Model::Munsell has methods below.

code()

Returns Munsell code like "5R 10/14" or "N 4.5".

ischromatic()

Returns 1 if object is chromatic, or 0.

isneutral()

Returns 1 if object is neutral color, or 0.

isblack()

Return 1 if value is equal or lesser than 1.0, or 0

iswhite()

Return 1 if value is equal or greater than 9.5, or 0

hue()

Returns hue code like "5R" or "N".

hueCol()

Returns color sign of hue; R,YR,Y,GY,G,BG,B,PB,P,RP or N

hueStep();

Returns number of hue (gray returns undef)

value()

Returns Munsell value.

lightness()

Same as value()

chroma()

Returns Munsell chroma.

saturation()

Same as chroma().

degree()

See degree() below.

SUBROUTINES

degree()

    print $m->degree();
    print degree("7.5B");

Subroutine or object method degree() return a serial hue number, considering 10.0RP is 0, 10R is 10, 10YR is 20, ..., and ends 9.9RP as 99.9. This will be useful to get radians of Muncell color circle. If object is neutral, this returns undef.

undegree();

    print undegree();

Function undegree() return a hue code from a serial hue number.

OPERATOR OVERLOAD

Stringify operator of this module, Color::Model::Munsell, is prepared. If you join a object with some string, object will be Munsell code.

    $m = Color::Model::Munsell->new("9R", 5.5, 14);
    print "$m is red";    # printing "9R 5.5/14 is red"

BUGS

Please report any bugs or feature requests to bug-color-model-munsell at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Color-Model-Munsell. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

AUTHOR

Takahiro Onodera, <ong at garakuta.net>

LICENSE AND COPYRIGHT

Copyright 2010 T.Onodera.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.