|parrotcode: Parrot class representing colors in Parrot SDL|
|Contents | Libraries|
SDL::Color - Parrot class representing colors in Parrot SDL
load_bytecode 'library/SDL/Color.pir' # create a new SDL::Color object .local pmc color color = new 'SDL::Color' # set the color values; this one's blue color.'init'( 'r' => 0, 'g' => 0, 'b' => 255 ) # fetch the color value to pass directly to SDL functions # (you should never need to do this if the rest of the library works right) .local int color_value color_value = color.'color'()
SDL::Color provides a very thin object layer over colors as used in SDL. For the most part, it's just a constructor and a convenient way to pass things around. In the future, it may grow more complex if you do odd things that require depth conversions. They make my head hurt now though.
This object represents a single color of, we'll say, 24-bit depth -- eight bits per red, green, and blue component. This may not match your requirements exactly. Per my understanding of SDL, though, it'll do the conversions for you automatically. Patches welcome.
SDL::Color objects have the following methods:
Written and maintained by chromatic, <chromatic at wgz dot org>, with suggestions from Jens Rieks. Please send patches, feedback, and suggestions to the Perl 6 Internals mailing list.
Copyright (C) 2004-2008, The Perl Foundation.