Acme::Color::Rust - Color example class using Rust + FFI
version 0.05
use Acme::Color::Rust; my $color = Acme::Color::Rust->new("red", 0xff, 0x00, 0x00); say "the color is ", $color->name; say "with red ", $color->red, " green ", $color->green, " and blue ", $color->blue;
This class is a very simple RGB color class. It is implemented using Rust. It is mostly intended as a test for extending perl using Rust concept.
my $color = Acme::Color::Rust->new($name, $red, $green, $blue);
This create a new instance of Acme::Color::Rust. The name, red, green and blue values are passed in and the new instance is returned. The color values should be 8 bit unsigned values (that is 0-255).
my $name = $color->name;
The name of the color.
my $red = $color->red;
The red component of the color. This should be an 8-bit unsigned value (that is 0-255).
my $green = $color->green;
The green component of the color. This should be an 8-bit unsigned value (that is 0-255).
my $blue = $color->blue;
The blue component of the color. This should be an 8-bit unsigned value (that is 0-255).
Graham Ollis <plicease@cpan.org>
This software is copyright (c) 2022 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.