The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

SDL::Color - a SDL perl extension

SYNOPSIS

  $color = new SDL::Color ( -r => 0xde, -g => 0xad, -b =>c0 );
  $color = new SDL::Color -surface => $app, -pixel => $app->pixel($x,$y);
  $color = new SDL::Color -color => SDL::NewColor(0xff,0xaa,0xdd);

DESCRIPTION

SDL::Color is a wrapper for display format independent color representations.

new ( -color => )

SDL::Color::new with the -color option allows one to create a new color object from a pre-existing SDL_Color*. This constructor will set the internal color state to mirror that of the specified color. This object will deallocate the color object upon completion. This is not suitable for color that exist as part of another object.

new ( -r => 0xff, -g => 0xff, -b => 0xff )

SDL::Color::new with the -r,-g,-b options will populate a new color object with the corresponding composite values.

new ( -surface => , -pixel => )

SDL::Color::new with a SDL::Surface and a Uint32 pixel value can also be used to generate SDL::Color objects. Like as with the -color option -surface,-pixel will set the internal state to reflect the color values given the SDL::Surface's palette and color format.

r ( [ red ] )

SDL::Color::r sets and fetches the red component of the color object

g ( [ green ] )

SDL::Color::g sets and fetches the green component of the color object

b ( [ blue ] )

SDL::Color::b sets and fetches the blue component of the color object

pixel ()

SDL::Color::pixel returns the Uint32 color value of the given color in the format of the provided surface.

AUTHOR

David J. Goehrig

SEE ALSO

perl(1) SDL::Surface(3) SDL::TTFont(3)