IUP
view release on metacpan or search on metacpan
lib/IUP/Canvas.pod view on Meta::CPAN
CD_DARK_YELLOW = (128,128, 0)
CD_MAGENTA = (255, 0,255)
CD_DARK_MAGENTA = (128, 0,128)
CD_CYAN = ( 0,255,255)
CD_DARK_CYAN = ( 0,128,128)
CD_WHITE = (255,255,255)
CD_BLACK = ( 0, 0 , 0)
CD_DARK_GRAY = (128,128,128)
CD_GRAY = (192,192,192)
=head3 cdEncodeColor()
$color = $canvas->cdEncodeColor($r, $g, $b);
#or
$color = IUP::Canvas->cdEncodeColor($r, $g, $b);
Returns a codified triple (I<r,g,b>) in a long integer such as
B<0x00RRGGBB>, where B<RR> are the red components, B<GG> are
the green ones and B<BB> are the blue ones. The code is used in the
CD library to define colors. It can be used without an active canvas.
=head3 cdDecodeColor()
($r, $g, $b) = $canvas->cdDecodeColor($color);
#or
($r, $g, $b) = IUP::Canvas->cdDecodeColor($color);
Returns the red, green and blue components of a color in the CD
library. Can be used without an active canvas.
=head3 cdEncodeAlpha()
$color = $canvas->cdEncodeAlpha($color, $alpha);
#or
$color = IUP::Canvas->cdEncodeAlpha($color, $alpha);
Returns the given color coded with the alpha information.
B<ATENTION:> At the moment only the B<Cairo>, B<GDI+>, B<XRender> and L<IMAGERGB> (= L<IUP::Canvas::FileBitmap>)
drivers support alpha components in color
coding. The internal representation of the component is inverted,
because the default value must be 0 and opaque for backward
compatibility, so you should use the L<cdDecodeAlpha|/"cdDecodeAlpha()"> function or the
L<cdAlpha|/"cdAlpha()"> macro to retrieve the alpha component. 0 is transparent, 255 is opaque.
=head3 cdDecodeAlpha()
$alpha = $canvas->cdDecodeAlpha($color);
#or
$alpha = IUP->Canvas->cdDecodeAlpha($color);
Returns the alpha component of a color in the CD library. Can be used
without an active canvas. 0 is transparent, 255 is opaque.
=head3 cdAlpha()
$alpha = $canvas->cdAlpha($color);
#or
$alpha = IUP::Canvas->cdAlpha($color);
Macro that returns the alpha component of a color in the CD library.
Can be used without an active canvas.
=head3 cdRed()
$red = $canvas->cdRed($color);
#or
$red = IUP::Canvas->cdRed($color);
Macro that returns the red component of a color in the CD library. Can
be used without an active canvas.
=head3 cdGreen()
$green = $canvas->cdGreen($color);
#or
$green = IUP::Canvas->cdGreen($color);
Macro that returns the green component of a color in the CD library.
Can be used without an active canvas.
=head3 cdBlue()
$blue = $canvas->cdBlue($color);
#or
$blue = IUP::Canvas->cdBlue($color);
Macro that returns the blue component of a color in the CD library. Can
be used without an active canvas.
=head3 cdGetColorPlanes()
$bpp = $canvas->cdGetColorPlanes();
Returns a given number, for instance I<p>, which defines the number of
colors supported by the current device as I<2p>, representing the
number of bits by pixel.
=head3 cdPalette()
$palette = IUP::Canvas::Palette->new( [$col0, $col1, $col2, ...] );
$canvas->cdPalette($palette, $mode);
In systems limited to 256 palette colors, this function aims at adding
colors to the system's palette. In such systems, the colors
demanded forward or backward which are not in the palette are
approximated to the closest available color. The type can be
B<CD_FORCE> or B<CD_POLITE>. B<CD_FORCE> ignores the system
colors and interface elements, since the menus and dialogues may be in
illegible colors, but there will be more colors available.
C<B<CD_POLITE>> is the recommended type. It must always be used before
drawing. It cannot be queried. See also L<IUP::Canvas::Palette>.
=head3 cdCreatePalette()
$palete = $canvas=>cdCreatePalette($size);
#or
$palete = IUP::Canvas=>cdCreatePalette($size);
Creates a palette. See also L<IUP::Canvas::Palette>.
=head3 cdKillPalette()
$canvas->cdKillPalette($palette);
#or
IUP::Canvas->cdKillPalette($palette);
Destroys the created palette and liberates allocated memory.
=head3 Palette Data Access
Data access in Lua is done directly using the array access operators.
The colors can have their values checked or changed directly as if they
were Lua tables:
$palette->[$index] = IUP::Canvas->cdEncodeColor($r, $g, $b);
#...
$color = $palette->[$index];
($r, $g, $b) = IUP::Canvas->cdDecodeColor($color);
Notice that the type of value returned or received by palette[index] is
a lightuserdata, the same type used with functions L<cdEncodeColor|/"cdEncodeColor()">,
L<cdDecodeColor|/"cdDecodeColor()">, L<cdPixel|/"cdPixel()">, L<cdForeground|/"cdForeground()"> and L<cdBackground|/"cdBackground()">.
=head2 Methods - Coordinate System
=head3 cdGetSize()
( run in 1.728 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )